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
@@ -491,66 +491,63 @@ class hollaex extends hollaex$1["default"] {
491
491
  // }
492
492
  //
493
493
  const coins = this.safeDict(response, 'coins', {});
494
- const keys = Object.keys(coins);
495
- const result = {};
496
- for (let i = 0; i < keys.length; i++) {
497
- const key = keys[i];
498
- const currency = coins[key];
499
- const id = this.safeString(currency, 'symbol');
500
- const code = this.safeCurrencyCode(id);
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({
529
- 'id': id,
530
- 'numericId': this.safeInteger(currency, 'id'),
531
- 'code': code,
532
- 'info': currency,
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'),
538
- 'precision': this.safeNumber(currency, 'increment_unit'),
494
+ const values = Object.values(coins);
495
+ return this.parseCurrencies(values);
496
+ }
497
+ parseCurrency(rawCurrency) {
498
+ const id = this.safeString(rawCurrency, 'symbol');
499
+ const code = this.safeCurrencyCode(id);
500
+ const withdrawalLimits = this.safeList(rawCurrency, 'withdrawal_limits', []);
501
+ const rawType = this.safeString(rawCurrency, 'type');
502
+ const type = (rawType === 'blockchain') ? 'crypto' : 'other';
503
+ const rawNetworks = this.safeDict(rawCurrency, 'withdrawal_fees', {});
504
+ const networks = {};
505
+ const networkIds = Object.keys(rawNetworks);
506
+ for (let j = 0; j < networkIds.length; j++) {
507
+ const networkId = networkIds[j];
508
+ const networkEntry = this.safeDict(rawNetworks, networkId);
509
+ const networkCode = this.networkIdToCode(networkId, code);
510
+ networks[networkCode] = {
511
+ 'id': networkId,
512
+ 'network': networkCode,
513
+ 'active': this.safeBool(networkEntry, 'active'),
514
+ 'deposit': undefined,
515
+ 'withdraw': undefined,
516
+ 'fee': this.safeNumber(networkEntry, 'value'),
517
+ 'precision': undefined,
539
518
  'limits': {
540
- 'amount': {
541
- 'min': this.safeNumber(currency, 'min'),
542
- 'max': this.safeNumber(currency, 'max'),
543
- },
544
519
  'withdraw': {
545
520
  'min': undefined,
546
- 'max': this.safeValue(withdrawalLimits, 0),
521
+ 'max': undefined,
547
522
  },
548
523
  },
549
- 'networks': networks,
550
- 'type': type,
551
- });
524
+ 'info': networkEntry,
525
+ };
552
526
  }
553
- return result;
527
+ return this.safeCurrencyStructure({
528
+ 'id': id,
529
+ 'numericId': this.safeInteger(rawCurrency, 'id'),
530
+ 'code': code,
531
+ 'info': rawCurrency,
532
+ 'name': this.safeString(rawCurrency, 'fullname'),
533
+ 'active': this.safeBool(rawCurrency, 'active'),
534
+ 'deposit': this.safeBool(rawCurrency, 'allow_deposit'),
535
+ 'withdraw': this.safeBool(rawCurrency, 'allow_withdrawal'),
536
+ 'fee': this.safeNumber(rawCurrency, 'withdrawal_fee'),
537
+ 'precision': this.safeNumber(rawCurrency, 'increment_unit'),
538
+ 'limits': {
539
+ 'amount': {
540
+ 'min': this.safeNumber(rawCurrency, 'min'),
541
+ 'max': this.safeNumber(rawCurrency, 'max'),
542
+ },
543
+ 'withdraw': {
544
+ 'min': undefined,
545
+ 'max': this.safeValue(withdrawalLimits, 0),
546
+ },
547
+ },
548
+ 'networks': networks,
549
+ 'type': type,
550
+ });
554
551
  }
555
552
  /**
556
553
  * @method
@@ -189,7 +189,7 @@ class htx extends htx$1["default"] {
189
189
  },
190
190
  'www': 'https://www.huobi.com',
191
191
  'referral': {
192
- 'url': 'https://www.htx.com.vc/invite/en-us/1h?invite_code=6rmm2223',
192
+ 'url': 'https://www.htx.com/invite/en-us/1h?invite_code=6rmm2223',
193
193
  'discount': 0.15,
194
194
  },
195
195
  'doc': [
@@ -1194,6 +1194,9 @@ class htx extends htx$1["default"] {
1194
1194
  // 'BCC': 'BCC', BCH's somewhat chain
1195
1195
  // 'DBC1': 'DBC1',
1196
1196
  },
1197
+ 'networksById': {
1198
+ 'MATIC': 'MATIC',
1199
+ },
1197
1200
  // https://github.com/ccxt/ccxt/issues/5376
1198
1201
  'fetchOrdersByStatesMethod': 'spot_private_get_v1_order_orders',
1199
1202
  'createMarketBuyOrderRequiresPrice': true,
@@ -3480,75 +3483,79 @@ class htx extends htx$1["default"] {
3480
3483
  // }
3481
3484
  //
3482
3485
  const data = this.safeList(response, 'data', []);
3483
- const result = {};
3484
- this.options['networkChainIdsByNames'] = {};
3485
3486
  this.options['networkNamesByChainIds'] = {};
3486
- for (let i = 0; i < data.length; i++) {
3487
- const entry = data[i];
3488
- const currencyId = this.safeString(entry, 'currency');
3489
- const code = this.safeCurrencyCode(currencyId);
3490
- const assetType = this.safeString(entry, 'assetType');
3491
- const type = assetType === '1' ? 'crypto' : 'fiat';
3492
- this.options['networkChainIdsByNames'][code] = {};
3493
- const chains = this.safeList(entry, 'chains', []);
3494
- const networks = {};
3495
- for (let j = 0; j < chains.length; j++) {
3496
- const chainEntry = chains[j];
3497
- const uniqueChainId = this.safeString(chainEntry, 'chain'); // i.e. usdterc20, trc20usdt ...
3498
- const title = this.safeString2(chainEntry, 'baseChain', 'displayName'); // baseChain and baseChainProtocol are together existent or inexistent in entries, but baseChain is preferred. when they are both inexistent, then we use generic displayName
3499
- this.options['networkChainIdsByNames'][code][title] = uniqueChainId;
3500
- this.options['networkNamesByChainIds'][uniqueChainId] = title;
3501
- const networkCode = this.networkIdToCode(uniqueChainId);
3502
- networks[networkCode] = {
3503
- 'info': chainEntry,
3504
- 'id': uniqueChainId,
3505
- 'network': networkCode,
3506
- 'limits': {
3507
- 'deposit': {
3508
- 'min': this.safeNumber(chainEntry, 'minDepositAmt'),
3509
- 'max': undefined,
3510
- },
3511
- 'withdraw': {
3512
- 'min': this.safeNumber(chainEntry, 'minWithdrawAmt'),
3513
- 'max': this.safeNumber(chainEntry, 'maxWithdrawAmt'),
3514
- },
3515
- },
3516
- 'active': undefined,
3517
- 'deposit': this.safeString(chainEntry, 'depositStatus') === 'allowed',
3518
- 'withdraw': this.safeString(chainEntry, 'withdrawStatus') === 'allowed',
3519
- 'fee': this.safeNumber(chainEntry, 'transactFeeWithdraw'),
3520
- 'precision': this.parseNumber(this.parsePrecision(this.safeString(chainEntry, 'withdrawPrecision'))),
3521
- };
3522
- }
3523
- result[code] = this.safeCurrencyStructure({
3524
- 'info': entry,
3525
- 'code': code,
3526
- 'id': currencyId,
3527
- 'active': this.safeString(entry, 'instStatus') === 'normal',
3528
- 'deposit': undefined,
3529
- 'withdraw': undefined,
3530
- 'fee': undefined,
3531
- 'name': undefined,
3532
- 'type': type,
3487
+ this.options['networkChainIdsByNames'] = {};
3488
+ return this.parseCurrencies(data);
3489
+ }
3490
+ parseCurrency(rawCurrency) {
3491
+ if (!('networkNamesByChainIds' in this.options)) {
3492
+ this.options['networkNamesByChainIds'] = {};
3493
+ }
3494
+ if (!('networkChainIdsByNames' in this.options)) {
3495
+ this.options['networkChainIdsByNames'] = {};
3496
+ }
3497
+ const currencyId = this.safeString(rawCurrency, 'currency');
3498
+ const code = this.safeCurrencyCode(currencyId);
3499
+ const assetType = this.safeString(rawCurrency, 'assetType');
3500
+ const type = (assetType === '1') ? 'crypto' : 'fiat';
3501
+ this.options['networkChainIdsByNames'][code] = {};
3502
+ const chains = this.safeList(rawCurrency, 'chains', []);
3503
+ const networks = {};
3504
+ for (let j = 0; j < chains.length; j++) {
3505
+ const chainEntry = chains[j];
3506
+ const uniqueChainId = this.safeString(chainEntry, 'chain'); // i.e. usdterc20, trc20usdt ...
3507
+ const title = this.safeString2(chainEntry, 'baseChain', 'displayName'); // baseChain and baseChainProtocol are together existent or inexistent in entries, but baseChain is preferred. when they are both inexistent, then we use generic displayName
3508
+ this.options['networkChainIdsByNames'][code][title] = uniqueChainId;
3509
+ this.options['networkNamesByChainIds'][uniqueChainId] = title;
3510
+ const networkCode = this.networkIdToCode(uniqueChainId, code);
3511
+ networks[networkCode] = {
3512
+ 'info': chainEntry,
3513
+ 'id': uniqueChainId,
3514
+ 'network': networkCode,
3533
3515
  'limits': {
3534
- 'amount': {
3535
- 'min': undefined,
3516
+ 'deposit': {
3517
+ 'min': this.safeNumber(chainEntry, 'minDepositAmt'),
3536
3518
  'max': undefined,
3537
3519
  },
3538
3520
  'withdraw': {
3539
- 'min': undefined,
3540
- 'max': undefined,
3541
- },
3542
- 'deposit': {
3543
- 'min': undefined,
3544
- 'max': undefined,
3521
+ 'min': this.safeNumber(chainEntry, 'minWithdrawAmt'),
3522
+ 'max': this.safeNumber(chainEntry, 'maxWithdrawAmt'),
3545
3523
  },
3546
3524
  },
3547
- 'precision': undefined,
3548
- 'networks': networks,
3549
- });
3525
+ 'active': undefined,
3526
+ 'deposit': this.safeString(chainEntry, 'depositStatus') === 'allowed',
3527
+ 'withdraw': this.safeString(chainEntry, 'withdrawStatus') === 'allowed',
3528
+ 'fee': this.safeNumber(chainEntry, 'transactFeeWithdraw'),
3529
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(chainEntry, 'withdrawPrecision'))),
3530
+ };
3550
3531
  }
3551
- return result;
3532
+ return this.safeCurrencyStructure({
3533
+ 'info': rawCurrency,
3534
+ 'code': code,
3535
+ 'id': currencyId,
3536
+ 'active': this.safeString(rawCurrency, 'instStatus') === 'normal',
3537
+ 'deposit': undefined,
3538
+ 'withdraw': undefined,
3539
+ 'fee': undefined,
3540
+ 'name': undefined,
3541
+ 'type': type,
3542
+ 'limits': {
3543
+ 'amount': {
3544
+ 'min': undefined,
3545
+ 'max': undefined,
3546
+ },
3547
+ 'withdraw': {
3548
+ 'min': undefined,
3549
+ 'max': undefined,
3550
+ },
3551
+ 'deposit': {
3552
+ 'min': undefined,
3553
+ 'max': undefined,
3554
+ },
3555
+ },
3556
+ 'precision': undefined,
3557
+ 'networks': networks,
3558
+ });
3552
3559
  }
3553
3560
  networkIdToCode(networkId = undefined, currencyCode = undefined) {
3554
3561
  // here network-id is provided as a pair of currency & chain (i.e. trc20usdt)
@@ -3558,7 +3565,7 @@ class htx extends htx$1["default"] {
3558
3565
  throw new errors.ExchangeError(this.id + ' networkIdToCode() - markets need to be loaded at first');
3559
3566
  }
3560
3567
  const networkTitle = this.safeValue(this.options['networkNamesByChainIds'], networkId, networkId);
3561
- return super.networkIdToCode(networkTitle);
3568
+ return super.networkIdToCode(networkTitle, currencyCode);
3562
3569
  }
3563
3570
  networkCodeToId(networkCode, currencyCode = undefined) {
3564
3571
  if (currencyCode === undefined) {
@@ -3574,7 +3581,7 @@ class htx extends htx$1["default"] {
3574
3581
  return uniqueNetworkIds[networkCode];
3575
3582
  }
3576
3583
  else {
3577
- const networkTitle = super.networkCodeToId(networkCode);
3584
+ const networkTitle = super.networkCodeToId(networkCode, currencyCode);
3578
3585
  return this.safeValue(uniqueNetworkIds, networkTitle, networkTitle);
3579
3586
  }
3580
3587
  }
@@ -6599,7 +6606,7 @@ class htx extends htx$1["default"] {
6599
6606
  'currency': code,
6600
6607
  'address': address,
6601
6608
  'tag': tag,
6602
- 'network': this.networkIdToCode(networkId),
6609
+ 'network': this.networkIdToCode(networkId, code),
6603
6610
  'note': note,
6604
6611
  'info': depositAddress,
6605
6612
  };
@@ -6880,7 +6887,7 @@ class htx extends htx$1["default"] {
6880
6887
  'txid': txHash,
6881
6888
  'timestamp': timestamp,
6882
6889
  'datetime': this.iso8601(timestamp),
6883
- 'network': this.networkIdToCode(networkId),
6890
+ 'network': this.networkIdToCode(networkId, code),
6884
6891
  'address': this.safeString(transaction, 'address'),
6885
6892
  'addressTo': undefined,
6886
6893
  'addressFrom': undefined,
@@ -9414,12 +9421,13 @@ class htx extends htx$1["default"] {
9414
9421
  // }
9415
9422
  //
9416
9423
  const chains = this.safeValue(fee, 'chains', []);
9424
+ const code = this.safeString(currency, 'code');
9417
9425
  let result = this.depositWithdrawFee(fee);
9418
9426
  for (let j = 0; j < chains.length; j++) {
9419
9427
  const chainEntry = chains[j];
9420
9428
  const networkId = this.safeString(chainEntry, 'chain');
9421
9429
  const withdrawFeeType = this.safeString(chainEntry, 'withdrawFeeType');
9422
- const networkCode = this.networkIdToCode(networkId);
9430
+ const networkCode = this.networkIdToCode(networkId, code);
9423
9431
  let withdrawFee = undefined;
9424
9432
  let withdrawResult = undefined;
9425
9433
  if (withdrawFeeType === 'fixed') {
@@ -462,50 +462,49 @@ class hyperliquid extends hyperliquid$1["default"] {
462
462
  const tokens = this.safeList(response, 'tokens', []);
463
463
  // const meta = this.safeList (response, 'universe', []);
464
464
  this.options['cachedCurrenciesById'] = {}; // used to map hip3 markets
465
- const result = {};
466
- for (let i = 0; i < tokens.length; i++) {
467
- const data = this.safeDict(tokens, i, {});
468
- // const id = i;
469
- const id = this.safeString(data, 'index');
470
- const name = this.safeString(data, 'name');
471
- const code = this.safeCurrencyCode(name);
472
- this.options['cachedCurrenciesById'][id] = name;
473
- result[code] = this.safeCurrencyStructure({
474
- 'id': id,
475
- 'name': name,
476
- 'code': code,
477
- 'precision': this.parsePrecision(this.safeString(data, 'weiDecimals')),
478
- 'info': data,
479
- 'active': undefined,
480
- 'deposit': undefined,
481
- 'withdraw': undefined,
482
- 'networks': undefined,
483
- 'fee': undefined,
484
- 'type': 'crypto',
485
- 'limits': {
486
- 'amount': {
487
- 'min': undefined,
488
- 'max': undefined,
489
- },
490
- 'withdraw': {
491
- 'min': undefined,
492
- 'max': undefined,
493
- },
465
+ return this.parseCurrencies(tokens);
466
+ }
467
+ parseCurrency(rawCurrency) {
468
+ // const id = i;
469
+ const id = this.safeString(rawCurrency, 'index');
470
+ const name = this.safeString(rawCurrency, 'name');
471
+ const code = this.safeCurrencyCode(name);
472
+ this.options['cachedCurrenciesById'][id] = name;
473
+ const result = this.safeCurrencyStructure({
474
+ 'id': id,
475
+ 'name': name,
476
+ 'code': code,
477
+ 'precision': this.parsePrecision(this.safeString(rawCurrency, 'weiDecimals')),
478
+ 'info': rawCurrency,
479
+ 'active': undefined,
480
+ 'deposit': undefined,
481
+ 'withdraw': undefined,
482
+ 'networks': undefined,
483
+ 'fee': undefined,
484
+ 'type': 'crypto',
485
+ 'limits': {
486
+ 'amount': {
487
+ 'min': undefined,
488
+ 'max': undefined,
494
489
  },
495
- });
496
- // add in wrapped map
497
- const fullName = this.safeString(data, 'fullName');
498
- if (fullName !== undefined && name !== undefined) {
499
- const isWrapped = fullName.startsWith('Unit ') && name.startsWith('U');
500
- if (isWrapped) {
501
- const parts = name.split('U');
502
- let nameWithoutU = '';
503
- for (let j = 0; j < parts.length; j++) {
504
- nameWithoutU = nameWithoutU + parts[j];
505
- }
506
- const baseCode = this.safeCurrencyCode(nameWithoutU);
507
- this.options['spotCurrencyMapping'][code] = baseCode;
490
+ 'withdraw': {
491
+ 'min': undefined,
492
+ 'max': undefined,
493
+ },
494
+ },
495
+ });
496
+ // add in wrapped map
497
+ const fullName = this.safeString(rawCurrency, 'fullName');
498
+ if (fullName !== undefined && name !== undefined) {
499
+ const isWrapped = fullName.startsWith('Unit ') && name.startsWith('U');
500
+ if (isWrapped) {
501
+ const parts = name.split('U');
502
+ let nameWithoutU = '';
503
+ for (let j = 0; j < parts.length; j++) {
504
+ nameWithoutU = nameWithoutU + parts[j];
508
505
  }
506
+ const baseCode = this.safeCurrencyCode(nameWithoutU);
507
+ this.options['spotCurrencyMapping'][code] = baseCode;
509
508
  }
510
509
  }
511
510
  return result;
@@ -1384,11 +1384,11 @@ class indodax extends indodax$1["default"] {
1384
1384
  network = [];
1385
1385
  const networkIds = networkId.split(',');
1386
1386
  for (let j = 0; j < networkIds.length; j++) {
1387
- network.push(this.networkIdToCode(networkIds[j]).toUpperCase());
1387
+ network.push(this.networkIdToCode(networkIds[j], code).toUpperCase());
1388
1388
  }
1389
1389
  }
1390
1390
  else {
1391
- network = this.networkIdToCode(networkId).toUpperCase();
1391
+ network = this.networkIdToCode(networkId, code).toUpperCase();
1392
1392
  }
1393
1393
  }
1394
1394
  const finalNetwork = network; // java req
@@ -838,66 +838,65 @@ class kraken extends kraken$1["default"] {
838
838
  // },
839
839
  // }
840
840
  //
841
- const currencies = this.safeValue(response, 'result', {});
842
- const ids = Object.keys(currencies);
843
- const result = {};
844
- for (let i = 0; i < ids.length; i++) {
845
- const id = ids[i];
846
- const currency = currencies[id];
847
- // todo: will need to rethink the fees
848
- // see: https://support.kraken.com/hc/en-us/articles/201893608-What-are-the-withdrawal-fees-
849
- // to add support for multiple withdrawal/deposit methods and
850
- // differentiated fees for each particular method
851
- //
852
- // Notes about abbreviations:
853
- // Z and X prefixes: https://support.kraken.com/hc/en-us/articles/360001206766-Bitcoin-currency-code-XBT-vs-BTC
854
- // S and M suffixes: https://support.kraken.com/hc/en-us/articles/360039879471-What-is-Asset-S-and-Asset-M-
841
+ const currencies = this.safeDict(response, 'result', {});
842
+ const enhancedArray = this.addKeyInArrayItems(currencies, '_coin_id');
843
+ return this.parseCurrencies(enhancedArray);
844
+ }
845
+ parseCurrency(rawCurrency) {
846
+ // todo: will need to rethink the fees
847
+ // see: https://support.kraken.com/hc/en-us/articles/201893608-What-are-the-withdrawal-fees-
848
+ // to add support for multiple withdrawal/deposit methods and
849
+ // differentiated fees for each particular method
850
+ //
851
+ // Notes about abbreviations:
852
+ // Z and X prefixes: https://support.kraken.com/hc/en-us/articles/360001206766-Bitcoin-currency-code-XBT-vs-BTC
853
+ // S and M suffixes: https://support.kraken.com/hc/en-us/articles/360039879471-What-is-Asset-S-and-Asset-M-
854
+ //
855
+ const id = this.safeString(rawCurrency, '_coin_id');
856
+ let code = this.safeCurrencyCode(id);
857
+ // the below cannot be reliably done in `safeCurrencyCode`, so we have to do it here
858
+ if (id.indexOf('.') < 0) {
859
+ const altName = this.safeString(rawCurrency, 'altname');
860
+ // handle cases like below:
855
861
  //
856
- let code = this.safeCurrencyCode(id);
857
- // the below can not be reliable done in `safeCurrencyCode`, so we have to do it here
858
- if (id.indexOf('.') < 0) {
859
- const altName = this.safeString(currency, 'altname');
860
- // handle cases like below:
861
- //
862
- // id | altname
863
- // ---------------
864
- // XXBT | XBT
865
- // ZUSD | USD
866
- if (id !== altName && (id.startsWith('X') || id.startsWith('Z'))) {
867
- code = this.safeCurrencyCode(altName);
868
- // also, add map in commonCurrencies:
869
- this.commonCurrencies[id] = code;
870
- }
871
- else {
872
- code = this.safeCurrencyCode(id);
873
- }
862
+ // id | altname
863
+ // ---------------
864
+ // XXBT | XBT
865
+ // ZUSD | USD
866
+ if (id !== altName && (id.startsWith('X') || id.startsWith('Z'))) {
867
+ code = this.safeCurrencyCode(altName);
868
+ // also, add map in commonCurrencies:
869
+ this.commonCurrencies[id] = code;
870
+ }
871
+ else {
872
+ code = this.safeCurrencyCode(id);
874
873
  }
875
- const isFiat = code.indexOf('.HOLD') >= 0;
876
- result[code] = this.safeCurrencyStructure({
877
- 'id': id,
878
- 'code': code,
879
- 'info': currency,
880
- 'name': this.safeString(currency, 'altname'),
881
- 'active': this.safeString(currency, 'status') === 'enabled',
882
- 'type': isFiat ? 'fiat' : 'crypto',
883
- 'deposit': undefined,
884
- 'withdraw': undefined,
885
- 'fee': undefined,
886
- 'precision': this.parseNumber(this.parsePrecision(this.safeString(currency, 'decimals'))),
887
- 'limits': {
888
- 'amount': {
889
- 'min': undefined,
890
- 'max': undefined,
891
- },
892
- 'withdraw': {
893
- 'min': undefined,
894
- 'max': undefined,
895
- },
896
- },
897
- 'networks': {},
898
- });
899
874
  }
900
- return result;
875
+ const isFiat = code.indexOf('.HOLD') >= 0;
876
+ rawCurrency = this.omit(rawCurrency, '_coin_id');
877
+ return this.safeCurrencyStructure({
878
+ 'id': id,
879
+ 'code': code,
880
+ 'info': rawCurrency,
881
+ 'name': this.safeString(rawCurrency, 'altname'),
882
+ 'active': this.safeString(rawCurrency, 'status') === 'enabled',
883
+ 'type': isFiat ? 'fiat' : 'crypto',
884
+ 'deposit': undefined,
885
+ 'withdraw': undefined,
886
+ 'fee': undefined,
887
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(rawCurrency, 'decimals'))),
888
+ 'limits': {
889
+ 'amount': {
890
+ 'min': undefined,
891
+ 'max': undefined,
892
+ },
893
+ 'withdraw': {
894
+ 'min': undefined,
895
+ 'max': undefined,
896
+ },
897
+ },
898
+ 'networks': {},
899
+ });
901
900
  }
902
901
  safeCurrencyCode(currencyId, currency = undefined) {
903
902
  if (currencyId === undefined) {
@@ -975,7 +974,7 @@ class kraken extends kraken$1["default"] {
975
974
  'tierBased': true,
976
975
  };
977
976
  }
978
- parseBidAsk(bidask, priceKey = 0, amountKey = 1, countOrIdKey = 2) {
977
+ parseOrderBookBidAsk(bidask, priceKey = 0, amountKey = 1, countOrIdKey = 2) {
979
978
  const price = this.safeNumber(bidask, priceKey);
980
979
  const amount = this.safeNumber(bidask, amountKey);
981
980
  const timestamp = this.safeInteger(bidask, 2);
@@ -3614,7 +3614,7 @@ class kucoin extends kucoin$1["default"] {
3614
3614
  let networkCode = undefined;
3615
3615
  [networkCode, params] = this.handleNetworkCodeAndParams(params);
3616
3616
  if (networkCode !== undefined) {
3617
- request['chain'] = this.networkCodeToId(networkCode).toLowerCase();
3617
+ request['chain'] = this.networkCodeToId(networkCode, code).toLowerCase();
3618
3618
  }
3619
3619
  //
3620
3620
  // {
@@ -4292,6 +4292,7 @@ class kucoin extends kucoin$1["default"] {
4292
4292
  */
4293
4293
  async createUtaOrder(symbol, type, side, amount, price = undefined, params = {}) {
4294
4294
  await this.loadMarkets();
4295
+ const market = this.market(symbol);
4295
4296
  const request = this.createUtaOrderRequest(symbol, type, side, amount, price, params);
4296
4297
  const response = await this.utaPrivatePostAccountModeOrderPlace(request);
4297
4298
  //
@@ -4306,7 +4307,7 @@ class kucoin extends kucoin$1["default"] {
4306
4307
  // }
4307
4308
  //
4308
4309
  const data = this.safeDict(response, 'data', {});
4309
- return this.parseOrder(data);
4310
+ return this.parseOrder(data, market);
4310
4311
  }
4311
4312
  createUtaOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
4312
4313
  const market = this.market(symbol);