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
package/js/src/hitbtc.js CHANGED
@@ -968,7 +968,7 @@ export default class hitbtc extends Exchange {
968
968
  for (let j = 0; j < rawNetworks.length; j++) {
969
969
  const rawNetwork = rawNetworks[j];
970
970
  const networkId = this.safeString2(rawNetwork, 'protocol', 'network');
971
- let networkCode = this.networkIdToCode(networkId);
971
+ let networkCode = this.networkIdToCode(networkId, code);
972
972
  networkCode = (networkCode !== undefined) ? networkCode.toUpperCase() : code; // as hitbtc is white label, ensure we safeguard from possible bugs
973
973
  networks[networkCode] = {
974
974
  'info': rawNetwork,
@@ -1007,17 +1007,6 @@ export default class hitbtc extends Exchange {
1007
1007
  'type': undefined, // 'crypto' field emits incorrect values
1008
1008
  });
1009
1009
  }
1010
- addKeyInArrayItems(obj, keyName) {
1011
- const result = [];
1012
- const keys = Object.keys(obj);
1013
- for (let i = 0; i < keys.length; i++) {
1014
- const key = keys[i];
1015
- const item = obj[key];
1016
- item[keyName] = key;
1017
- result.push(item);
1018
- }
1019
- return result;
1020
- }
1021
1010
  /**
1022
1011
  * @method
1023
1012
  * @name hitbtc#createDepositAddress
@@ -3703,7 +3692,8 @@ export default class hitbtc extends Exchange {
3703
3692
  for (let j = 0; j < networks.length; j++) {
3704
3693
  const networkEntry = networks[j];
3705
3694
  const networkId = this.safeString(networkEntry, 'network');
3706
- let networkCode = this.networkIdToCode(networkId);
3695
+ const code = this.safeString(currency, 'code');
3696
+ let networkCode = this.networkIdToCode(networkId, code);
3707
3697
  networkCode = (networkCode !== undefined) ? networkCode.toUpperCase() : undefined;
3708
3698
  const withdrawFee = this.safeNumber(networkEntry, 'payout_fee');
3709
3699
  const isDefault = this.safeValue(networkEntry, 'default');
@@ -24,6 +24,7 @@ export default class hollaex extends Exchange {
24
24
  * @returns {object} an associative dictionary of currencies
25
25
  */
26
26
  fetchCurrencies(params?: {}): Promise<Currencies>;
27
+ parseCurrency(rawCurrency: Dict): Currency;
27
28
  /**
28
29
  * @method
29
30
  * @name hollaex#fetchOrderBooks
package/js/src/hollaex.js CHANGED
@@ -486,66 +486,63 @@ export default class hollaex extends Exchange {
486
486
  // }
487
487
  //
488
488
  const coins = this.safeDict(response, 'coins', {});
489
- const keys = Object.keys(coins);
490
- const result = {};
491
- for (let i = 0; i < keys.length; i++) {
492
- const key = keys[i];
493
- const currency = coins[key];
494
- const id = this.safeString(currency, 'symbol');
495
- const code = this.safeCurrencyCode(id);
496
- const withdrawalLimits = this.safeList(currency, 'withdrawal_limits', []);
497
- const rawType = this.safeString(currency, 'type');
498
- const type = (rawType === 'blockchain') ? 'crypto' : 'other';
499
- const rawNetworks = this.safeDict(currency, 'withdrawal_fees', {});
500
- const networks = {};
501
- const networkIds = Object.keys(rawNetworks);
502
- for (let j = 0; j < networkIds.length; j++) {
503
- const networkId = networkIds[j];
504
- const networkEntry = this.safeDict(rawNetworks, networkId);
505
- const networkCode = this.networkIdToCode(networkId);
506
- networks[networkCode] = {
507
- 'id': networkId,
508
- 'network': networkCode,
509
- 'active': this.safeBool(networkEntry, 'active'),
510
- 'deposit': undefined,
511
- 'withdraw': undefined,
512
- 'fee': this.safeNumber(networkEntry, 'value'),
513
- 'precision': undefined,
514
- 'limits': {
515
- 'withdraw': {
516
- 'min': undefined,
517
- 'max': undefined,
518
- },
519
- },
520
- 'info': networkEntry,
521
- };
522
- }
523
- result[code] = this.safeCurrencyStructure({
524
- 'id': id,
525
- 'numericId': this.safeInteger(currency, 'id'),
526
- 'code': code,
527
- 'info': currency,
528
- 'name': this.safeString(currency, 'fullname'),
529
- 'active': this.safeBool(currency, 'active'),
530
- 'deposit': this.safeBool(currency, 'allow_deposit'),
531
- 'withdraw': this.safeBool(currency, 'allow_withdrawal'),
532
- 'fee': this.safeNumber(currency, 'withdrawal_fee'),
533
- 'precision': this.safeNumber(currency, 'increment_unit'),
489
+ const values = Object.values(coins);
490
+ return this.parseCurrencies(values);
491
+ }
492
+ parseCurrency(rawCurrency) {
493
+ const id = this.safeString(rawCurrency, 'symbol');
494
+ const code = this.safeCurrencyCode(id);
495
+ const withdrawalLimits = this.safeList(rawCurrency, 'withdrawal_limits', []);
496
+ const rawType = this.safeString(rawCurrency, 'type');
497
+ const type = (rawType === 'blockchain') ? 'crypto' : 'other';
498
+ const rawNetworks = this.safeDict(rawCurrency, 'withdrawal_fees', {});
499
+ const networks = {};
500
+ const networkIds = Object.keys(rawNetworks);
501
+ for (let j = 0; j < networkIds.length; j++) {
502
+ const networkId = networkIds[j];
503
+ const networkEntry = this.safeDict(rawNetworks, networkId);
504
+ const networkCode = this.networkIdToCode(networkId, code);
505
+ networks[networkCode] = {
506
+ 'id': networkId,
507
+ 'network': networkCode,
508
+ 'active': this.safeBool(networkEntry, 'active'),
509
+ 'deposit': undefined,
510
+ 'withdraw': undefined,
511
+ 'fee': this.safeNumber(networkEntry, 'value'),
512
+ 'precision': undefined,
534
513
  'limits': {
535
- 'amount': {
536
- 'min': this.safeNumber(currency, 'min'),
537
- 'max': this.safeNumber(currency, 'max'),
538
- },
539
514
  'withdraw': {
540
515
  'min': undefined,
541
- 'max': this.safeValue(withdrawalLimits, 0),
516
+ 'max': undefined,
542
517
  },
543
518
  },
544
- 'networks': networks,
545
- 'type': type,
546
- });
519
+ 'info': networkEntry,
520
+ };
547
521
  }
548
- return result;
522
+ return this.safeCurrencyStructure({
523
+ 'id': id,
524
+ 'numericId': this.safeInteger(rawCurrency, 'id'),
525
+ 'code': code,
526
+ 'info': rawCurrency,
527
+ 'name': this.safeString(rawCurrency, 'fullname'),
528
+ 'active': this.safeBool(rawCurrency, 'active'),
529
+ 'deposit': this.safeBool(rawCurrency, 'allow_deposit'),
530
+ 'withdraw': this.safeBool(rawCurrency, 'allow_withdrawal'),
531
+ 'fee': this.safeNumber(rawCurrency, 'withdrawal_fee'),
532
+ 'precision': this.safeNumber(rawCurrency, 'increment_unit'),
533
+ 'limits': {
534
+ 'amount': {
535
+ 'min': this.safeNumber(rawCurrency, 'min'),
536
+ 'max': this.safeNumber(rawCurrency, 'max'),
537
+ },
538
+ 'withdraw': {
539
+ 'min': undefined,
540
+ 'max': this.safeValue(withdrawalLimits, 0),
541
+ },
542
+ },
543
+ 'networks': networks,
544
+ 'type': type,
545
+ });
549
546
  }
550
547
  /**
551
548
  * @method
package/js/src/htx.d.ts CHANGED
@@ -278,6 +278,7 @@ export default class htx extends Exchange {
278
278
  * @returns {object} an associative dictionary of currencies
279
279
  */
280
280
  fetchCurrencies(params?: {}): Promise<Currencies>;
281
+ parseCurrency(rawCurrency: Dict): Currency;
281
282
  networkIdToCode(networkId?: Str, currencyCode?: Str): string;
282
283
  networkCodeToId(networkCode: string, currencyCode?: Str): any;
283
284
  /**
package/js/src/htx.js CHANGED
@@ -184,7 +184,7 @@ export default class htx extends Exchange {
184
184
  },
185
185
  'www': 'https://www.huobi.com',
186
186
  'referral': {
187
- 'url': 'https://www.htx.com.vc/invite/en-us/1h?invite_code=6rmm2223',
187
+ 'url': 'https://www.htx.com/invite/en-us/1h?invite_code=6rmm2223',
188
188
  'discount': 0.15,
189
189
  },
190
190
  'doc': [
@@ -1189,6 +1189,9 @@ export default class htx extends Exchange {
1189
1189
  // 'BCC': 'BCC', BCH's somewhat chain
1190
1190
  // 'DBC1': 'DBC1',
1191
1191
  },
1192
+ 'networksById': {
1193
+ 'MATIC': 'MATIC',
1194
+ },
1192
1195
  // https://github.com/ccxt/ccxt/issues/5376
1193
1196
  'fetchOrdersByStatesMethod': 'spot_private_get_v1_order_orders',
1194
1197
  'createMarketBuyOrderRequiresPrice': true,
@@ -3475,75 +3478,79 @@ export default class htx extends Exchange {
3475
3478
  // }
3476
3479
  //
3477
3480
  const data = this.safeList(response, 'data', []);
3478
- const result = {};
3479
- this.options['networkChainIdsByNames'] = {};
3480
3481
  this.options['networkNamesByChainIds'] = {};
3481
- for (let i = 0; i < data.length; i++) {
3482
- const entry = data[i];
3483
- const currencyId = this.safeString(entry, 'currency');
3484
- const code = this.safeCurrencyCode(currencyId);
3485
- const assetType = this.safeString(entry, 'assetType');
3486
- const type = assetType === '1' ? 'crypto' : 'fiat';
3487
- this.options['networkChainIdsByNames'][code] = {};
3488
- const chains = this.safeList(entry, 'chains', []);
3489
- const networks = {};
3490
- for (let j = 0; j < chains.length; j++) {
3491
- const chainEntry = chains[j];
3492
- const uniqueChainId = this.safeString(chainEntry, 'chain'); // i.e. usdterc20, trc20usdt ...
3493
- 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
3494
- this.options['networkChainIdsByNames'][code][title] = uniqueChainId;
3495
- this.options['networkNamesByChainIds'][uniqueChainId] = title;
3496
- const networkCode = this.networkIdToCode(uniqueChainId);
3497
- networks[networkCode] = {
3498
- 'info': chainEntry,
3499
- 'id': uniqueChainId,
3500
- 'network': networkCode,
3501
- 'limits': {
3502
- 'deposit': {
3503
- 'min': this.safeNumber(chainEntry, 'minDepositAmt'),
3504
- 'max': undefined,
3505
- },
3506
- 'withdraw': {
3507
- 'min': this.safeNumber(chainEntry, 'minWithdrawAmt'),
3508
- 'max': this.safeNumber(chainEntry, 'maxWithdrawAmt'),
3509
- },
3510
- },
3511
- 'active': undefined,
3512
- 'deposit': this.safeString(chainEntry, 'depositStatus') === 'allowed',
3513
- 'withdraw': this.safeString(chainEntry, 'withdrawStatus') === 'allowed',
3514
- 'fee': this.safeNumber(chainEntry, 'transactFeeWithdraw'),
3515
- 'precision': this.parseNumber(this.parsePrecision(this.safeString(chainEntry, 'withdrawPrecision'))),
3516
- };
3517
- }
3518
- result[code] = this.safeCurrencyStructure({
3519
- 'info': entry,
3520
- 'code': code,
3521
- 'id': currencyId,
3522
- 'active': this.safeString(entry, 'instStatus') === 'normal',
3523
- 'deposit': undefined,
3524
- 'withdraw': undefined,
3525
- 'fee': undefined,
3526
- 'name': undefined,
3527
- 'type': type,
3482
+ this.options['networkChainIdsByNames'] = {};
3483
+ return this.parseCurrencies(data);
3484
+ }
3485
+ parseCurrency(rawCurrency) {
3486
+ if (!('networkNamesByChainIds' in this.options)) {
3487
+ this.options['networkNamesByChainIds'] = {};
3488
+ }
3489
+ if (!('networkChainIdsByNames' in this.options)) {
3490
+ this.options['networkChainIdsByNames'] = {};
3491
+ }
3492
+ const currencyId = this.safeString(rawCurrency, 'currency');
3493
+ const code = this.safeCurrencyCode(currencyId);
3494
+ const assetType = this.safeString(rawCurrency, 'assetType');
3495
+ const type = (assetType === '1') ? 'crypto' : 'fiat';
3496
+ this.options['networkChainIdsByNames'][code] = {};
3497
+ const chains = this.safeList(rawCurrency, 'chains', []);
3498
+ const networks = {};
3499
+ for (let j = 0; j < chains.length; j++) {
3500
+ const chainEntry = chains[j];
3501
+ const uniqueChainId = this.safeString(chainEntry, 'chain'); // i.e. usdterc20, trc20usdt ...
3502
+ 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
3503
+ this.options['networkChainIdsByNames'][code][title] = uniqueChainId;
3504
+ this.options['networkNamesByChainIds'][uniqueChainId] = title;
3505
+ const networkCode = this.networkIdToCode(uniqueChainId, code);
3506
+ networks[networkCode] = {
3507
+ 'info': chainEntry,
3508
+ 'id': uniqueChainId,
3509
+ 'network': networkCode,
3528
3510
  'limits': {
3529
- 'amount': {
3530
- 'min': undefined,
3511
+ 'deposit': {
3512
+ 'min': this.safeNumber(chainEntry, 'minDepositAmt'),
3531
3513
  'max': undefined,
3532
3514
  },
3533
3515
  'withdraw': {
3534
- 'min': undefined,
3535
- 'max': undefined,
3536
- },
3537
- 'deposit': {
3538
- 'min': undefined,
3539
- 'max': undefined,
3516
+ 'min': this.safeNumber(chainEntry, 'minWithdrawAmt'),
3517
+ 'max': this.safeNumber(chainEntry, 'maxWithdrawAmt'),
3540
3518
  },
3541
3519
  },
3542
- 'precision': undefined,
3543
- 'networks': networks,
3544
- });
3520
+ 'active': undefined,
3521
+ 'deposit': this.safeString(chainEntry, 'depositStatus') === 'allowed',
3522
+ 'withdraw': this.safeString(chainEntry, 'withdrawStatus') === 'allowed',
3523
+ 'fee': this.safeNumber(chainEntry, 'transactFeeWithdraw'),
3524
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(chainEntry, 'withdrawPrecision'))),
3525
+ };
3545
3526
  }
3546
- return result;
3527
+ return this.safeCurrencyStructure({
3528
+ 'info': rawCurrency,
3529
+ 'code': code,
3530
+ 'id': currencyId,
3531
+ 'active': this.safeString(rawCurrency, 'instStatus') === 'normal',
3532
+ 'deposit': undefined,
3533
+ 'withdraw': undefined,
3534
+ 'fee': undefined,
3535
+ 'name': undefined,
3536
+ 'type': type,
3537
+ 'limits': {
3538
+ 'amount': {
3539
+ 'min': undefined,
3540
+ 'max': undefined,
3541
+ },
3542
+ 'withdraw': {
3543
+ 'min': undefined,
3544
+ 'max': undefined,
3545
+ },
3546
+ 'deposit': {
3547
+ 'min': undefined,
3548
+ 'max': undefined,
3549
+ },
3550
+ },
3551
+ 'precision': undefined,
3552
+ 'networks': networks,
3553
+ });
3547
3554
  }
3548
3555
  networkIdToCode(networkId = undefined, currencyCode = undefined) {
3549
3556
  // here network-id is provided as a pair of currency & chain (i.e. trc20usdt)
@@ -3553,7 +3560,7 @@ export default class htx extends Exchange {
3553
3560
  throw new ExchangeError(this.id + ' networkIdToCode() - markets need to be loaded at first');
3554
3561
  }
3555
3562
  const networkTitle = this.safeValue(this.options['networkNamesByChainIds'], networkId, networkId);
3556
- return super.networkIdToCode(networkTitle);
3563
+ return super.networkIdToCode(networkTitle, currencyCode);
3557
3564
  }
3558
3565
  networkCodeToId(networkCode, currencyCode = undefined) {
3559
3566
  if (currencyCode === undefined) {
@@ -3569,7 +3576,7 @@ export default class htx extends Exchange {
3569
3576
  return uniqueNetworkIds[networkCode];
3570
3577
  }
3571
3578
  else {
3572
- const networkTitle = super.networkCodeToId(networkCode);
3579
+ const networkTitle = super.networkCodeToId(networkCode, currencyCode);
3573
3580
  return this.safeValue(uniqueNetworkIds, networkTitle, networkTitle);
3574
3581
  }
3575
3582
  }
@@ -6594,7 +6601,7 @@ export default class htx extends Exchange {
6594
6601
  'currency': code,
6595
6602
  'address': address,
6596
6603
  'tag': tag,
6597
- 'network': this.networkIdToCode(networkId),
6604
+ 'network': this.networkIdToCode(networkId, code),
6598
6605
  'note': note,
6599
6606
  'info': depositAddress,
6600
6607
  };
@@ -6875,7 +6882,7 @@ export default class htx extends Exchange {
6875
6882
  'txid': txHash,
6876
6883
  'timestamp': timestamp,
6877
6884
  'datetime': this.iso8601(timestamp),
6878
- 'network': this.networkIdToCode(networkId),
6885
+ 'network': this.networkIdToCode(networkId, code),
6879
6886
  'address': this.safeString(transaction, 'address'),
6880
6887
  'addressTo': undefined,
6881
6888
  'addressFrom': undefined,
@@ -9409,12 +9416,13 @@ export default class htx extends Exchange {
9409
9416
  // }
9410
9417
  //
9411
9418
  const chains = this.safeValue(fee, 'chains', []);
9419
+ const code = this.safeString(currency, 'code');
9412
9420
  let result = this.depositWithdrawFee(fee);
9413
9421
  for (let j = 0; j < chains.length; j++) {
9414
9422
  const chainEntry = chains[j];
9415
9423
  const networkId = this.safeString(chainEntry, 'chain');
9416
9424
  const withdrawFeeType = this.safeString(chainEntry, 'withdrawFeeType');
9417
- const networkCode = this.networkIdToCode(networkId);
9425
+ const networkCode = this.networkIdToCode(networkId, code);
9418
9426
  let withdrawFee = undefined;
9419
9427
  let withdrawResult = undefined;
9420
9428
  if (withdrawFeeType === 'fixed') {
@@ -39,6 +39,7 @@ export default class hyperliquid extends Exchange {
39
39
  * @returns {object} an associative dictionary of currencies
40
40
  */
41
41
  fetchCurrencies(params?: {}): Promise<Currencies>;
42
+ parseCurrency(rawCurrency: Dict): Currency;
42
43
  /**
43
44
  * @method
44
45
  * @name hyperliquid#fetchMarkets
@@ -457,50 +457,49 @@ export default class hyperliquid extends Exchange {
457
457
  const tokens = this.safeList(response, 'tokens', []);
458
458
  // const meta = this.safeList (response, 'universe', []);
459
459
  this.options['cachedCurrenciesById'] = {}; // used to map hip3 markets
460
- const result = {};
461
- for (let i = 0; i < tokens.length; i++) {
462
- const data = this.safeDict(tokens, i, {});
463
- // const id = i;
464
- const id = this.safeString(data, 'index');
465
- const name = this.safeString(data, 'name');
466
- const code = this.safeCurrencyCode(name);
467
- this.options['cachedCurrenciesById'][id] = name;
468
- result[code] = this.safeCurrencyStructure({
469
- 'id': id,
470
- 'name': name,
471
- 'code': code,
472
- 'precision': this.parsePrecision(this.safeString(data, 'weiDecimals')),
473
- 'info': data,
474
- 'active': undefined,
475
- 'deposit': undefined,
476
- 'withdraw': undefined,
477
- 'networks': undefined,
478
- 'fee': undefined,
479
- 'type': 'crypto',
480
- 'limits': {
481
- 'amount': {
482
- 'min': undefined,
483
- 'max': undefined,
484
- },
485
- 'withdraw': {
486
- 'min': undefined,
487
- 'max': undefined,
488
- },
460
+ return this.parseCurrencies(tokens);
461
+ }
462
+ parseCurrency(rawCurrency) {
463
+ // const id = i;
464
+ const id = this.safeString(rawCurrency, 'index');
465
+ const name = this.safeString(rawCurrency, 'name');
466
+ const code = this.safeCurrencyCode(name);
467
+ this.options['cachedCurrenciesById'][id] = name;
468
+ const result = this.safeCurrencyStructure({
469
+ 'id': id,
470
+ 'name': name,
471
+ 'code': code,
472
+ 'precision': this.parsePrecision(this.safeString(rawCurrency, 'weiDecimals')),
473
+ 'info': rawCurrency,
474
+ 'active': undefined,
475
+ 'deposit': undefined,
476
+ 'withdraw': undefined,
477
+ 'networks': undefined,
478
+ 'fee': undefined,
479
+ 'type': 'crypto',
480
+ 'limits': {
481
+ 'amount': {
482
+ 'min': undefined,
483
+ 'max': undefined,
489
484
  },
490
- });
491
- // add in wrapped map
492
- const fullName = this.safeString(data, 'fullName');
493
- if (fullName !== undefined && name !== undefined) {
494
- const isWrapped = fullName.startsWith('Unit ') && name.startsWith('U');
495
- if (isWrapped) {
496
- const parts = name.split('U');
497
- let nameWithoutU = '';
498
- for (let j = 0; j < parts.length; j++) {
499
- nameWithoutU = nameWithoutU + parts[j];
500
- }
501
- const baseCode = this.safeCurrencyCode(nameWithoutU);
502
- this.options['spotCurrencyMapping'][code] = baseCode;
485
+ 'withdraw': {
486
+ 'min': undefined,
487
+ 'max': undefined,
488
+ },
489
+ },
490
+ });
491
+ // add in wrapped map
492
+ const fullName = this.safeString(rawCurrency, 'fullName');
493
+ if (fullName !== undefined && name !== undefined) {
494
+ const isWrapped = fullName.startsWith('Unit ') && name.startsWith('U');
495
+ if (isWrapped) {
496
+ const parts = name.split('U');
497
+ let nameWithoutU = '';
498
+ for (let j = 0; j < parts.length; j++) {
499
+ nameWithoutU = nameWithoutU + parts[j];
503
500
  }
501
+ const baseCode = this.safeCurrencyCode(nameWithoutU);
502
+ this.options['spotCurrencyMapping'][code] = baseCode;
504
503
  }
505
504
  }
506
505
  return result;
package/js/src/indodax.js CHANGED
@@ -1379,11 +1379,11 @@ export default class indodax extends Exchange {
1379
1379
  network = [];
1380
1380
  const networkIds = networkId.split(',');
1381
1381
  for (let j = 0; j < networkIds.length; j++) {
1382
- network.push(this.networkIdToCode(networkIds[j]).toUpperCase());
1382
+ network.push(this.networkIdToCode(networkIds[j], code).toUpperCase());
1383
1383
  }
1384
1384
  }
1385
1385
  else {
1386
- network = this.networkIdToCode(networkId).toUpperCase();
1386
+ network = this.networkIdToCode(networkId, code).toUpperCase();
1387
1387
  }
1388
1388
  }
1389
1389
  const finalNetwork = network; // java req
@@ -41,6 +41,7 @@ export default class kraken extends Exchange {
41
41
  * @returns {object} an associative dictionary of currencies
42
42
  */
43
43
  fetchCurrencies(params?: {}): Promise<Currencies>;
44
+ parseCurrency(rawCurrency: Dict): Currency;
44
45
  safeCurrencyCode(currencyId: Str, currency?: Currency): Str;
45
46
  /**
46
47
  * @method
@@ -60,7 +61,7 @@ export default class kraken extends Exchange {
60
61
  percentage: boolean;
61
62
  tierBased: boolean;
62
63
  };
63
- parseBidAsk(bidask: any, priceKey?: IndexType, amountKey?: IndexType, countOrIdKey?: IndexType): number[];
64
+ parseOrderBookBidAsk(bidask: any, priceKey?: IndexType, amountKey?: IndexType, countOrIdKey?: IndexType): number[];
64
65
  /**
65
66
  * @method
66
67
  * @name kraken#fetchOrderBook