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
@@ -367,83 +367,79 @@ class foxbit extends foxbit$1["default"] {
367
367
  // ]
368
368
  // }
369
369
  const data = this.safeList(response, 'data', []);
370
- const result = {};
371
- for (let i = 0; i < data.length; i++) {
372
- const currency = data[i];
373
- const precision = this.safeInteger(currency, 'precision');
374
- const currencyId = this.safeString(currency, 'symbol');
375
- const name = this.safeString(currency, 'name');
376
- const code = this.safeCurrencyCode(currencyId);
377
- const depositInfo = this.safeDict(currency, 'deposit_info');
378
- const withdrawInfo = this.safeDict(currency, 'withdraw_info');
379
- const networks = this.safeList(currency, 'networks', []);
380
- const type = this.safeStringLower(currency, 'type');
381
- const parsedNetworks = {};
382
- for (let j = 0; j < networks.length; j++) {
383
- const network = networks[j];
384
- const networkId = this.safeString(network, 'code');
385
- const networkCode = this.networkIdToCode(networkId, code);
386
- const networkWithdrawInfo = this.safeDict(network, 'withdraw_info');
387
- const networkDepositInfo = this.safeDict(network, 'deposit_info');
388
- const isWithdrawEnabled = this.safeString(networkWithdrawInfo, 'status') === 'ENABLED';
389
- const isDepositEnabled = this.safeString(networkDepositInfo, 'status') === 'ENABLED';
390
- parsedNetworks[networkCode] = {
391
- 'info': currency,
392
- 'id': networkId,
393
- 'network': networkCode,
394
- 'name': this.safeString(network, 'name'),
395
- 'deposit': isDepositEnabled,
396
- 'withdraw': isWithdrawEnabled,
397
- 'active': true,
398
- 'precision': precision,
399
- 'fee': this.safeNumber(networkWithdrawInfo, 'fee'),
400
- 'limits': {
401
- 'amount': {
402
- 'min': undefined,
403
- 'max': undefined,
404
- },
405
- 'deposit': {
406
- 'min': this.safeNumber(depositInfo, 'min_amount'),
407
- 'max': undefined,
408
- },
409
- 'withdraw': {
410
- 'min': this.safeNumber(withdrawInfo, 'min_amount'),
411
- 'max': undefined,
412
- },
370
+ return this.parseCurrencies(data);
371
+ }
372
+ parseCurrency(rawCurrency) {
373
+ const precision = this.safeInteger(rawCurrency, 'precision');
374
+ const currencyId = this.safeString(rawCurrency, 'symbol');
375
+ const name = this.safeString(rawCurrency, 'name');
376
+ const code = this.safeCurrencyCode(currencyId);
377
+ const depositInfo = this.safeDict(rawCurrency, 'deposit_info');
378
+ const withdrawInfo = this.safeDict(rawCurrency, 'withdraw_info');
379
+ const networks = this.safeList(rawCurrency, 'networks', []);
380
+ const type = this.safeStringLower(rawCurrency, 'type');
381
+ const parsedNetworks = {};
382
+ for (let j = 0; j < networks.length; j++) {
383
+ const network = networks[j];
384
+ const networkId = this.safeString(network, 'code');
385
+ const networkCode = this.networkIdToCode(networkId, code);
386
+ const networkWithdrawInfo = this.safeDict(network, 'withdraw_info');
387
+ const networkDepositInfo = this.safeDict(network, 'deposit_info');
388
+ const isWithdrawEnabled = this.safeString(networkWithdrawInfo, 'status') === 'ENABLED';
389
+ const isDepositEnabled = this.safeString(networkDepositInfo, 'status') === 'ENABLED';
390
+ parsedNetworks[networkCode] = {
391
+ 'info': rawCurrency,
392
+ 'id': networkId,
393
+ 'network': networkCode,
394
+ 'name': this.safeString(network, 'name'),
395
+ 'deposit': isDepositEnabled,
396
+ 'withdraw': isWithdrawEnabled,
397
+ 'active': true,
398
+ 'precision': precision,
399
+ 'fee': this.safeNumber(networkWithdrawInfo, 'fee'),
400
+ 'limits': {
401
+ 'amount': {
402
+ 'min': undefined,
403
+ 'max': undefined,
413
404
  },
414
- };
415
- }
416
- if (this.safeDict(result, code) === undefined) {
417
- result[code] = this.safeCurrencyStructure({
418
- 'id': currencyId,
419
- 'code': code,
420
- 'info': currency,
421
- 'name': name,
422
- 'active': true,
423
- 'type': type,
424
- 'deposit': this.safeBool(depositInfo, 'enabled', false),
425
- 'withdraw': this.safeBool(withdrawInfo, 'enabled', false),
426
- 'fee': this.safeNumber(withdrawInfo, 'fee'),
427
- 'precision': precision,
428
- 'limits': {
429
- 'amount': {
430
- 'min': undefined,
431
- 'max': undefined,
432
- },
433
- 'deposit': {
434
- 'min': this.safeNumber(depositInfo, 'min_amount'),
435
- 'max': undefined,
436
- },
437
- 'withdraw': {
438
- 'min': this.safeNumber(withdrawInfo, 'min_amount'),
439
- 'max': undefined,
440
- },
405
+ 'deposit': {
406
+ 'min': this.safeNumber(depositInfo, 'min_amount'),
407
+ 'max': undefined,
441
408
  },
442
- 'networks': parsedNetworks,
443
- });
444
- }
409
+ 'withdraw': {
410
+ 'min': this.safeNumber(withdrawInfo, 'min_amount'),
411
+ 'max': undefined,
412
+ },
413
+ },
414
+ };
445
415
  }
446
- return result;
416
+ return this.safeCurrencyStructure({
417
+ 'id': currencyId,
418
+ 'code': code,
419
+ 'info': rawCurrency,
420
+ 'name': name,
421
+ 'active': true,
422
+ 'type': type,
423
+ 'deposit': this.safeBool(depositInfo, 'enabled', false),
424
+ 'withdraw': this.safeBool(withdrawInfo, 'enabled', false),
425
+ 'fee': this.safeNumber(withdrawInfo, 'fee'),
426
+ 'precision': precision,
427
+ 'limits': {
428
+ 'amount': {
429
+ 'min': undefined,
430
+ 'max': undefined,
431
+ },
432
+ 'deposit': {
433
+ 'min': this.safeNumber(depositInfo, 'min_amount'),
434
+ 'max': undefined,
435
+ },
436
+ 'withdraw': {
437
+ 'min': this.safeNumber(withdrawInfo, 'min_amount'),
438
+ 'max': undefined,
439
+ },
440
+ },
441
+ 'networks': parsedNetworks,
442
+ });
447
443
  }
448
444
  /**
449
445
  * @method
@@ -1538,7 +1534,7 @@ class foxbit extends foxbit$1["default"] {
1538
1534
  let networkCode = undefined;
1539
1535
  [networkCode, params] = this.handleNetworkCodeAndParams(params);
1540
1536
  if (networkCode !== undefined) {
1541
- request['network_code'] = this.networkCodeToId(networkCode);
1537
+ request['network_code'] = this.networkCodeToId(networkCode, code);
1542
1538
  }
1543
1539
  const response = await this.v3PrivatePostWithdrawals(this.extend(request, params));
1544
1540
  // {
@@ -1992,56 +1992,53 @@ class gate extends gate$1["default"] {
1992
1992
  // },
1993
1993
  // ]
1994
1994
  //
1995
- const indexedCurrencies = this.indexBy(response, 'currency');
1996
- const result = {};
1997
- for (let i = 0; i < response.length; i++) {
1998
- const entry = response[i];
1999
- const currencyId = this.safeString(entry, 'currency');
2000
- const code = this.safeCurrencyCode(currencyId);
2001
- // check leveraged tokens (e.g. BTC3S, ETH5L)
2002
- const type = this.isLeveragedCurrency(currencyId, true, indexedCurrencies) ? 'leveraged' : 'crypto';
2003
- const chains = this.safeList(entry, 'chains', []);
2004
- const networks = {};
2005
- for (let j = 0; j < chains.length; j++) {
2006
- const chain = chains[j];
2007
- const networkId = this.safeString(chain, 'name');
2008
- const networkCode = this.networkIdToCode(networkId);
2009
- networks[networkCode] = {
2010
- 'info': chain,
2011
- 'id': networkId,
2012
- 'network': networkCode,
2013
- 'active': undefined,
2014
- 'deposit': !this.safeBool(chain, 'deposit_disabled'),
2015
- 'withdraw': !this.safeBool(chain, 'withdraw_disabled'),
2016
- 'fee': undefined,
2017
- 'precision': this.parseNumber('0.0001'),
2018
- 'limits': {
2019
- 'deposit': {
2020
- 'min': undefined,
2021
- 'max': undefined,
2022
- },
2023
- 'withdraw': {
2024
- 'min': undefined,
2025
- 'max': undefined,
2026
- },
2027
- },
2028
- };
2029
- }
2030
- result[code] = this.safeCurrencyStructure({
2031
- 'id': currencyId,
2032
- 'code': code,
2033
- 'name': this.safeString(entry, 'name'),
2034
- 'type': type,
2035
- 'active': !this.safeBool(entry, 'delisted'),
2036
- 'deposit': !this.safeBool(entry, 'deposit_disabled'),
2037
- 'withdraw': !this.safeBool(entry, 'withdraw_disabled'),
1995
+ return this.parseCurrencies(response);
1996
+ }
1997
+ parseCurrency(rawCurrency) {
1998
+ const currencyId = this.safeString(rawCurrency, 'currency');
1999
+ const code = this.safeCurrencyCode(currencyId);
2000
+ // check leveraged tokens (e.g. BTC3S, ETH5L)
2001
+ const type = this.isLeveragedCurrency(currencyId) ? 'leveraged' : 'crypto';
2002
+ const chains = this.safeList(rawCurrency, 'chains', []);
2003
+ const networks = {};
2004
+ for (let j = 0; j < chains.length; j++) {
2005
+ const chain = chains[j];
2006
+ const networkId = this.safeString(chain, 'name');
2007
+ const networkCode = this.networkIdToCode(networkId, code);
2008
+ networks[networkCode] = {
2009
+ 'info': chain,
2010
+ 'id': networkId,
2011
+ 'network': networkCode,
2012
+ 'active': undefined,
2013
+ 'deposit': !this.safeBool(chain, 'deposit_disabled'),
2014
+ 'withdraw': !this.safeBool(chain, 'withdraw_disabled'),
2038
2015
  'fee': undefined,
2039
- 'networks': networks,
2040
2016
  'precision': this.parseNumber('0.0001'),
2041
- 'info': entry,
2042
- });
2017
+ 'limits': {
2018
+ 'deposit': {
2019
+ 'min': undefined,
2020
+ 'max': undefined,
2021
+ },
2022
+ 'withdraw': {
2023
+ 'min': undefined,
2024
+ 'max': undefined,
2025
+ },
2026
+ },
2027
+ };
2043
2028
  }
2044
- return result;
2029
+ return this.safeCurrencyStructure({
2030
+ 'id': currencyId,
2031
+ 'code': code,
2032
+ 'name': this.safeString(rawCurrency, 'name'),
2033
+ 'type': type,
2034
+ 'active': !this.safeBool(rawCurrency, 'delisted'),
2035
+ 'deposit': !this.safeBool(rawCurrency, 'deposit_disabled'),
2036
+ 'withdraw': !this.safeBool(rawCurrency, 'withdraw_disabled'),
2037
+ 'fee': undefined,
2038
+ 'networks': networks,
2039
+ 'precision': this.parseNumber('0.0001'),
2040
+ 'info': rawCurrency,
2041
+ });
2045
2042
  }
2046
2043
  /**
2047
2044
  * @method
@@ -2345,12 +2342,13 @@ class gate extends gate$1["default"] {
2345
2342
  //
2346
2343
  const address = this.safeString(depositAddress, 'address');
2347
2344
  this.checkAddress(address);
2345
+ const code = this.safeString(currency, 'code');
2348
2346
  return {
2349
2347
  'info': depositAddress,
2350
- 'currency': this.safeString(currency, 'code'),
2348
+ 'currency': code,
2351
2349
  'address': address,
2352
2350
  'tag': this.safeString(depositAddress, 'payment_id'),
2353
- 'network': this.networkIdToCode(this.safeString(depositAddress, 'chain')),
2351
+ 'network': this.networkIdToCode(this.safeString(depositAddress, 'chain'), code),
2354
2352
  };
2355
2353
  }
2356
2354
  /**
@@ -2499,7 +2497,7 @@ class gate extends gate$1["default"] {
2499
2497
  const networkIds = Object.keys(withdrawFixOnChains);
2500
2498
  for (let j = 0; j < networkIds.length; j++) {
2501
2499
  const networkId = networkIds[j];
2502
- const networkCode = this.networkIdToCode(networkId);
2500
+ const networkCode = this.networkIdToCode(networkId, code);
2503
2501
  withdrawFees[networkCode] = this.parseNumber(withdrawFixOnChains[networkId]);
2504
2502
  }
2505
2503
  }
@@ -2579,7 +2577,9 @@ class gate extends gate$1["default"] {
2579
2577
  const chainKeys = Object.keys(withdrawFixOnChains);
2580
2578
  for (let i = 0; i < chainKeys.length; i++) {
2581
2579
  const chainKey = chainKeys[i];
2582
- const networkCode = this.networkIdToCode(chainKey, this.safeString(fee, 'currency'));
2580
+ const currencyId = this.safeString(fee, 'currency');
2581
+ const code = this.safeCurrencyCode(currencyId, currency);
2582
+ const networkCode = this.networkIdToCode(chainKey, code);
2583
2583
  result['networks'][networkCode] = {
2584
2584
  'withdraw': {
2585
2585
  'fee': this.parseNumber(withdrawFixOnChains[chainKey]),
@@ -4100,7 +4100,7 @@ class gate extends gate$1["default"] {
4100
4100
  let networkCode = undefined;
4101
4101
  [networkCode, params] = this.handleNetworkCodeAndParams(params);
4102
4102
  if (networkCode !== undefined) {
4103
- request['chain'] = this.networkCodeToId(networkCode);
4103
+ request['chain'] = this.networkCodeToId(networkCode, code);
4104
4104
  }
4105
4105
  const response = await this.privateWithdrawalsPostWithdrawals(this.extend(request, params));
4106
4106
  //
@@ -4232,7 +4232,7 @@ class gate extends gate$1["default"] {
4232
4232
  'txid': txid,
4233
4233
  'currency': code,
4234
4234
  'amount': this.parseNumber(amountString),
4235
- 'network': this.networkIdToCode(networkId),
4235
+ 'network': this.networkIdToCode(networkId, code),
4236
4236
  'address': address,
4237
4237
  'addressTo': undefined,
4238
4238
  'addressFrom': undefined,
@@ -440,51 +440,28 @@ class gemini extends gemini$1["default"] {
440
440
  // ]
441
441
  // }
442
442
  //
443
- const result = {};
444
443
  this.options['tradingPairs'] = this.safeList(data, 'tradingPairs');
445
444
  const currenciesArray = this.safeValue(data, 'currencies', []);
446
- for (let i = 0; i < currenciesArray.length; i++) {
447
- const currency = currenciesArray[i];
448
- const id = this.safeString(currency, 0);
449
- const code = this.safeCurrencyCode(id);
450
- const type = this.safeString(currency, 7) ? 'fiat' : 'crypto';
451
- const precision = this.parseNumber(this.parsePrecision(this.safeString(currency, 5)));
452
- const networks = {};
453
- const networkId = this.safeString(currency, 9);
454
- let networkCode = undefined;
455
- if (networkId !== undefined) {
456
- networkCode = this.networkIdToCode(networkId);
457
- networks[networkCode] = {
458
- 'info': currency,
459
- 'id': networkId,
460
- 'network': networkCode,
461
- 'active': undefined,
462
- 'deposit': undefined,
463
- 'withdraw': undefined,
464
- 'fee': undefined,
465
- 'precision': precision,
466
- 'limits': {
467
- 'deposit': {
468
- 'min': undefined,
469
- 'max': undefined,
470
- },
471
- 'withdraw': {
472
- 'min': undefined,
473
- 'max': undefined,
474
- },
475
- },
476
- };
477
- }
478
- result[code] = this.safeCurrencyStructure({
479
- 'info': currency,
480
- 'id': id,
481
- 'code': code,
482
- 'name': this.safeString(currency, 1),
445
+ return this.parseCurrencies(currenciesArray);
446
+ }
447
+ parseCurrency(rawCurrency) {
448
+ const id = this.safeString(rawCurrency, 0);
449
+ const code = this.safeCurrencyCode(id);
450
+ const type = this.safeString(rawCurrency, 7) ? 'fiat' : 'crypto';
451
+ const precision = this.parseNumber(this.parsePrecision(this.safeString(rawCurrency, 5)));
452
+ const networks = {};
453
+ const networkId = this.safeString(rawCurrency, 9);
454
+ let networkCode = undefined;
455
+ if (networkId !== undefined) {
456
+ networkCode = this.networkIdToCode(networkId, code);
457
+ networks[networkCode] = {
458
+ 'info': rawCurrency,
459
+ 'id': networkId,
460
+ 'network': networkCode,
483
461
  'active': undefined,
484
462
  'deposit': undefined,
485
463
  'withdraw': undefined,
486
464
  'fee': undefined,
487
- 'type': type,
488
465
  'precision': precision,
489
466
  'limits': {
490
467
  'deposit': {
@@ -496,10 +473,31 @@ class gemini extends gemini$1["default"] {
496
473
  'max': undefined,
497
474
  },
498
475
  },
499
- 'networks': networks,
500
- });
476
+ };
501
477
  }
502
- return result;
478
+ return this.safeCurrencyStructure({
479
+ 'info': rawCurrency,
480
+ 'id': id,
481
+ 'code': code,
482
+ 'name': this.safeString(rawCurrency, 1),
483
+ 'active': undefined,
484
+ 'deposit': undefined,
485
+ 'withdraw': undefined,
486
+ 'fee': undefined,
487
+ 'type': type,
488
+ 'precision': precision,
489
+ 'limits': {
490
+ 'deposit': {
491
+ 'min': undefined,
492
+ 'max': undefined,
493
+ },
494
+ 'withdraw': {
495
+ 'min': undefined,
496
+ 'max': undefined,
497
+ },
498
+ },
499
+ 'networks': networks,
500
+ });
503
501
  }
504
502
  /**
505
503
  * @method
@@ -1912,7 +1910,7 @@ class gemini extends gemini$1["default"] {
1912
1910
  if (networkCode === undefined) {
1913
1911
  throw new errors.ArgumentsRequired(this.id + ' fetchDepositAddresses() requires a network parameter');
1914
1912
  }
1915
- const networkId = this.networkCodeToId(networkCode);
1913
+ const networkId = this.networkCodeToId(networkCode, currency['code']);
1916
1914
  const request = {
1917
1915
  'network': networkId,
1918
1916
  };
@@ -1593,13 +1593,15 @@ class grvt extends grvt$1["default"] {
1593
1593
  let networkCode = undefined;
1594
1594
  let addressFrom = this.safeString(transaction, 'from_account_id');
1595
1595
  let addressTo = this.safeString(transaction, 'to_account_id');
1596
+ const currencyId = this.safeString(transaction, 'currency');
1597
+ const code = this.safeCurrencyCode(currencyId, currency);
1596
1598
  if ('transfer_metadata' in transaction) {
1597
1599
  const metaData = this.omitZero(this.safeString(transaction, 'transfer_metadata'));
1598
1600
  if (metaData !== undefined) {
1599
1601
  const parsedMeta = this.parseJson(metaData);
1600
1602
  direction = this.safeStringLower(parsedMeta, 'direction');
1601
1603
  txId = this.safeString(parsedMeta, 'provider_tx_id');
1602
- networkCode = this.networkIdToCode(this.safeString(parsedMeta, 'chainid'));
1604
+ networkCode = this.networkIdToCode(this.safeString(parsedMeta, 'chainid'), code);
1603
1605
  if (direction === 'withdrawal') {
1604
1606
  addressTo = this.safeString(parsedMeta, 'endpoint');
1605
1607
  }
@@ -1609,8 +1611,6 @@ class grvt extends grvt$1["default"] {
1609
1611
  }
1610
1612
  }
1611
1613
  const timestamp = this.safeIntegerProduct2(transaction, 'event_time', 'initiated_time', 0.000001);
1612
- const currencyId = this.safeString(transaction, 'currency');
1613
- const code = this.safeCurrencyCode(currencyId, currency);
1614
1614
  return {
1615
1615
  'info': transaction,
1616
1616
  'id': undefined,
@@ -1912,7 +1912,7 @@ class grvt extends grvt$1["default"] {
1912
1912
  'signature': this.defaultSignature(),
1913
1913
  };
1914
1914
  const [networkCode, query] = this.handleNetworkCodeAndParams(params);
1915
- const networkId = this.networkCodeToId(networkCode);
1915
+ const networkId = this.networkCodeToId(networkCode, code);
1916
1916
  if (networkId === undefined) {
1917
1917
  throw new errors.BadRequest(this.id + ' withdraw() requires a network parameter');
1918
1918
  }
@@ -1170,65 +1170,63 @@ class hashkey extends hashkey$1["default"] {
1170
1170
  // ]
1171
1171
  // }
1172
1172
  //
1173
- const result = {};
1174
- for (let i = 0; i < coins.length; i++) {
1175
- const currecy = coins[i];
1176
- const currencyId = this.safeString(currecy, 'coinId');
1177
- const code = this.safeCurrencyCode(currencyId);
1178
- const networks = this.safeList(currecy, 'chainTypes');
1179
- const parsedNetworks = {};
1180
- for (let j = 0; j < networks.length; j++) {
1181
- const network = networks[j];
1182
- const networkId = this.safeString(network, 'chainType');
1183
- const networkCode = this.networkCodeToId(networkId);
1184
- parsedNetworks[networkCode] = {
1185
- 'id': networkId,
1186
- 'network': networkCode,
1187
- 'limits': {
1188
- 'withdraw': {
1189
- 'min': this.safeNumber(network, 'minWithdrawQuantity'),
1190
- 'max': this.parseNumber(this.omitZero(this.safeString(network, 'maxWithdrawQuantity'))),
1191
- },
1192
- 'deposit': {
1193
- 'min': this.safeNumber(network, 'minDepositQuantity'),
1194
- 'max': undefined,
1195
- },
1196
- },
1197
- 'active': undefined,
1198
- 'deposit': this.safeBool(network, 'allowDeposit'),
1199
- 'withdraw': this.safeBool(network, 'allowWithdraw'),
1200
- 'fee': this.safeNumber(network, 'withdrawFee'),
1201
- 'precision': undefined,
1202
- 'info': network,
1203
- };
1204
- }
1205
- const rawType = this.safeString(currecy, 'tokenType');
1206
- const type = (rawType === 'REAL_MONEY') ? 'fiat' : 'crypto';
1207
- result[code] = this.safeCurrencyStructure({
1208
- 'id': currencyId,
1209
- 'code': code,
1210
- 'precision': undefined,
1211
- 'type': type,
1212
- 'name': this.safeString(currecy, 'coinFullName'),
1213
- 'active': undefined,
1214
- 'deposit': this.safeBool(currecy, 'allowDeposit'),
1215
- 'withdraw': this.safeBool(currecy, 'allowWithdraw'),
1216
- 'fee': undefined,
1173
+ return this.parseCurrencies(coins);
1174
+ }
1175
+ parseCurrency(rawCurrency) {
1176
+ const currencyId = this.safeString(rawCurrency, 'coinId');
1177
+ const code = this.safeCurrencyCode(currencyId);
1178
+ const networks = this.safeList(rawCurrency, 'chainTypes');
1179
+ const parsedNetworks = {};
1180
+ for (let j = 0; j < networks.length; j++) {
1181
+ const network = networks[j];
1182
+ const networkId = this.safeString(network, 'chainType');
1183
+ const networkCode = this.networkCodeToId(networkId, code);
1184
+ parsedNetworks[networkCode] = {
1185
+ 'id': networkId,
1186
+ 'network': networkCode,
1217
1187
  'limits': {
1218
- 'deposit': {
1219
- 'min': undefined,
1220
- 'max': undefined,
1221
- },
1222
1188
  'withdraw': {
1223
- 'min': undefined,
1189
+ 'min': this.safeNumber(network, 'minWithdrawQuantity'),
1190
+ 'max': this.parseNumber(this.omitZero(this.safeString(network, 'maxWithdrawQuantity'))),
1191
+ },
1192
+ 'deposit': {
1193
+ 'min': this.safeNumber(network, 'minDepositQuantity'),
1224
1194
  'max': undefined,
1225
1195
  },
1226
1196
  },
1227
- 'networks': parsedNetworks,
1228
- 'info': currecy,
1229
- });
1197
+ 'active': undefined,
1198
+ 'deposit': this.safeBool(network, 'allowDeposit'),
1199
+ 'withdraw': this.safeBool(network, 'allowWithdraw'),
1200
+ 'fee': this.safeNumber(network, 'withdrawFee'),
1201
+ 'precision': undefined,
1202
+ 'info': network,
1203
+ };
1230
1204
  }
1231
- return result;
1205
+ const rawType = this.safeString(rawCurrency, 'tokenType');
1206
+ const type = (rawType === 'REAL_MONEY') ? 'fiat' : 'crypto';
1207
+ return this.safeCurrencyStructure({
1208
+ 'id': currencyId,
1209
+ 'code': code,
1210
+ 'precision': undefined,
1211
+ 'type': type,
1212
+ 'name': this.safeString(rawCurrency, 'coinFullName'),
1213
+ 'active': undefined,
1214
+ 'deposit': this.safeBool(rawCurrency, 'allowDeposit'),
1215
+ 'withdraw': this.safeBool(rawCurrency, 'allowWithdraw'),
1216
+ 'fee': undefined,
1217
+ 'limits': {
1218
+ 'deposit': {
1219
+ 'min': undefined,
1220
+ 'max': undefined,
1221
+ },
1222
+ 'withdraw': {
1223
+ 'min': undefined,
1224
+ 'max': undefined,
1225
+ },
1226
+ },
1227
+ 'networks': parsedNetworks,
1228
+ 'info': rawCurrency,
1229
+ });
1232
1230
  }
1233
1231
  /**
1234
1232
  * @method
@@ -2054,7 +2052,7 @@ class hashkey extends hashkey$1["default"] {
2054
2052
  let networkCode = undefined;
2055
2053
  [networkCode, params] = this.handleNetworkCodeAndParams(params);
2056
2054
  if (networkCode !== undefined) {
2057
- request['chainType'] = this.networkCodeToId(networkCode);
2055
+ request['chainType'] = this.networkCodeToId(networkCode, currency['code']);
2058
2056
  }
2059
2057
  const response = await this.privatePostApiV1AccountWithdraw(this.extend(request, params));
2060
2058
  //
@@ -973,7 +973,7 @@ class hitbtc extends hitbtc$1["default"] {
973
973
  for (let j = 0; j < rawNetworks.length; j++) {
974
974
  const rawNetwork = rawNetworks[j];
975
975
  const networkId = this.safeString2(rawNetwork, 'protocol', 'network');
976
- let networkCode = this.networkIdToCode(networkId);
976
+ let networkCode = this.networkIdToCode(networkId, code);
977
977
  networkCode = (networkCode !== undefined) ? networkCode.toUpperCase() : code; // as hitbtc is white label, ensure we safeguard from possible bugs
978
978
  networks[networkCode] = {
979
979
  'info': rawNetwork,
@@ -1012,17 +1012,6 @@ class hitbtc extends hitbtc$1["default"] {
1012
1012
  'type': undefined, // 'crypto' field emits incorrect values
1013
1013
  });
1014
1014
  }
1015
- addKeyInArrayItems(obj, keyName) {
1016
- const result = [];
1017
- const keys = Object.keys(obj);
1018
- for (let i = 0; i < keys.length; i++) {
1019
- const key = keys[i];
1020
- const item = obj[key];
1021
- item[keyName] = key;
1022
- result.push(item);
1023
- }
1024
- return result;
1025
- }
1026
1015
  /**
1027
1016
  * @method
1028
1017
  * @name hitbtc#createDepositAddress
@@ -3708,7 +3697,8 @@ class hitbtc extends hitbtc$1["default"] {
3708
3697
  for (let j = 0; j < networks.length; j++) {
3709
3698
  const networkEntry = networks[j];
3710
3699
  const networkId = this.safeString(networkEntry, 'network');
3711
- let networkCode = this.networkIdToCode(networkId);
3700
+ const code = this.safeString(currency, 'code');
3701
+ let networkCode = this.networkIdToCode(networkId, code);
3712
3702
  networkCode = (networkCode !== undefined) ? networkCode.toUpperCase() : undefined;
3713
3703
  const withdrawFee = this.safeNumber(networkEntry, 'payout_fee');
3714
3704
  const isDefault = this.safeValue(networkEntry, 'default');