ccxt 4.5.56 → 4.5.57

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 (261) hide show
  1. package/README.md +10 -9
  2. package/dist/ccxt.browser.min.js +10 -10
  3. package/dist/cjs/ccxt.js +6 -11
  4. package/dist/cjs/src/apex.js +1 -1
  5. package/dist/cjs/src/arkham.js +3 -3
  6. package/dist/cjs/src/ascendex.js +2 -2
  7. package/dist/cjs/src/aster.js +7 -4
  8. package/dist/cjs/src/backpack.js +4 -4
  9. package/dist/cjs/src/base/Exchange.js +69 -32
  10. package/dist/cjs/src/base/functions/io.js +25 -0
  11. package/dist/cjs/src/base/functions.js +1 -0
  12. package/dist/cjs/src/bigone.js +3 -3
  13. package/dist/cjs/src/binance.js +192 -194
  14. package/dist/cjs/src/bingx.js +3 -3
  15. package/dist/cjs/src/bitfinex.js +71 -58
  16. package/dist/cjs/src/bitget.js +2 -2
  17. package/dist/cjs/src/bitmart.js +13 -6
  18. package/dist/cjs/src/bitmex.js +1 -1
  19. package/dist/cjs/src/bitopro.js +1 -1
  20. package/dist/cjs/src/bitrue.js +2 -2
  21. package/dist/cjs/src/bitso.js +1 -1
  22. package/dist/cjs/src/bitstamp.js +2 -1
  23. package/dist/cjs/src/bitteam.js +1 -1
  24. package/dist/cjs/src/bittrade.js +0 -1
  25. package/dist/cjs/src/bitvavo.js +457 -34
  26. package/dist/cjs/src/blofin.js +26 -3
  27. package/dist/cjs/src/bullish.js +6 -5
  28. package/dist/cjs/src/bydfi.js +1 -1
  29. package/dist/cjs/src/cex.js +3 -3
  30. package/dist/cjs/src/coinbase.js +75 -65
  31. package/dist/cjs/src/coinbaseexchange.js +2 -2
  32. package/dist/cjs/src/coinbaseinternational.js +2 -1
  33. package/dist/cjs/src/coinex.js +74 -74
  34. package/dist/cjs/src/coinmetro.js +1 -1
  35. package/dist/cjs/src/coinsph.js +1 -1
  36. package/dist/cjs/src/cryptocom.js +46 -48
  37. package/dist/cjs/src/cryptomus.js +43 -39
  38. package/dist/cjs/src/deepcoin.js +3 -2
  39. package/dist/cjs/src/delta.js +51 -52
  40. package/dist/cjs/src/deribit.js +31 -33
  41. package/dist/cjs/src/derive.js +26 -28
  42. package/dist/cjs/src/digifinex.js +43 -44
  43. package/dist/cjs/src/exmo.js +92 -83
  44. package/dist/cjs/src/extended.js +3497 -0
  45. package/dist/cjs/src/foxbit.js +71 -75
  46. package/dist/cjs/src/gate.js +53 -53
  47. package/dist/cjs/src/gemini.js +41 -43
  48. package/dist/cjs/src/grvt.js +4 -4
  49. package/dist/cjs/src/hashkey.js +52 -54
  50. package/dist/cjs/src/hitbtc.js +3 -13
  51. package/dist/cjs/src/hollaex.js +51 -54
  52. package/dist/cjs/src/htx.js +75 -67
  53. package/dist/cjs/src/hyperliquid.js +41 -42
  54. package/dist/cjs/src/indodax.js +2 -2
  55. package/dist/cjs/src/kraken.js +57 -58
  56. package/dist/cjs/src/kucoin.js +3 -2
  57. package/dist/cjs/src/latoken.js +30 -32
  58. package/dist/cjs/src/lbank.js +56 -56
  59. package/dist/cjs/src/lighter.js +35 -37
  60. package/dist/cjs/src/luno.js +35 -43
  61. package/dist/cjs/src/mexc.js +48 -49
  62. package/dist/cjs/src/modetrade.js +50 -52
  63. package/dist/cjs/src/ndax.js +35 -37
  64. package/dist/cjs/src/okx.js +17 -2
  65. package/dist/cjs/src/onetrading.js +21 -23
  66. package/dist/cjs/src/phemex.js +43 -45
  67. package/dist/cjs/src/poloniex.js +17 -12
  68. package/dist/cjs/src/pro/alpaca.js +1 -1
  69. package/dist/cjs/src/pro/apex.js +1 -1
  70. package/dist/cjs/src/pro/arkham.js +1 -1
  71. package/dist/cjs/src/pro/backpack.js +1 -1
  72. package/dist/cjs/src/pro/binance.js +3 -3
  73. package/dist/cjs/src/pro/bitget.js +1 -1
  74. package/dist/cjs/src/pro/bithumb.js +1 -1
  75. package/dist/cjs/src/pro/bitstamp.js +1 -1
  76. package/dist/cjs/src/pro/blockchaincom.js +1 -1
  77. package/dist/cjs/src/pro/bybit.js +1 -1
  78. package/dist/cjs/src/pro/cex.js +1 -1
  79. package/dist/cjs/src/pro/coinex.js +1 -1
  80. package/dist/cjs/src/pro/coinone.js +1 -1
  81. package/dist/cjs/src/pro/cryptocom.js +3 -1
  82. package/dist/cjs/src/pro/dydx.js +1 -1
  83. package/dist/cjs/src/pro/exmo.js +1 -1
  84. package/dist/cjs/src/pro/extended.js +865 -0
  85. package/dist/cjs/src/pro/gate.js +1 -1
  86. package/dist/cjs/src/pro/independentreserve.js +1 -1
  87. package/dist/cjs/src/pro/kucoin.js +1 -1
  88. package/dist/cjs/src/pro/luno.js +3 -3
  89. package/dist/cjs/src/pro/onetrading.js +1 -1
  90. package/dist/cjs/src/pro/toobit.js +1 -1
  91. package/dist/cjs/src/pro/weex.js +1 -1
  92. package/dist/cjs/src/static_dependencies/starknet/utils/hash/classHash.js +7 -7
  93. package/dist/cjs/src/tokocrypto.js +1 -1
  94. package/dist/cjs/src/toobit.js +2 -2
  95. package/dist/cjs/src/upbit.js +3 -3
  96. package/dist/cjs/src/weex.js +57 -62
  97. package/dist/cjs/src/whitebit.js +61 -63
  98. package/dist/cjs/src/woo.js +65 -54
  99. package/dist/cjs/src/woofipro.js +53 -47
  100. package/dist/cjs/src/xt.js +1 -1
  101. package/dist/cjs/src/zebpay.js +70 -72
  102. package/js/ccxt.d.ts +8 -14
  103. package/js/ccxt.js +6 -10
  104. package/js/src/abstract/bitvavo.d.ts +15 -7
  105. package/js/src/abstract/extended.d.ts +58 -0
  106. package/js/src/apex.js +1 -1
  107. package/js/src/arkham.js +3 -3
  108. package/js/src/ascendex.js +2 -2
  109. package/js/src/aster.js +7 -4
  110. package/js/src/backpack.js +4 -4
  111. package/js/src/base/Exchange.d.ts +10 -6
  112. package/js/src/base/Exchange.js +69 -32
  113. package/js/src/base/functions/io.d.ts +7 -0
  114. package/js/src/base/functions/io.js +24 -0
  115. package/js/src/bigone.js +3 -3
  116. package/js/src/binance.d.ts +2 -0
  117. package/js/src/binance.js +196 -198
  118. package/js/src/bingx.js +3 -3
  119. package/js/src/bitfinex.d.ts +2 -0
  120. package/js/src/bitfinex.js +71 -58
  121. package/js/src/bitget.js +2 -2
  122. package/js/src/bitmart.js +13 -6
  123. package/js/src/bitmex.js +1 -1
  124. package/js/src/bitopro.js +1 -1
  125. package/js/src/bitrue.js +2 -2
  126. package/js/src/bitso.js +1 -1
  127. package/js/src/bitstamp.js +2 -1
  128. package/js/src/bitteam.js +1 -1
  129. package/js/src/bittrade.js +0 -1
  130. package/js/src/bitvavo.d.ts +114 -21
  131. package/js/src/bitvavo.js +457 -34
  132. package/js/src/blofin.d.ts +1 -0
  133. package/js/src/blofin.js +26 -3
  134. package/js/src/bullish.js +6 -5
  135. package/js/src/bydfi.js +1 -1
  136. package/js/src/cex.js +3 -3
  137. package/js/src/coinbase.d.ts +63 -56
  138. package/js/src/coinbase.js +75 -65
  139. package/js/src/coinbaseexchange.js +2 -2
  140. package/js/src/coinbaseinternational.js +2 -1
  141. package/js/src/coinex.d.ts +1 -0
  142. package/js/src/coinex.js +74 -74
  143. package/js/src/coinmetro.d.ts +1 -1
  144. package/js/src/coinmetro.js +1 -1
  145. package/js/src/coinsph.js +1 -1
  146. package/js/src/cryptocom.d.ts +1 -0
  147. package/js/src/cryptocom.js +46 -48
  148. package/js/src/cryptomus.d.ts +2 -1
  149. package/js/src/cryptomus.js +43 -39
  150. package/js/src/deepcoin.js +3 -2
  151. package/js/src/delta.d.ts +1 -0
  152. package/js/src/delta.js +51 -52
  153. package/js/src/deribit.d.ts +1 -0
  154. package/js/src/deribit.js +31 -33
  155. package/js/src/derive.d.ts +1 -0
  156. package/js/src/derive.js +26 -28
  157. package/js/src/digifinex.d.ts +1 -0
  158. package/js/src/digifinex.js +43 -44
  159. package/js/src/exmo.d.ts +1 -0
  160. package/js/src/exmo.js +92 -83
  161. package/js/src/extended.d.ts +554 -0
  162. package/js/src/extended.js +3490 -0
  163. package/js/src/foxbit.d.ts +1 -0
  164. package/js/src/foxbit.js +71 -75
  165. package/js/src/gate.d.ts +1 -0
  166. package/js/src/gate.js +53 -53
  167. package/js/src/gemini.d.ts +2 -1
  168. package/js/src/gemini.js +41 -43
  169. package/js/src/grvt.js +4 -4
  170. package/js/src/hashkey.d.ts +1 -0
  171. package/js/src/hashkey.js +52 -54
  172. package/js/src/hitbtc.d.ts +0 -1
  173. package/js/src/hitbtc.js +3 -13
  174. package/js/src/hollaex.d.ts +1 -0
  175. package/js/src/hollaex.js +51 -54
  176. package/js/src/htx.d.ts +1 -0
  177. package/js/src/htx.js +75 -67
  178. package/js/src/hyperliquid.d.ts +1 -0
  179. package/js/src/hyperliquid.js +41 -42
  180. package/js/src/indodax.js +2 -2
  181. package/js/src/kraken.d.ts +2 -1
  182. package/js/src/kraken.js +57 -58
  183. package/js/src/kucoin.js +3 -2
  184. package/js/src/latoken.d.ts +1 -0
  185. package/js/src/latoken.js +30 -32
  186. package/js/src/lbank.d.ts +1 -0
  187. package/js/src/lbank.js +56 -56
  188. package/js/src/lighter.d.ts +1 -0
  189. package/js/src/lighter.js +35 -37
  190. package/js/src/luno.d.ts +1 -0
  191. package/js/src/luno.js +35 -43
  192. package/js/src/mexc.d.ts +2 -1
  193. package/js/src/mexc.js +48 -49
  194. package/js/src/modetrade.d.ts +1 -0
  195. package/js/src/modetrade.js +50 -52
  196. package/js/src/ndax.d.ts +1 -0
  197. package/js/src/ndax.js +35 -37
  198. package/js/src/okx.js +17 -2
  199. package/js/src/onetrading.d.ts +2 -1
  200. package/js/src/onetrading.js +21 -23
  201. package/js/src/phemex.d.ts +1 -0
  202. package/js/src/phemex.js +43 -45
  203. package/js/src/poloniex.js +17 -12
  204. package/js/src/pro/alpaca.js +1 -1
  205. package/js/src/pro/apex.js +1 -1
  206. package/js/src/pro/arkham.js +1 -1
  207. package/js/src/pro/backpack.js +1 -1
  208. package/js/src/pro/binance.js +3 -3
  209. package/js/src/pro/bitget.js +1 -1
  210. package/js/src/pro/bithumb.js +1 -1
  211. package/js/src/pro/bitstamp.js +1 -1
  212. package/js/src/pro/blockchaincom.js +1 -1
  213. package/js/src/pro/bybit.js +1 -1
  214. package/js/src/pro/cex.js +1 -1
  215. package/js/src/pro/coinex.js +1 -1
  216. package/js/src/pro/coinone.js +1 -1
  217. package/js/src/pro/cryptocom.js +3 -1
  218. package/js/src/pro/dydx.js +1 -1
  219. package/js/src/pro/exmo.js +1 -1
  220. package/js/src/pro/extended.d.ts +126 -0
  221. package/js/src/pro/extended.js +858 -0
  222. package/js/src/pro/gate.js +1 -1
  223. package/js/src/pro/independentreserve.js +1 -1
  224. package/js/src/pro/kucoin.js +1 -1
  225. package/js/src/pro/luno.d.ts +1 -1
  226. package/js/src/pro/luno.js +3 -3
  227. package/js/src/pro/onetrading.js +1 -1
  228. package/js/src/pro/toobit.js +1 -1
  229. package/js/src/pro/weex.js +1 -1
  230. package/js/src/tokocrypto.js +1 -1
  231. package/js/src/toobit.js +2 -2
  232. package/js/src/upbit.js +3 -3
  233. package/js/src/weex.d.ts +1 -0
  234. package/js/src/weex.js +57 -62
  235. package/js/src/whitebit.d.ts +1 -0
  236. package/js/src/whitebit.js +61 -63
  237. package/js/src/woo.d.ts +1 -0
  238. package/js/src/woo.js +65 -54
  239. package/js/src/woofipro.d.ts +1 -0
  240. package/js/src/woofipro.js +53 -47
  241. package/js/src/xt.js +1 -1
  242. package/js/src/zebpay.d.ts +2 -1
  243. package/js/src/zebpay.js +70 -72
  244. package/package.json +7 -7
  245. package/dist/cjs/src/gateio.js +0 -18
  246. package/dist/cjs/src/oxfun.js +0 -2933
  247. package/dist/cjs/src/pro/gateio.js +0 -18
  248. package/dist/cjs/src/pro/oxfun.js +0 -1113
  249. package/js/src/abstract/gateio.d.ts +0 -346
  250. package/js/src/abstract/gateio.js +0 -5
  251. package/js/src/abstract/oxfun.d.ts +0 -37
  252. package/js/src/gateio.d.ts +0 -4
  253. package/js/src/gateio.js +0 -11
  254. package/js/src/oxfun.d.ts +0 -442
  255. package/js/src/oxfun.js +0 -2926
  256. package/js/src/pro/gateio.d.ts +0 -4
  257. package/js/src/pro/gateio.js +0 -11
  258. package/js/src/pro/oxfun.d.ts +0 -234
  259. package/js/src/pro/oxfun.js +0 -1106
  260. /package/dist/cjs/src/abstract/{oxfun.js → extended.js} +0 -0
  261. /package/js/src/abstract/{oxfun.js → extended.js} +0 -0
@@ -516,39 +516,37 @@ class latoken extends latoken$1["default"] {
516
516
  // },
517
517
  // ]
518
518
  //
519
- const result = {};
520
- for (let i = 0; i < response.length; i++) {
521
- const currency = response[i];
522
- const id = this.safeString(currency, 'id');
523
- const tag = this.safeString(currency, 'tag');
524
- const code = this.safeCurrencyCode(tag);
525
- const currencyType = this.safeString(currency, 'type');
526
- const isCrypto = (currencyType === 'CURRENCY_TYPE_CRYPTO' || currencyType === 'CURRENCY_TYPE_IEO');
527
- result[code] = this.safeCurrencyStructure({
528
- 'id': id,
529
- 'code': code,
530
- 'info': currency,
531
- 'name': this.safeString(currency, 'name'),
532
- 'type': isCrypto ? 'crypto' : 'other',
533
- 'active': this.safeString(currency, 'status') === 'CURRENCY_STATUS_ACTIVE',
534
- 'deposit': undefined,
535
- 'withdraw': undefined,
536
- 'fee': this.safeNumber(currency, 'fee'),
537
- 'precision': this.parseNumber(this.parsePrecision(this.safeString(currency, 'decimals'))),
538
- 'limits': {
539
- 'amount': {
540
- 'min': this.safeNumber(currency, 'minTransferAmount'),
541
- 'max': undefined,
542
- },
543
- 'withdraw': {
544
- 'min': undefined,
545
- 'max': undefined,
546
- },
519
+ return this.parseCurrencies(response);
520
+ }
521
+ parseCurrency(currency) {
522
+ const id = this.safeString(currency, 'id');
523
+ const tag = this.safeString(currency, 'tag');
524
+ const code = this.safeCurrencyCode(tag);
525
+ const currencyType = this.safeString(currency, 'type');
526
+ const isCrypto = (currencyType === 'CURRENCY_TYPE_CRYPTO' || currencyType === 'CURRENCY_TYPE_IEO');
527
+ return this.safeCurrencyStructure({
528
+ 'id': id,
529
+ 'code': code,
530
+ 'info': currency,
531
+ 'name': this.safeString(currency, 'name'),
532
+ 'type': isCrypto ? 'crypto' : 'other',
533
+ 'active': this.safeString(currency, 'status') === 'CURRENCY_STATUS_ACTIVE',
534
+ 'deposit': undefined,
535
+ 'withdraw': undefined,
536
+ 'fee': this.safeNumber(currency, 'fee'),
537
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(currency, 'decimals'))),
538
+ 'limits': {
539
+ 'amount': {
540
+ 'min': this.safeNumber(currency, 'minTransferAmount'),
541
+ 'max': undefined,
547
542
  },
548
- 'networks': {},
549
- });
550
- }
551
- return result;
543
+ 'withdraw': {
544
+ 'min': undefined,
545
+ 'max': undefined,
546
+ },
547
+ },
548
+ 'networks': {},
549
+ });
552
550
  }
553
551
  /**
554
552
  * @method
@@ -453,66 +453,65 @@ class lbank extends lbank$1["default"] {
453
453
  //
454
454
  const currenciesData = this.safeList(response, 'data', []);
455
455
  const grouped = this.groupBy(currenciesData, 'assetCode');
456
- const groupedKeys = Object.keys(grouped);
457
- const result = {};
458
- for (let i = 0; i < groupedKeys.length; i++) {
459
- const id = (groupedKeys[i]).toString(); // some currencies are numeric
460
- const code = this.safeCurrencyCode(id);
461
- const networksRaw = grouped[id];
462
- const networks = {};
463
- for (let j = 0; j < networksRaw.length; j++) {
464
- const networkEntry = networksRaw[j];
465
- let networkId = this.safeString(networkEntry, 'chain');
466
- if (networkId === undefined) {
467
- networkId = this.safeString(networkEntry, 'assetCode'); // use type as fallback if networkId is not present
468
- }
469
- const networkCode = this.networkIdToCode(networkId);
470
- networks[networkCode] = {
471
- 'id': networkId,
472
- 'network': networkCode,
473
- 'limits': {
474
- 'withdraw': {
475
- 'min': this.safeNumber(networkEntry, 'min'),
476
- 'max': undefined,
477
- },
478
- 'deposit': {
479
- 'min': this.safeNumber(networkEntry, 'minTransfer'),
480
- 'max': undefined,
481
- },
482
- },
483
- 'active': undefined,
484
- 'deposit': undefined,
485
- 'withdraw': this.safeBool(networkEntry, 'canWithDraw'),
486
- 'fee': this.safeNumber(networkEntry, 'fee'),
487
- 'precision': this.parseNumber(this.parsePrecision(this.safeString(networkEntry, 'transferAmtScale'))),
488
- 'info': networkEntry,
489
- };
456
+ const values = Object.values(grouped);
457
+ return this.parseCurrencies(values);
458
+ }
459
+ parseCurrency(rawCurrency) {
460
+ const id = this.safeString(rawCurrency[0], 'assetCode'); // first member is guaranteed
461
+ const code = this.safeCurrencyCode(id);
462
+ const networksRaw = rawCurrency;
463
+ const networks = {};
464
+ for (let j = 0; j < networksRaw.length; j++) {
465
+ const networkEntry = networksRaw[j];
466
+ let networkId = this.safeString(networkEntry, 'chain');
467
+ if (networkId === undefined) {
468
+ networkId = this.safeString(networkEntry, 'assetCode'); // use type as fallback if networkId is not present
490
469
  }
491
- result[code] = this.safeCurrencyStructure({
492
- 'id': id,
493
- 'code': code,
494
- 'precision': undefined,
495
- 'type': undefined,
496
- 'name': undefined,
497
- 'active': undefined,
498
- 'deposit': undefined,
499
- 'withdraw': undefined,
500
- 'fee': undefined,
470
+ const networkCode = this.networkIdToCode(networkId, code);
471
+ networks[networkCode] = {
472
+ 'id': networkId,
473
+ 'network': networkCode,
501
474
  'limits': {
502
475
  'withdraw': {
503
- 'min': undefined,
476
+ 'min': this.safeNumber(networkEntry, 'min'),
504
477
  'max': undefined,
505
478
  },
506
479
  'deposit': {
507
- 'min': undefined,
480
+ 'min': this.safeNumber(networkEntry, 'minTransfer'),
508
481
  'max': undefined,
509
482
  },
510
483
  },
511
- 'networks': networks,
512
- 'info': networksRaw,
513
- });
484
+ 'active': undefined,
485
+ 'deposit': undefined,
486
+ 'withdraw': this.safeBool(networkEntry, 'canWithDraw'),
487
+ 'fee': this.safeNumber(networkEntry, 'fee'),
488
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(networkEntry, 'transferAmtScale'))),
489
+ 'info': networkEntry,
490
+ };
514
491
  }
515
- return result;
492
+ return this.safeCurrencyStructure({
493
+ 'id': id,
494
+ 'code': code,
495
+ 'precision': undefined,
496
+ 'type': undefined,
497
+ 'name': undefined,
498
+ 'active': undefined,
499
+ 'deposit': undefined,
500
+ 'withdraw': undefined,
501
+ 'fee': undefined,
502
+ 'limits': {
503
+ 'withdraw': {
504
+ 'min': undefined,
505
+ 'max': undefined,
506
+ },
507
+ 'deposit': {
508
+ 'min': undefined,
509
+ 'max': undefined,
510
+ },
511
+ },
512
+ 'networks': networks,
513
+ 'info': networksRaw,
514
+ });
516
515
  }
517
516
  /**
518
517
  * @method
@@ -2275,7 +2274,7 @@ class lbank extends lbank$1["default"] {
2275
2274
  return {
2276
2275
  'info': response,
2277
2276
  'currency': code,
2278
- 'network': this.networkIdToCode(this.safeString(result, 'netWork')),
2277
+ 'network': this.networkIdToCode(this.safeString(result, 'netWork'), code),
2279
2278
  'address': address,
2280
2279
  'tag': tag,
2281
2280
  };
@@ -2464,7 +2463,7 @@ class lbank extends lbank$1["default"] {
2464
2463
  'txid': txid,
2465
2464
  'timestamp': timestamp,
2466
2465
  'datetime': this.iso8601(timestamp),
2467
- 'network': this.networkIdToCode(this.safeString(transaction, 'networkName')),
2466
+ 'network': this.networkIdToCode(this.safeString(transaction, 'networkName'), code),
2468
2467
  'address': address,
2469
2468
  'addressTo': addressTo,
2470
2469
  'addressFrom': addressFrom,
@@ -2669,7 +2668,7 @@ class lbank extends lbank$1["default"] {
2669
2668
  const networkEntry = networkList[j];
2670
2669
  const fee = this.safeNumber(networkEntry, 'withdrawFee');
2671
2670
  if (fee !== undefined) {
2672
- const networkCode = this.networkIdToCode(this.safeString(networkEntry, 'name'));
2671
+ const networkCode = this.networkIdToCode(this.safeString(networkEntry, 'name'), code);
2673
2672
  withdrawFees[code][networkCode] = fee;
2674
2673
  }
2675
2674
  }
@@ -2721,7 +2720,7 @@ class lbank extends lbank$1["default"] {
2721
2720
  if (canWithdraw === 'true') {
2722
2721
  const currencyId = this.safeString(item, 'assetCode');
2723
2722
  const codeInner = this.safeCurrencyCode(currencyId);
2724
- let network = this.networkIdToCode(this.safeString(item, 'chain'));
2723
+ let network = this.networkIdToCode(this.safeString(item, 'chain'), codeInner);
2725
2724
  if (network === undefined) {
2726
2725
  network = codeInner;
2727
2726
  }
@@ -2872,7 +2871,7 @@ class lbank extends lbank$1["default"] {
2872
2871
  const resultCodeInfo = result[code]['info'];
2873
2872
  resultCodeInfo.push(fee);
2874
2873
  }
2875
- const networkCode = this.networkIdToCode(this.safeString(fee, 'chain'));
2874
+ const networkCode = this.networkIdToCode(this.safeString(fee, 'chain'), code);
2876
2875
  if (networkCode !== undefined) {
2877
2876
  result[code]['networks'][networkCode] = {
2878
2877
  'withdraw': {
@@ -2925,10 +2924,11 @@ class lbank extends lbank$1["default"] {
2925
2924
  // }
2926
2925
  //
2927
2926
  const result = this.depositWithdrawFee(fee);
2927
+ const code = this.safeString(currency, 'code');
2928
2928
  const networkList = this.safeValue(fee, 'networkList', []);
2929
2929
  for (let j = 0; j < networkList.length; j++) {
2930
2930
  const networkEntry = networkList[j];
2931
- const networkCode = this.networkIdToCode(this.safeString(networkEntry, 'name'));
2931
+ const networkCode = this.networkIdToCode(this.safeString(networkEntry, 'name'), code);
2932
2932
  const withdrawFee = this.safeNumber(networkEntry, 'withdrawFee');
2933
2933
  const isDefault = this.safeValue(networkEntry, 'isDefault');
2934
2934
  if (withdrawFee !== undefined) {
@@ -1275,44 +1275,42 @@ class lighter extends lighter$1["default"] {
1275
1275
  // }
1276
1276
  //
1277
1277
  const data = this.safeList(response, 'asset_details', []);
1278
- const result = {};
1279
- for (let i = 0; i < data.length; i++) {
1280
- const entry = data[i];
1281
- const id = this.safeString(entry, 'asset_id');
1282
- const code = this.safeCurrencyCode(this.safeString(entry, 'symbol'));
1283
- const decimals = this.safeString(entry, 'decimals');
1284
- const isUSDC = (code === 'USDC');
1285
- let depositMin = undefined;
1286
- let withdrawMin = undefined;
1287
- if (isUSDC) {
1288
- depositMin = this.safeNumber(entry, 'min_transfer_amount');
1289
- withdrawMin = this.safeNumber(entry, 'min_withdrawal_amount');
1290
- }
1291
- result[code] = this.safeCurrencyStructure({
1292
- 'id': id,
1293
- 'name': code,
1294
- 'code': code,
1295
- 'precision': this.parseNumber('1e-' + decimals),
1296
- 'active': true,
1297
- 'fee': undefined,
1298
- 'networks': {},
1299
- 'deposit': isUSDC,
1300
- 'withdraw': isUSDC,
1301
- 'type': 'crypto',
1302
- 'limits': {
1303
- 'deposit': {
1304
- 'min': depositMin,
1305
- 'max': undefined,
1306
- },
1307
- 'withdraw': {
1308
- 'min': withdrawMin,
1309
- 'max': undefined,
1310
- },
1278
+ return this.parseCurrencies(data);
1279
+ }
1280
+ parseCurrency(rawCurrency) {
1281
+ const id = this.safeString(rawCurrency, 'asset_id');
1282
+ const code = this.safeCurrencyCode(this.safeString(rawCurrency, 'symbol'));
1283
+ const decimals = this.safeString(rawCurrency, 'decimals');
1284
+ const isUSDC = (code === 'USDC');
1285
+ let depositMin = undefined;
1286
+ let withdrawMin = undefined;
1287
+ if (isUSDC) {
1288
+ depositMin = this.safeNumber(rawCurrency, 'min_transfer_amount');
1289
+ withdrawMin = this.safeNumber(rawCurrency, 'min_withdrawal_amount');
1290
+ }
1291
+ return this.safeCurrencyStructure({
1292
+ 'id': id,
1293
+ 'name': code,
1294
+ 'code': code,
1295
+ 'precision': this.parseNumber('1e-' + decimals),
1296
+ 'active': true,
1297
+ 'fee': undefined,
1298
+ 'networks': {},
1299
+ 'deposit': isUSDC,
1300
+ 'withdraw': isUSDC,
1301
+ 'type': 'crypto',
1302
+ 'limits': {
1303
+ 'deposit': {
1304
+ 'min': depositMin,
1305
+ 'max': undefined,
1311
1306
  },
1312
- 'info': entry,
1313
- });
1314
- }
1315
- return result;
1307
+ 'withdraw': {
1308
+ 'min': withdrawMin,
1309
+ 'max': undefined,
1310
+ },
1311
+ },
1312
+ 'info': rawCurrency,
1313
+ });
1316
1314
  }
1317
1315
  /**
1318
1316
  * @method
@@ -331,39 +331,19 @@ class luno extends luno$1["default"] {
331
331
  // }
332
332
  //
333
333
  const currenciesData = this.safeList(response, 'data', []);
334
- const result = {};
335
- for (let i = 0; i < currenciesData.length; i++) {
336
- const networkEntry = currenciesData[i];
337
- const id = this.safeString(networkEntry, 'native_currency');
338
- const code = this.safeCurrencyCode(id);
339
- if (!(code in result)) {
340
- result[code] = {
341
- 'id': id,
342
- 'code': code,
343
- 'precision': undefined,
344
- 'type': undefined,
345
- 'name': undefined,
346
- 'active': undefined,
347
- 'deposit': undefined,
348
- 'withdraw': undefined,
349
- 'fee': undefined,
350
- 'limits': {
351
- 'withdraw': {
352
- 'min': undefined,
353
- 'max': undefined,
354
- },
355
- 'deposit': {
356
- 'min': undefined,
357
- 'max': undefined,
358
- },
359
- },
360
- 'networks': {},
361
- 'info': {},
362
- };
363
- }
334
+ const grouped = this.groupBy(currenciesData, 'native_currency');
335
+ const values = Object.values(grouped);
336
+ return this.parseCurrencies(values);
337
+ }
338
+ parseCurrency(rawCurrency) {
339
+ const id = this.safeString(rawCurrency[0], 'native_currency'); // first item is guaranteed
340
+ const code = this.safeCurrencyCode(id);
341
+ const networks = {};
342
+ for (let i = 0; i < rawCurrency.length; i++) {
343
+ const networkEntry = rawCurrency[i];
364
344
  const networkId = this.safeString(networkEntry, 'name');
365
- const networkCode = this.networkIdToCode(networkId);
366
- result[code]['networks'][networkCode] = {
345
+ const networkCode = this.networkIdToCode(networkId, code);
346
+ networks[networkCode] = {
367
347
  'id': networkId,
368
348
  'network': networkCode,
369
349
  'limits': {
@@ -383,18 +363,30 @@ class luno extends luno$1["default"] {
383
363
  'precision': undefined,
384
364
  'info': networkEntry,
385
365
  };
386
- // add entry in info
387
- const info = this.safeList(result[code], 'info', []);
388
- info.push(networkEntry);
389
- result[code]['info'] = info;
390
366
  }
391
- // only after all entries are formed in currencies, restructure each entry
392
- const allKeys = Object.keys(result);
393
- for (let i = 0; i < allKeys.length; i++) {
394
- const code = allKeys[i];
395
- result[code] = this.safeCurrencyStructure(result[code]); // this is needed after adding network entry
396
- }
397
- return result;
367
+ return this.safeCurrencyStructure({
368
+ 'id': id,
369
+ 'code': code,
370
+ 'precision': undefined,
371
+ 'type': undefined,
372
+ 'name': undefined,
373
+ 'active': undefined,
374
+ 'deposit': undefined,
375
+ 'withdraw': undefined,
376
+ 'fee': undefined,
377
+ 'limits': {
378
+ 'withdraw': {
379
+ 'min': undefined,
380
+ 'max': undefined,
381
+ },
382
+ 'deposit': {
383
+ 'min': undefined,
384
+ 'max': undefined,
385
+ },
386
+ },
387
+ 'networks': networks,
388
+ 'info': rawCurrency,
389
+ });
398
390
  }
399
391
  /**
400
392
  * @method
@@ -1151,56 +1151,54 @@ class mexc extends mexc$1["default"] {
1151
1151
  // ]
1152
1152
  // }
1153
1153
  //
1154
- const result = {};
1155
- for (let i = 0; i < response.length; i++) {
1156
- const currency = response[i];
1157
- const id = this.safeString(currency, 'coin');
1158
- const code = this.safeCurrencyCode(id);
1159
- const networks = {};
1160
- const chains = this.safeValue(currency, 'networkList', []);
1161
- for (let j = 0; j < chains.length; j++) {
1162
- const chain = chains[j];
1163
- const networkId = this.safeString2(chain, 'netWork', 'network');
1164
- const network = this.networkIdToCode(networkId);
1165
- networks[network] = {
1166
- 'info': chain,
1167
- 'id': networkId,
1168
- 'network': network,
1169
- 'active': undefined,
1170
- 'deposit': this.safeBool(chain, 'depositEnable', false),
1171
- 'withdraw': this.safeBool(chain, 'withdrawEnable', false),
1172
- 'fee': this.safeNumber(chain, 'withdrawFee'),
1173
- 'precision': undefined,
1174
- 'limits': {
1175
- 'withdraw': {
1176
- 'min': this.safeString(chain, 'withdrawMin'),
1177
- 'max': this.safeString(chain, 'withdrawMax'),
1178
- },
1179
- },
1180
- 'contract': this.safeString(chain, 'contract'),
1181
- };
1182
- }
1183
- result[code] = this.safeCurrencyStructure({
1184
- 'info': currency,
1185
- 'id': id,
1186
- 'code': code,
1187
- 'name': this.safeString(currency, 'name'),
1154
+ return this.parseCurrencies(response);
1155
+ }
1156
+ parseCurrency(rawCurrency) {
1157
+ const id = this.safeString(rawCurrency, 'coin');
1158
+ const code = this.safeCurrencyCode(id);
1159
+ const networks = {};
1160
+ const chains = this.safeValue(rawCurrency, 'networkList', []);
1161
+ for (let j = 0; j < chains.length; j++) {
1162
+ const chain = chains[j];
1163
+ const networkId = this.safeString2(chain, 'netWork', 'network');
1164
+ const network = this.networkIdToCode(networkId, code);
1165
+ networks[network] = {
1166
+ 'info': chain,
1167
+ 'id': networkId,
1168
+ 'network': network,
1188
1169
  'active': undefined,
1189
- 'deposit': undefined,
1190
- 'withdraw': undefined,
1191
- 'fee': undefined,
1170
+ 'deposit': this.safeBool(chain, 'depositEnable', false),
1171
+ 'withdraw': this.safeBool(chain, 'withdrawEnable', false),
1172
+ 'fee': this.safeNumber(chain, 'withdrawFee'),
1192
1173
  'precision': undefined,
1193
1174
  'limits': {
1194
- 'amount': {
1195
- 'min': undefined,
1196
- 'max': undefined,
1175
+ 'withdraw': {
1176
+ 'min': this.safeString(chain, 'withdrawMin'),
1177
+ 'max': this.safeString(chain, 'withdrawMax'),
1197
1178
  },
1198
1179
  },
1199
- 'type': 'crypto',
1200
- 'networks': networks,
1201
- });
1180
+ 'contract': this.safeString(chain, 'contract'),
1181
+ };
1202
1182
  }
1203
- return result;
1183
+ return this.safeCurrencyStructure({
1184
+ 'info': rawCurrency,
1185
+ 'id': id,
1186
+ 'code': code,
1187
+ 'name': this.safeString(rawCurrency, 'name'),
1188
+ 'active': undefined,
1189
+ 'deposit': undefined,
1190
+ 'withdraw': undefined,
1191
+ 'fee': undefined,
1192
+ 'precision': undefined,
1193
+ 'limits': {
1194
+ 'amount': {
1195
+ 'min': undefined,
1196
+ 'max': undefined,
1197
+ },
1198
+ },
1199
+ 'type': 'crypto',
1200
+ 'networks': networks,
1201
+ });
1204
1202
  }
1205
1203
  /**
1206
1204
  * @method
@@ -1538,7 +1536,7 @@ class mexc extends mexc$1["default"] {
1538
1536
  }
1539
1537
  return orderbook;
1540
1538
  }
1541
- parseBidAsk(bidask, priceKey = 0, amountKey = 1, countOrIdKey = 2) {
1539
+ parseOrderBookBidAsk(bidask, priceKey = 0, amountKey = 1, countOrIdKey = 2) {
1542
1540
  const countKey = 2;
1543
1541
  const price = this.safeNumber(bidask, priceKey);
1544
1542
  const amount = this.safeNumber(bidask, amountKey);
@@ -4767,11 +4765,12 @@ class mexc extends mexc$1["default"] {
4767
4765
  //
4768
4766
  const address = this.safeString(depositAddress, 'address');
4769
4767
  const currencyId = this.safeString(depositAddress, 'coin');
4768
+ const code = this.safeCurrencyCode(currencyId, currency);
4770
4769
  const networkId = this.safeString(depositAddress, 'netWork');
4771
4770
  return {
4772
4771
  'info': depositAddress,
4773
- 'currency': this.safeCurrencyCode(currencyId, currency),
4774
- 'network': this.networkIdToCode(networkId, currencyId),
4772
+ 'currency': code,
4773
+ 'network': this.networkIdToCode(networkId, code),
4775
4774
  'address': address,
4776
4775
  'tag': this.safeString(depositAddress, 'memo'),
4777
4776
  };
@@ -5090,12 +5089,12 @@ class mexc extends mexc$1["default"] {
5090
5089
  if (currencyWithNetwork !== undefined) {
5091
5090
  currencyId = currencyWithNetwork.split('-')[0];
5092
5091
  }
5092
+ const code = this.safeCurrencyCode(currencyId, currency);
5093
5093
  let network = undefined;
5094
5094
  const rawNetwork = this.safeString(transaction, 'network');
5095
5095
  if (rawNetwork !== undefined) {
5096
- network = this.networkIdToCode(rawNetwork);
5096
+ network = this.networkIdToCode(rawNetwork, code);
5097
5097
  }
5098
- const code = this.safeCurrencyCode(currencyId, currency);
5099
5098
  const status = this.parseTransactionStatusByType(this.safeString(transaction, 'status'), type);
5100
5099
  let amountString = this.safeString(transaction, 'amount');
5101
5100
  const address = this.safeString(transaction, 'address');