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
@@ -7,6 +7,7 @@ import type { Balances, Currencies, Currency, DepositAddress, Dict, Int, Market,
7
7
  export default class foxbit extends Exchange {
8
8
  describe(): any;
9
9
  fetchCurrencies(params?: {}): Promise<Currencies>;
10
+ parseCurrency(rawCurrency: Dict): Currency;
10
11
  /**
11
12
  * @method
12
13
  * @name foxbit#fetchMarkets
package/js/src/foxbit.js CHANGED
@@ -362,83 +362,79 @@ export default class foxbit extends Exchange {
362
362
  // ]
363
363
  // }
364
364
  const data = this.safeList(response, 'data', []);
365
- const result = {};
366
- for (let i = 0; i < data.length; i++) {
367
- const currency = data[i];
368
- const precision = this.safeInteger(currency, 'precision');
369
- const currencyId = this.safeString(currency, 'symbol');
370
- const name = this.safeString(currency, 'name');
371
- const code = this.safeCurrencyCode(currencyId);
372
- const depositInfo = this.safeDict(currency, 'deposit_info');
373
- const withdrawInfo = this.safeDict(currency, 'withdraw_info');
374
- const networks = this.safeList(currency, 'networks', []);
375
- const type = this.safeStringLower(currency, 'type');
376
- const parsedNetworks = {};
377
- for (let j = 0; j < networks.length; j++) {
378
- const network = networks[j];
379
- const networkId = this.safeString(network, 'code');
380
- const networkCode = this.networkIdToCode(networkId, code);
381
- const networkWithdrawInfo = this.safeDict(network, 'withdraw_info');
382
- const networkDepositInfo = this.safeDict(network, 'deposit_info');
383
- const isWithdrawEnabled = this.safeString(networkWithdrawInfo, 'status') === 'ENABLED';
384
- const isDepositEnabled = this.safeString(networkDepositInfo, 'status') === 'ENABLED';
385
- parsedNetworks[networkCode] = {
386
- 'info': currency,
387
- 'id': networkId,
388
- 'network': networkCode,
389
- 'name': this.safeString(network, 'name'),
390
- 'deposit': isDepositEnabled,
391
- 'withdraw': isWithdrawEnabled,
392
- 'active': true,
393
- 'precision': precision,
394
- 'fee': this.safeNumber(networkWithdrawInfo, 'fee'),
395
- 'limits': {
396
- 'amount': {
397
- 'min': undefined,
398
- 'max': undefined,
399
- },
400
- 'deposit': {
401
- 'min': this.safeNumber(depositInfo, 'min_amount'),
402
- 'max': undefined,
403
- },
404
- 'withdraw': {
405
- 'min': this.safeNumber(withdrawInfo, 'min_amount'),
406
- 'max': undefined,
407
- },
365
+ return this.parseCurrencies(data);
366
+ }
367
+ parseCurrency(rawCurrency) {
368
+ const precision = this.safeInteger(rawCurrency, 'precision');
369
+ const currencyId = this.safeString(rawCurrency, 'symbol');
370
+ const name = this.safeString(rawCurrency, 'name');
371
+ const code = this.safeCurrencyCode(currencyId);
372
+ const depositInfo = this.safeDict(rawCurrency, 'deposit_info');
373
+ const withdrawInfo = this.safeDict(rawCurrency, 'withdraw_info');
374
+ const networks = this.safeList(rawCurrency, 'networks', []);
375
+ const type = this.safeStringLower(rawCurrency, 'type');
376
+ const parsedNetworks = {};
377
+ for (let j = 0; j < networks.length; j++) {
378
+ const network = networks[j];
379
+ const networkId = this.safeString(network, 'code');
380
+ const networkCode = this.networkIdToCode(networkId, code);
381
+ const networkWithdrawInfo = this.safeDict(network, 'withdraw_info');
382
+ const networkDepositInfo = this.safeDict(network, 'deposit_info');
383
+ const isWithdrawEnabled = this.safeString(networkWithdrawInfo, 'status') === 'ENABLED';
384
+ const isDepositEnabled = this.safeString(networkDepositInfo, 'status') === 'ENABLED';
385
+ parsedNetworks[networkCode] = {
386
+ 'info': rawCurrency,
387
+ 'id': networkId,
388
+ 'network': networkCode,
389
+ 'name': this.safeString(network, 'name'),
390
+ 'deposit': isDepositEnabled,
391
+ 'withdraw': isWithdrawEnabled,
392
+ 'active': true,
393
+ 'precision': precision,
394
+ 'fee': this.safeNumber(networkWithdrawInfo, 'fee'),
395
+ 'limits': {
396
+ 'amount': {
397
+ 'min': undefined,
398
+ 'max': undefined,
408
399
  },
409
- };
410
- }
411
- if (this.safeDict(result, code) === undefined) {
412
- result[code] = this.safeCurrencyStructure({
413
- 'id': currencyId,
414
- 'code': code,
415
- 'info': currency,
416
- 'name': name,
417
- 'active': true,
418
- 'type': type,
419
- 'deposit': this.safeBool(depositInfo, 'enabled', false),
420
- 'withdraw': this.safeBool(withdrawInfo, 'enabled', false),
421
- 'fee': this.safeNumber(withdrawInfo, 'fee'),
422
- 'precision': precision,
423
- 'limits': {
424
- 'amount': {
425
- 'min': undefined,
426
- 'max': undefined,
427
- },
428
- 'deposit': {
429
- 'min': this.safeNumber(depositInfo, 'min_amount'),
430
- 'max': undefined,
431
- },
432
- 'withdraw': {
433
- 'min': this.safeNumber(withdrawInfo, 'min_amount'),
434
- 'max': undefined,
435
- },
400
+ 'deposit': {
401
+ 'min': this.safeNumber(depositInfo, 'min_amount'),
402
+ 'max': undefined,
436
403
  },
437
- 'networks': parsedNetworks,
438
- });
439
- }
404
+ 'withdraw': {
405
+ 'min': this.safeNumber(withdrawInfo, 'min_amount'),
406
+ 'max': undefined,
407
+ },
408
+ },
409
+ };
440
410
  }
441
- return result;
411
+ return this.safeCurrencyStructure({
412
+ 'id': currencyId,
413
+ 'code': code,
414
+ 'info': rawCurrency,
415
+ 'name': name,
416
+ 'active': true,
417
+ 'type': type,
418
+ 'deposit': this.safeBool(depositInfo, 'enabled', false),
419
+ 'withdraw': this.safeBool(withdrawInfo, 'enabled', false),
420
+ 'fee': this.safeNumber(withdrawInfo, 'fee'),
421
+ 'precision': precision,
422
+ 'limits': {
423
+ 'amount': {
424
+ 'min': undefined,
425
+ 'max': undefined,
426
+ },
427
+ 'deposit': {
428
+ 'min': this.safeNumber(depositInfo, 'min_amount'),
429
+ 'max': undefined,
430
+ },
431
+ 'withdraw': {
432
+ 'min': this.safeNumber(withdrawInfo, 'min_amount'),
433
+ 'max': undefined,
434
+ },
435
+ },
436
+ 'networks': parsedNetworks,
437
+ });
442
438
  }
443
439
  /**
444
440
  * @method
@@ -1533,7 +1529,7 @@ export default class foxbit extends Exchange {
1533
1529
  let networkCode = undefined;
1534
1530
  [networkCode, params] = this.handleNetworkCodeAndParams(params);
1535
1531
  if (networkCode !== undefined) {
1536
- request['network_code'] = this.networkCodeToId(networkCode);
1532
+ request['network_code'] = this.networkCodeToId(networkCode, code);
1537
1533
  }
1538
1534
  const response = await this.v3PrivatePostWithdrawals(this.extend(request, params));
1539
1535
  // {
package/js/src/gate.d.ts CHANGED
@@ -111,6 +111,7 @@ export default class gate extends Exchange {
111
111
  * @returns {object} an associative dictionary of currencies
112
112
  */
113
113
  fetchCurrencies(params?: {}): Promise<Currencies>;
114
+ parseCurrency(rawCurrency: Dict): Currency;
114
115
  /**
115
116
  * @method
116
117
  * @name gate#fetchFundingRate
package/js/src/gate.js CHANGED
@@ -1987,56 +1987,53 @@ export default class gate extends Exchange {
1987
1987
  // },
1988
1988
  // ]
1989
1989
  //
1990
- const indexedCurrencies = this.indexBy(response, 'currency');
1991
- const result = {};
1992
- for (let i = 0; i < response.length; i++) {
1993
- const entry = response[i];
1994
- const currencyId = this.safeString(entry, 'currency');
1995
- const code = this.safeCurrencyCode(currencyId);
1996
- // check leveraged tokens (e.g. BTC3S, ETH5L)
1997
- const type = this.isLeveragedCurrency(currencyId, true, indexedCurrencies) ? 'leveraged' : 'crypto';
1998
- const chains = this.safeList(entry, 'chains', []);
1999
- const networks = {};
2000
- for (let j = 0; j < chains.length; j++) {
2001
- const chain = chains[j];
2002
- const networkId = this.safeString(chain, 'name');
2003
- const networkCode = this.networkIdToCode(networkId);
2004
- networks[networkCode] = {
2005
- 'info': chain,
2006
- 'id': networkId,
2007
- 'network': networkCode,
2008
- 'active': undefined,
2009
- 'deposit': !this.safeBool(chain, 'deposit_disabled'),
2010
- 'withdraw': !this.safeBool(chain, 'withdraw_disabled'),
2011
- 'fee': undefined,
2012
- 'precision': this.parseNumber('0.0001'),
2013
- 'limits': {
2014
- 'deposit': {
2015
- 'min': undefined,
2016
- 'max': undefined,
2017
- },
2018
- 'withdraw': {
2019
- 'min': undefined,
2020
- 'max': undefined,
2021
- },
2022
- },
2023
- };
2024
- }
2025
- result[code] = this.safeCurrencyStructure({
2026
- 'id': currencyId,
2027
- 'code': code,
2028
- 'name': this.safeString(entry, 'name'),
2029
- 'type': type,
2030
- 'active': !this.safeBool(entry, 'delisted'),
2031
- 'deposit': !this.safeBool(entry, 'deposit_disabled'),
2032
- 'withdraw': !this.safeBool(entry, 'withdraw_disabled'),
1990
+ return this.parseCurrencies(response);
1991
+ }
1992
+ parseCurrency(rawCurrency) {
1993
+ const currencyId = this.safeString(rawCurrency, 'currency');
1994
+ const code = this.safeCurrencyCode(currencyId);
1995
+ // check leveraged tokens (e.g. BTC3S, ETH5L)
1996
+ const type = this.isLeveragedCurrency(currencyId) ? 'leveraged' : 'crypto';
1997
+ const chains = this.safeList(rawCurrency, 'chains', []);
1998
+ const networks = {};
1999
+ for (let j = 0; j < chains.length; j++) {
2000
+ const chain = chains[j];
2001
+ const networkId = this.safeString(chain, 'name');
2002
+ const networkCode = this.networkIdToCode(networkId, code);
2003
+ networks[networkCode] = {
2004
+ 'info': chain,
2005
+ 'id': networkId,
2006
+ 'network': networkCode,
2007
+ 'active': undefined,
2008
+ 'deposit': !this.safeBool(chain, 'deposit_disabled'),
2009
+ 'withdraw': !this.safeBool(chain, 'withdraw_disabled'),
2033
2010
  'fee': undefined,
2034
- 'networks': networks,
2035
2011
  'precision': this.parseNumber('0.0001'),
2036
- 'info': entry,
2037
- });
2012
+ 'limits': {
2013
+ 'deposit': {
2014
+ 'min': undefined,
2015
+ 'max': undefined,
2016
+ },
2017
+ 'withdraw': {
2018
+ 'min': undefined,
2019
+ 'max': undefined,
2020
+ },
2021
+ },
2022
+ };
2038
2023
  }
2039
- return result;
2024
+ return this.safeCurrencyStructure({
2025
+ 'id': currencyId,
2026
+ 'code': code,
2027
+ 'name': this.safeString(rawCurrency, 'name'),
2028
+ 'type': type,
2029
+ 'active': !this.safeBool(rawCurrency, 'delisted'),
2030
+ 'deposit': !this.safeBool(rawCurrency, 'deposit_disabled'),
2031
+ 'withdraw': !this.safeBool(rawCurrency, 'withdraw_disabled'),
2032
+ 'fee': undefined,
2033
+ 'networks': networks,
2034
+ 'precision': this.parseNumber('0.0001'),
2035
+ 'info': rawCurrency,
2036
+ });
2040
2037
  }
2041
2038
  /**
2042
2039
  * @method
@@ -2340,12 +2337,13 @@ export default class gate extends Exchange {
2340
2337
  //
2341
2338
  const address = this.safeString(depositAddress, 'address');
2342
2339
  this.checkAddress(address);
2340
+ const code = this.safeString(currency, 'code');
2343
2341
  return {
2344
2342
  'info': depositAddress,
2345
- 'currency': this.safeString(currency, 'code'),
2343
+ 'currency': code,
2346
2344
  'address': address,
2347
2345
  'tag': this.safeString(depositAddress, 'payment_id'),
2348
- 'network': this.networkIdToCode(this.safeString(depositAddress, 'chain')),
2346
+ 'network': this.networkIdToCode(this.safeString(depositAddress, 'chain'), code),
2349
2347
  };
2350
2348
  }
2351
2349
  /**
@@ -2494,7 +2492,7 @@ export default class gate extends Exchange {
2494
2492
  const networkIds = Object.keys(withdrawFixOnChains);
2495
2493
  for (let j = 0; j < networkIds.length; j++) {
2496
2494
  const networkId = networkIds[j];
2497
- const networkCode = this.networkIdToCode(networkId);
2495
+ const networkCode = this.networkIdToCode(networkId, code);
2498
2496
  withdrawFees[networkCode] = this.parseNumber(withdrawFixOnChains[networkId]);
2499
2497
  }
2500
2498
  }
@@ -2574,7 +2572,9 @@ export default class gate extends Exchange {
2574
2572
  const chainKeys = Object.keys(withdrawFixOnChains);
2575
2573
  for (let i = 0; i < chainKeys.length; i++) {
2576
2574
  const chainKey = chainKeys[i];
2577
- const networkCode = this.networkIdToCode(chainKey, this.safeString(fee, 'currency'));
2575
+ const currencyId = this.safeString(fee, 'currency');
2576
+ const code = this.safeCurrencyCode(currencyId, currency);
2577
+ const networkCode = this.networkIdToCode(chainKey, code);
2578
2578
  result['networks'][networkCode] = {
2579
2579
  'withdraw': {
2580
2580
  'fee': this.parseNumber(withdrawFixOnChains[chainKey]),
@@ -4095,7 +4095,7 @@ export default class gate extends Exchange {
4095
4095
  let networkCode = undefined;
4096
4096
  [networkCode, params] = this.handleNetworkCodeAndParams(params);
4097
4097
  if (networkCode !== undefined) {
4098
- request['chain'] = this.networkCodeToId(networkCode);
4098
+ request['chain'] = this.networkCodeToId(networkCode, code);
4099
4099
  }
4100
4100
  const response = await this.privateWithdrawalsPostWithdrawals(this.extend(request, params));
4101
4101
  //
@@ -4227,7 +4227,7 @@ export default class gate extends Exchange {
4227
4227
  'txid': txid,
4228
4228
  'currency': code,
4229
4229
  'amount': this.parseNumber(amountString),
4230
- 'network': this.networkIdToCode(networkId),
4230
+ 'network': this.networkIdToCode(networkId, code),
4231
4231
  'address': address,
4232
4232
  'addressTo': undefined,
4233
4233
  'addressFrom': undefined,
@@ -22,7 +22,8 @@ export default class gemini extends Exchange {
22
22
  * @param {object} [params] extra parameters specific to the endpoint
23
23
  * @returns {object} an associative dictionary of currencies
24
24
  */
25
- fetchCurrenciesFromWeb(params?: {}): Promise<Dict>;
25
+ fetchCurrenciesFromWeb(params?: {}): Promise<Currencies>;
26
+ parseCurrency(rawCurrency: Dict): Currency;
26
27
  /**
27
28
  * @method
28
29
  * @name gemini#fetchMarkets
package/js/src/gemini.js CHANGED
@@ -435,51 +435,28 @@ export default class gemini extends Exchange {
435
435
  // ]
436
436
  // }
437
437
  //
438
- const result = {};
439
438
  this.options['tradingPairs'] = this.safeList(data, 'tradingPairs');
440
439
  const currenciesArray = this.safeValue(data, 'currencies', []);
441
- for (let i = 0; i < currenciesArray.length; i++) {
442
- const currency = currenciesArray[i];
443
- const id = this.safeString(currency, 0);
444
- const code = this.safeCurrencyCode(id);
445
- const type = this.safeString(currency, 7) ? 'fiat' : 'crypto';
446
- const precision = this.parseNumber(this.parsePrecision(this.safeString(currency, 5)));
447
- const networks = {};
448
- const networkId = this.safeString(currency, 9);
449
- let networkCode = undefined;
450
- if (networkId !== undefined) {
451
- networkCode = this.networkIdToCode(networkId);
452
- networks[networkCode] = {
453
- 'info': currency,
454
- 'id': networkId,
455
- 'network': networkCode,
456
- 'active': undefined,
457
- 'deposit': undefined,
458
- 'withdraw': undefined,
459
- 'fee': undefined,
460
- 'precision': precision,
461
- 'limits': {
462
- 'deposit': {
463
- 'min': undefined,
464
- 'max': undefined,
465
- },
466
- 'withdraw': {
467
- 'min': undefined,
468
- 'max': undefined,
469
- },
470
- },
471
- };
472
- }
473
- result[code] = this.safeCurrencyStructure({
474
- 'info': currency,
475
- 'id': id,
476
- 'code': code,
477
- 'name': this.safeString(currency, 1),
440
+ return this.parseCurrencies(currenciesArray);
441
+ }
442
+ parseCurrency(rawCurrency) {
443
+ const id = this.safeString(rawCurrency, 0);
444
+ const code = this.safeCurrencyCode(id);
445
+ const type = this.safeString(rawCurrency, 7) ? 'fiat' : 'crypto';
446
+ const precision = this.parseNumber(this.parsePrecision(this.safeString(rawCurrency, 5)));
447
+ const networks = {};
448
+ const networkId = this.safeString(rawCurrency, 9);
449
+ let networkCode = undefined;
450
+ if (networkId !== undefined) {
451
+ networkCode = this.networkIdToCode(networkId, code);
452
+ networks[networkCode] = {
453
+ 'info': rawCurrency,
454
+ 'id': networkId,
455
+ 'network': networkCode,
478
456
  'active': undefined,
479
457
  'deposit': undefined,
480
458
  'withdraw': undefined,
481
459
  'fee': undefined,
482
- 'type': type,
483
460
  'precision': precision,
484
461
  'limits': {
485
462
  'deposit': {
@@ -491,10 +468,31 @@ export default class gemini extends Exchange {
491
468
  'max': undefined,
492
469
  },
493
470
  },
494
- 'networks': networks,
495
- });
471
+ };
496
472
  }
497
- return result;
473
+ return this.safeCurrencyStructure({
474
+ 'info': rawCurrency,
475
+ 'id': id,
476
+ 'code': code,
477
+ 'name': this.safeString(rawCurrency, 1),
478
+ 'active': undefined,
479
+ 'deposit': undefined,
480
+ 'withdraw': undefined,
481
+ 'fee': undefined,
482
+ 'type': type,
483
+ 'precision': precision,
484
+ 'limits': {
485
+ 'deposit': {
486
+ 'min': undefined,
487
+ 'max': undefined,
488
+ },
489
+ 'withdraw': {
490
+ 'min': undefined,
491
+ 'max': undefined,
492
+ },
493
+ },
494
+ 'networks': networks,
495
+ });
498
496
  }
499
497
  /**
500
498
  * @method
@@ -1907,7 +1905,7 @@ export default class gemini extends Exchange {
1907
1905
  if (networkCode === undefined) {
1908
1906
  throw new ArgumentsRequired(this.id + ' fetchDepositAddresses() requires a network parameter');
1909
1907
  }
1910
- const networkId = this.networkCodeToId(networkCode);
1908
+ const networkId = this.networkCodeToId(networkCode, currency['code']);
1911
1909
  const request = {
1912
1910
  'network': networkId,
1913
1911
  };
package/js/src/grvt.js CHANGED
@@ -1588,13 +1588,15 @@ export default class grvt extends Exchange {
1588
1588
  let networkCode = undefined;
1589
1589
  let addressFrom = this.safeString(transaction, 'from_account_id');
1590
1590
  let addressTo = this.safeString(transaction, 'to_account_id');
1591
+ const currencyId = this.safeString(transaction, 'currency');
1592
+ const code = this.safeCurrencyCode(currencyId, currency);
1591
1593
  if ('transfer_metadata' in transaction) {
1592
1594
  const metaData = this.omitZero(this.safeString(transaction, 'transfer_metadata'));
1593
1595
  if (metaData !== undefined) {
1594
1596
  const parsedMeta = this.parseJson(metaData);
1595
1597
  direction = this.safeStringLower(parsedMeta, 'direction');
1596
1598
  txId = this.safeString(parsedMeta, 'provider_tx_id');
1597
- networkCode = this.networkIdToCode(this.safeString(parsedMeta, 'chainid'));
1599
+ networkCode = this.networkIdToCode(this.safeString(parsedMeta, 'chainid'), code);
1598
1600
  if (direction === 'withdrawal') {
1599
1601
  addressTo = this.safeString(parsedMeta, 'endpoint');
1600
1602
  }
@@ -1604,8 +1606,6 @@ export default class grvt extends Exchange {
1604
1606
  }
1605
1607
  }
1606
1608
  const timestamp = this.safeIntegerProduct2(transaction, 'event_time', 'initiated_time', 0.000001);
1607
- const currencyId = this.safeString(transaction, 'currency');
1608
- const code = this.safeCurrencyCode(currencyId, currency);
1609
1609
  return {
1610
1610
  'info': transaction,
1611
1611
  'id': undefined,
@@ -1907,7 +1907,7 @@ export default class grvt extends Exchange {
1907
1907
  'signature': this.defaultSignature(),
1908
1908
  };
1909
1909
  const [networkCode, query] = this.handleNetworkCodeAndParams(params);
1910
- const networkId = this.networkCodeToId(networkCode);
1910
+ const networkId = this.networkCodeToId(networkCode, code);
1911
1911
  if (networkId === undefined) {
1912
1912
  throw new BadRequest(this.id + ' withdraw() requires a network parameter');
1913
1913
  }
@@ -50,6 +50,7 @@ export default class hashkey extends Exchange {
50
50
  * @returns {object} an associative dictionary of currencies
51
51
  */
52
52
  fetchCurrencies(params?: {}): Promise<Currencies>;
53
+ parseCurrency(rawCurrency: Dict): Currency;
53
54
  /**
54
55
  * @method
55
56
  * @name hashkey#fetchOrderBook
package/js/src/hashkey.js CHANGED
@@ -1165,65 +1165,63 @@ export default class hashkey extends Exchange {
1165
1165
  // ]
1166
1166
  // }
1167
1167
  //
1168
- const result = {};
1169
- for (let i = 0; i < coins.length; i++) {
1170
- const currecy = coins[i];
1171
- const currencyId = this.safeString(currecy, 'coinId');
1172
- const code = this.safeCurrencyCode(currencyId);
1173
- const networks = this.safeList(currecy, 'chainTypes');
1174
- const parsedNetworks = {};
1175
- for (let j = 0; j < networks.length; j++) {
1176
- const network = networks[j];
1177
- const networkId = this.safeString(network, 'chainType');
1178
- const networkCode = this.networkCodeToId(networkId);
1179
- parsedNetworks[networkCode] = {
1180
- 'id': networkId,
1181
- 'network': networkCode,
1182
- 'limits': {
1183
- 'withdraw': {
1184
- 'min': this.safeNumber(network, 'minWithdrawQuantity'),
1185
- 'max': this.parseNumber(this.omitZero(this.safeString(network, 'maxWithdrawQuantity'))),
1186
- },
1187
- 'deposit': {
1188
- 'min': this.safeNumber(network, 'minDepositQuantity'),
1189
- 'max': undefined,
1190
- },
1191
- },
1192
- 'active': undefined,
1193
- 'deposit': this.safeBool(network, 'allowDeposit'),
1194
- 'withdraw': this.safeBool(network, 'allowWithdraw'),
1195
- 'fee': this.safeNumber(network, 'withdrawFee'),
1196
- 'precision': undefined,
1197
- 'info': network,
1198
- };
1199
- }
1200
- const rawType = this.safeString(currecy, 'tokenType');
1201
- const type = (rawType === 'REAL_MONEY') ? 'fiat' : 'crypto';
1202
- result[code] = this.safeCurrencyStructure({
1203
- 'id': currencyId,
1204
- 'code': code,
1205
- 'precision': undefined,
1206
- 'type': type,
1207
- 'name': this.safeString(currecy, 'coinFullName'),
1208
- 'active': undefined,
1209
- 'deposit': this.safeBool(currecy, 'allowDeposit'),
1210
- 'withdraw': this.safeBool(currecy, 'allowWithdraw'),
1211
- 'fee': undefined,
1168
+ return this.parseCurrencies(coins);
1169
+ }
1170
+ parseCurrency(rawCurrency) {
1171
+ const currencyId = this.safeString(rawCurrency, 'coinId');
1172
+ const code = this.safeCurrencyCode(currencyId);
1173
+ const networks = this.safeList(rawCurrency, 'chainTypes');
1174
+ const parsedNetworks = {};
1175
+ for (let j = 0; j < networks.length; j++) {
1176
+ const network = networks[j];
1177
+ const networkId = this.safeString(network, 'chainType');
1178
+ const networkCode = this.networkCodeToId(networkId, code);
1179
+ parsedNetworks[networkCode] = {
1180
+ 'id': networkId,
1181
+ 'network': networkCode,
1212
1182
  'limits': {
1213
- 'deposit': {
1214
- 'min': undefined,
1215
- 'max': undefined,
1216
- },
1217
1183
  'withdraw': {
1218
- 'min': undefined,
1184
+ 'min': this.safeNumber(network, 'minWithdrawQuantity'),
1185
+ 'max': this.parseNumber(this.omitZero(this.safeString(network, 'maxWithdrawQuantity'))),
1186
+ },
1187
+ 'deposit': {
1188
+ 'min': this.safeNumber(network, 'minDepositQuantity'),
1219
1189
  'max': undefined,
1220
1190
  },
1221
1191
  },
1222
- 'networks': parsedNetworks,
1223
- 'info': currecy,
1224
- });
1192
+ 'active': undefined,
1193
+ 'deposit': this.safeBool(network, 'allowDeposit'),
1194
+ 'withdraw': this.safeBool(network, 'allowWithdraw'),
1195
+ 'fee': this.safeNumber(network, 'withdrawFee'),
1196
+ 'precision': undefined,
1197
+ 'info': network,
1198
+ };
1225
1199
  }
1226
- return result;
1200
+ const rawType = this.safeString(rawCurrency, 'tokenType');
1201
+ const type = (rawType === 'REAL_MONEY') ? 'fiat' : 'crypto';
1202
+ return this.safeCurrencyStructure({
1203
+ 'id': currencyId,
1204
+ 'code': code,
1205
+ 'precision': undefined,
1206
+ 'type': type,
1207
+ 'name': this.safeString(rawCurrency, 'coinFullName'),
1208
+ 'active': undefined,
1209
+ 'deposit': this.safeBool(rawCurrency, 'allowDeposit'),
1210
+ 'withdraw': this.safeBool(rawCurrency, 'allowWithdraw'),
1211
+ 'fee': undefined,
1212
+ 'limits': {
1213
+ 'deposit': {
1214
+ 'min': undefined,
1215
+ 'max': undefined,
1216
+ },
1217
+ 'withdraw': {
1218
+ 'min': undefined,
1219
+ 'max': undefined,
1220
+ },
1221
+ },
1222
+ 'networks': parsedNetworks,
1223
+ 'info': rawCurrency,
1224
+ });
1227
1225
  }
1228
1226
  /**
1229
1227
  * @method
@@ -2049,7 +2047,7 @@ export default class hashkey extends Exchange {
2049
2047
  let networkCode = undefined;
2050
2048
  [networkCode, params] = this.handleNetworkCodeAndParams(params);
2051
2049
  if (networkCode !== undefined) {
2052
- request['chainType'] = this.networkCodeToId(networkCode);
2050
+ request['chainType'] = this.networkCodeToId(networkCode, currency['code']);
2053
2051
  }
2054
2052
  const response = await this.privatePostApiV1AccountWithdraw(this.extend(request, params));
2055
2053
  //
@@ -26,7 +26,6 @@ export default class hitbtc extends Exchange {
26
26
  */
27
27
  fetchCurrencies(params?: {}): Promise<Currencies>;
28
28
  parseCurrency(currency: Dict): Currency;
29
- addKeyInArrayItems(obj: any, keyName: any): any[];
30
29
  /**
31
30
  * @method
32
31
  * @name hitbtc#createDepositAddress