ccxt 4.5.55 → 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 (321) hide show
  1. package/README.md +215 -10
  2. package/dist/ccxt.browser.min.js +10 -10
  3. package/dist/cjs/ccxt.js +6 -11
  4. package/dist/cjs/src/aftermath.js +10 -5
  5. package/dist/cjs/src/alpaca.js +2 -2
  6. package/dist/cjs/src/apex.js +26 -17
  7. package/dist/cjs/src/arkham.js +10 -7
  8. package/dist/cjs/src/ascendex.js +8 -5
  9. package/dist/cjs/src/aster.js +7 -4
  10. package/dist/cjs/src/backpack.js +4 -4
  11. package/dist/cjs/src/base/Exchange.js +72 -35
  12. package/dist/cjs/src/base/functions/io.js +25 -0
  13. package/dist/cjs/src/base/functions.js +1 -0
  14. package/dist/cjs/src/bigone.js +10 -7
  15. package/dist/cjs/src/binance.js +196 -198
  16. package/dist/cjs/src/bingx.js +7 -7
  17. package/dist/cjs/src/bitfinex.js +71 -58
  18. package/dist/cjs/src/bitflyer.js +2 -1
  19. package/dist/cjs/src/bitget.js +16 -5
  20. package/dist/cjs/src/bitmart.js +18 -10
  21. package/dist/cjs/src/bitmex.js +8 -5
  22. package/dist/cjs/src/bitopro.js +2 -2
  23. package/dist/cjs/src/bitrue.js +4 -3
  24. package/dist/cjs/src/bitso.js +7 -4
  25. package/dist/cjs/src/bitstamp.js +7 -4
  26. package/dist/cjs/src/bitteam.js +1 -1
  27. package/dist/cjs/src/bittrade.js +2 -2
  28. package/dist/cjs/src/bitvavo.js +457 -34
  29. package/dist/cjs/src/blofin.js +28 -4
  30. package/dist/cjs/src/bullish.js +6 -5
  31. package/dist/cjs/src/bybit.js +19 -17
  32. package/dist/cjs/src/bybiteu.js +1 -0
  33. package/dist/cjs/src/bydfi.js +1 -1
  34. package/dist/cjs/src/cex.js +3 -3
  35. package/dist/cjs/src/coinbase.js +75 -65
  36. package/dist/cjs/src/coinbaseexchange.js +4 -3
  37. package/dist/cjs/src/coinbaseinternational.js +17 -10
  38. package/dist/cjs/src/coinex.js +79 -77
  39. package/dist/cjs/src/coinmetro.js +1 -1
  40. package/dist/cjs/src/coinsph.js +5 -5
  41. package/dist/cjs/src/cryptocom.js +52 -54
  42. package/dist/cjs/src/cryptomus.js +43 -39
  43. package/dist/cjs/src/deepcoin.js +9 -5
  44. package/dist/cjs/src/delta.js +53 -53
  45. package/dist/cjs/src/deribit.js +35 -35
  46. package/dist/cjs/src/derive.js +31 -31
  47. package/dist/cjs/src/digifinex.js +45 -45
  48. package/dist/cjs/src/exmo.js +104 -122
  49. package/dist/cjs/src/extended.js +3497 -0
  50. package/dist/cjs/src/foxbit.js +72 -76
  51. package/dist/cjs/src/gate.js +53 -53
  52. package/dist/cjs/src/gemini.js +45 -45
  53. package/dist/cjs/src/grvt.js +17 -11
  54. package/dist/cjs/src/hashkey.js +56 -58
  55. package/dist/cjs/src/hibachi.js +1 -1
  56. package/dist/cjs/src/hitbtc.js +5 -14
  57. package/dist/cjs/src/hollaex.js +51 -54
  58. package/dist/cjs/src/htx.js +84 -72
  59. package/dist/cjs/src/hyperliquid.js +60 -55
  60. package/dist/cjs/src/indodax.js +4 -3
  61. package/dist/cjs/src/kraken.js +71 -71
  62. package/dist/cjs/src/krakenfutures.js +2 -1
  63. package/dist/cjs/src/kucoin.js +3 -2
  64. package/dist/cjs/src/latoken.js +30 -32
  65. package/dist/cjs/src/lbank.js +64 -60
  66. package/dist/cjs/src/lighter.js +36 -38
  67. package/dist/cjs/src/luno.js +36 -44
  68. package/dist/cjs/src/mercado.js +2 -1
  69. package/dist/cjs/src/mexc.js +72 -63
  70. package/dist/cjs/src/modetrade.js +51 -53
  71. package/dist/cjs/src/ndax.js +35 -37
  72. package/dist/cjs/src/okx.js +23 -5
  73. package/dist/cjs/src/onetrading.js +21 -23
  74. package/dist/cjs/src/p2b.js +8 -4
  75. package/dist/cjs/src/paradex.js +3 -2
  76. package/dist/cjs/src/phemex.js +47 -47
  77. package/dist/cjs/src/poloniex.js +19 -13
  78. package/dist/cjs/src/pro/alpaca.js +1 -1
  79. package/dist/cjs/src/pro/apex.js +11 -2
  80. package/dist/cjs/src/pro/arkham.js +1 -1
  81. package/dist/cjs/src/pro/aster.js +10 -9
  82. package/dist/cjs/src/pro/backpack.js +1 -1
  83. package/dist/cjs/src/pro/binance.js +6 -6
  84. package/dist/cjs/src/pro/bingx.js +7 -2
  85. package/dist/cjs/src/pro/bitget.js +1 -1
  86. package/dist/cjs/src/pro/bithumb.js +1 -1
  87. package/dist/cjs/src/pro/bitmart.js +10 -0
  88. package/dist/cjs/src/pro/bitmex.js +1 -1
  89. package/dist/cjs/src/pro/bitstamp.js +1 -1
  90. package/dist/cjs/src/pro/blockchaincom.js +1 -1
  91. package/dist/cjs/src/pro/bybit.js +1 -1
  92. package/dist/cjs/src/pro/cex.js +1 -1
  93. package/dist/cjs/src/pro/coinex.js +1 -1
  94. package/dist/cjs/src/pro/coinone.js +1 -1
  95. package/dist/cjs/src/pro/cryptocom.js +3 -1
  96. package/dist/cjs/src/pro/dydx.js +1 -1
  97. package/dist/cjs/src/pro/exmo.js +1 -1
  98. package/dist/cjs/src/pro/extended.js +865 -0
  99. package/dist/cjs/src/pro/gate.js +1 -1
  100. package/dist/cjs/src/pro/grvt.js +8 -0
  101. package/dist/cjs/src/pro/htx.js +4 -4
  102. package/dist/cjs/src/pro/independentreserve.js +1 -1
  103. package/dist/cjs/src/pro/krakenfutures.js +16 -4
  104. package/dist/cjs/src/pro/kucoin.js +1 -1
  105. package/dist/cjs/src/pro/luno.js +3 -3
  106. package/dist/cjs/src/pro/modetrade.js +3 -3
  107. package/dist/cjs/src/pro/okx.js +4 -4
  108. package/dist/cjs/src/pro/onetrading.js +1 -1
  109. package/dist/cjs/src/pro/toobit.js +1 -1
  110. package/dist/cjs/src/pro/weex.js +1 -1
  111. package/dist/cjs/src/pro/woo.js +4 -4
  112. package/dist/cjs/src/pro/woofipro.js +3 -3
  113. package/dist/cjs/src/pro/xt.js +1 -1
  114. package/dist/cjs/src/static_dependencies/starknet/utils/hash/classHash.js +7 -7
  115. package/dist/cjs/src/tokocrypto.js +1 -1
  116. package/dist/cjs/src/toobit.js +3 -3
  117. package/dist/cjs/src/upbit.js +3 -3
  118. package/dist/cjs/src/weex.js +57 -62
  119. package/dist/cjs/src/whitebit.js +61 -63
  120. package/dist/cjs/src/woo.js +66 -55
  121. package/dist/cjs/src/woofipro.js +54 -48
  122. package/dist/cjs/src/xt.js +3 -2
  123. package/dist/cjs/src/yobit.js +4 -2
  124. package/dist/cjs/src/zebpay.js +73 -75
  125. package/js/ccxt.d.ts +8 -14
  126. package/js/ccxt.js +6 -10
  127. package/js/src/abstract/bitvavo.d.ts +15 -7
  128. package/js/src/abstract/extended.d.ts +58 -0
  129. package/js/src/abstract/mexc.d.ts +1 -0
  130. package/js/src/aftermath.js +10 -5
  131. package/js/src/alpaca.js +2 -2
  132. package/js/src/apex.d.ts +1 -1
  133. package/js/src/apex.js +26 -17
  134. package/js/src/arkham.js +10 -7
  135. package/js/src/ascendex.js +8 -5
  136. package/js/src/aster.js +7 -4
  137. package/js/src/backpack.js +4 -4
  138. package/js/src/base/Exchange.d.ts +10 -6
  139. package/js/src/base/Exchange.js +72 -35
  140. package/js/src/base/functions/io.d.ts +7 -0
  141. package/js/src/base/functions/io.js +24 -0
  142. package/js/src/bigone.js +10 -7
  143. package/js/src/binance.d.ts +2 -0
  144. package/js/src/binance.js +200 -202
  145. package/js/src/bingx.js +7 -7
  146. package/js/src/bitfinex.d.ts +2 -0
  147. package/js/src/bitfinex.js +71 -58
  148. package/js/src/bitflyer.js +2 -1
  149. package/js/src/bitget.js +16 -5
  150. package/js/src/bitmart.js +18 -10
  151. package/js/src/bitmex.js +8 -5
  152. package/js/src/bitopro.js +2 -2
  153. package/js/src/bitrue.js +4 -3
  154. package/js/src/bitso.js +7 -4
  155. package/js/src/bitstamp.js +7 -4
  156. package/js/src/bitteam.js +1 -1
  157. package/js/src/bittrade.js +2 -2
  158. package/js/src/bitvavo.d.ts +114 -21
  159. package/js/src/bitvavo.js +457 -34
  160. package/js/src/blofin.d.ts +1 -0
  161. package/js/src/blofin.js +28 -4
  162. package/js/src/bullish.js +6 -5
  163. package/js/src/bybit.d.ts +1 -1
  164. package/js/src/bybit.js +19 -17
  165. package/js/src/bybiteu.js +1 -0
  166. package/js/src/bydfi.js +1 -1
  167. package/js/src/cex.js +3 -3
  168. package/js/src/coinbase.d.ts +63 -56
  169. package/js/src/coinbase.js +75 -65
  170. package/js/src/coinbaseexchange.js +4 -3
  171. package/js/src/coinbaseinternational.d.ts +1 -1
  172. package/js/src/coinbaseinternational.js +17 -10
  173. package/js/src/coinex.d.ts +2 -1
  174. package/js/src/coinex.js +79 -77
  175. package/js/src/coinmetro.d.ts +1 -1
  176. package/js/src/coinmetro.js +1 -1
  177. package/js/src/coinsph.js +5 -5
  178. package/js/src/cryptocom.d.ts +1 -0
  179. package/js/src/cryptocom.js +52 -54
  180. package/js/src/cryptomus.d.ts +2 -1
  181. package/js/src/cryptomus.js +43 -39
  182. package/js/src/deepcoin.js +9 -5
  183. package/js/src/delta.d.ts +1 -0
  184. package/js/src/delta.js +53 -53
  185. package/js/src/deribit.d.ts +1 -0
  186. package/js/src/deribit.js +35 -35
  187. package/js/src/derive.d.ts +1 -0
  188. package/js/src/derive.js +31 -31
  189. package/js/src/digifinex.d.ts +1 -0
  190. package/js/src/digifinex.js +45 -45
  191. package/js/src/exmo.d.ts +1 -0
  192. package/js/src/exmo.js +104 -122
  193. package/js/src/extended.d.ts +554 -0
  194. package/js/src/extended.js +3490 -0
  195. package/js/src/foxbit.d.ts +1 -0
  196. package/js/src/foxbit.js +72 -76
  197. package/js/src/gate.d.ts +1 -0
  198. package/js/src/gate.js +53 -53
  199. package/js/src/gemini.d.ts +2 -1
  200. package/js/src/gemini.js +45 -45
  201. package/js/src/grvt.d.ts +1 -1
  202. package/js/src/grvt.js +17 -11
  203. package/js/src/hashkey.d.ts +1 -0
  204. package/js/src/hashkey.js +56 -58
  205. package/js/src/hibachi.d.ts +1 -1
  206. package/js/src/hibachi.js +1 -1
  207. package/js/src/hitbtc.d.ts +0 -1
  208. package/js/src/hitbtc.js +5 -14
  209. package/js/src/hollaex.d.ts +1 -0
  210. package/js/src/hollaex.js +51 -54
  211. package/js/src/htx.d.ts +1 -0
  212. package/js/src/htx.js +84 -72
  213. package/js/src/hyperliquid.d.ts +5 -4
  214. package/js/src/hyperliquid.js +60 -55
  215. package/js/src/indodax.js +4 -3
  216. package/js/src/kraken.d.ts +2 -1
  217. package/js/src/kraken.js +71 -71
  218. package/js/src/krakenfutures.js +2 -1
  219. package/js/src/kucoin.js +3 -2
  220. package/js/src/latoken.d.ts +1 -0
  221. package/js/src/latoken.js +30 -32
  222. package/js/src/lbank.d.ts +1 -0
  223. package/js/src/lbank.js +64 -60
  224. package/js/src/lighter.d.ts +2 -1
  225. package/js/src/lighter.js +36 -38
  226. package/js/src/luno.d.ts +1 -0
  227. package/js/src/luno.js +36 -44
  228. package/js/src/mercado.js +2 -1
  229. package/js/src/mexc.d.ts +4 -3
  230. package/js/src/mexc.js +72 -63
  231. package/js/src/modetrade.d.ts +1 -0
  232. package/js/src/modetrade.js +51 -53
  233. package/js/src/ndax.d.ts +1 -0
  234. package/js/src/ndax.js +35 -37
  235. package/js/src/okx.js +23 -5
  236. package/js/src/onetrading.d.ts +2 -1
  237. package/js/src/onetrading.js +21 -23
  238. package/js/src/p2b.js +8 -4
  239. package/js/src/paradex.js +3 -2
  240. package/js/src/phemex.d.ts +1 -0
  241. package/js/src/phemex.js +47 -47
  242. package/js/src/poloniex.js +19 -13
  243. package/js/src/pro/alpaca.js +1 -1
  244. package/js/src/pro/apex.js +11 -2
  245. package/js/src/pro/arkham.js +1 -1
  246. package/js/src/pro/aster.js +10 -9
  247. package/js/src/pro/backpack.js +1 -1
  248. package/js/src/pro/binance.d.ts +1 -1
  249. package/js/src/pro/binance.js +6 -6
  250. package/js/src/pro/bingx.js +7 -2
  251. package/js/src/pro/bitget.js +1 -1
  252. package/js/src/pro/bithumb.js +1 -1
  253. package/js/src/pro/bitmart.js +10 -0
  254. package/js/src/pro/bitmex.js +1 -1
  255. package/js/src/pro/bitstamp.js +1 -1
  256. package/js/src/pro/blockchaincom.js +1 -1
  257. package/js/src/pro/bybit.js +1 -1
  258. package/js/src/pro/cex.js +1 -1
  259. package/js/src/pro/coinex.js +1 -1
  260. package/js/src/pro/coinone.js +1 -1
  261. package/js/src/pro/cryptocom.js +3 -1
  262. package/js/src/pro/dydx.js +1 -1
  263. package/js/src/pro/exmo.js +1 -1
  264. package/js/src/pro/extended.d.ts +126 -0
  265. package/js/src/pro/extended.js +858 -0
  266. package/js/src/pro/gate.js +1 -1
  267. package/js/src/pro/grvt.js +8 -0
  268. package/js/src/pro/htx.d.ts +4 -4
  269. package/js/src/pro/htx.js +4 -4
  270. package/js/src/pro/independentreserve.js +1 -1
  271. package/js/src/pro/krakenfutures.d.ts +4 -4
  272. package/js/src/pro/krakenfutures.js +16 -4
  273. package/js/src/pro/kucoin.js +1 -1
  274. package/js/src/pro/luno.d.ts +1 -1
  275. package/js/src/pro/luno.js +3 -3
  276. package/js/src/pro/modetrade.d.ts +3 -3
  277. package/js/src/pro/modetrade.js +3 -3
  278. package/js/src/pro/okx.d.ts +4 -4
  279. package/js/src/pro/okx.js +4 -4
  280. package/js/src/pro/onetrading.js +1 -1
  281. package/js/src/pro/toobit.js +1 -1
  282. package/js/src/pro/weex.js +1 -1
  283. package/js/src/pro/woo.d.ts +4 -4
  284. package/js/src/pro/woo.js +4 -4
  285. package/js/src/pro/woofipro.d.ts +3 -3
  286. package/js/src/pro/woofipro.js +3 -3
  287. package/js/src/pro/xt.js +1 -1
  288. package/js/src/tokocrypto.js +1 -1
  289. package/js/src/toobit.d.ts +1 -1
  290. package/js/src/toobit.js +3 -3
  291. package/js/src/upbit.js +3 -3
  292. package/js/src/weex.d.ts +1 -0
  293. package/js/src/weex.js +57 -62
  294. package/js/src/whitebit.d.ts +1 -0
  295. package/js/src/whitebit.js +61 -63
  296. package/js/src/woo.d.ts +1 -0
  297. package/js/src/woo.js +66 -55
  298. package/js/src/woofipro.d.ts +1 -0
  299. package/js/src/woofipro.js +54 -48
  300. package/js/src/xt.js +3 -2
  301. package/js/src/yobit.js +4 -2
  302. package/js/src/zebpay.d.ts +2 -1
  303. package/js/src/zebpay.js +73 -75
  304. package/package.json +25 -11
  305. package/dist/cjs/src/gateio.js +0 -18
  306. package/dist/cjs/src/oxfun.js +0 -2931
  307. package/dist/cjs/src/pro/gateio.js +0 -18
  308. package/dist/cjs/src/pro/oxfun.js +0 -1113
  309. package/js/src/abstract/gateio.d.ts +0 -346
  310. package/js/src/abstract/gateio.js +0 -5
  311. package/js/src/abstract/oxfun.d.ts +0 -37
  312. package/js/src/gateio.d.ts +0 -4
  313. package/js/src/gateio.js +0 -11
  314. package/js/src/oxfun.d.ts +0 -442
  315. package/js/src/oxfun.js +0 -2924
  316. package/js/src/pro/gateio.d.ts +0 -4
  317. package/js/src/pro/gateio.js +0 -11
  318. package/js/src/pro/oxfun.d.ts +0 -234
  319. package/js/src/pro/oxfun.js +0 -1106
  320. /package/dist/cjs/src/abstract/{oxfun.js → extended.js} +0 -0
  321. /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
@@ -1139,7 +1135,7 @@ export default class foxbit extends Exchange {
1139
1135
  // "remark": "A remarkable note for the order.",
1140
1136
  // "funds_received": "290.0"
1141
1137
  // }
1142
- return this.parseOrder(response, undefined);
1138
+ return this.parseOrder(response);
1143
1139
  }
1144
1140
  /**
1145
1141
  * @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
@@ -820,6 +818,7 @@ export default class gemini extends Exchange {
820
818
  inverse = false;
821
819
  }
822
820
  const type = swap ? 'swap' : 'spot';
821
+ const isSpot = !swap;
823
822
  return {
824
823
  'id': marketId,
825
824
  'symbol': symbol,
@@ -830,7 +829,7 @@ export default class gemini extends Exchange {
830
829
  'quoteId': quoteId,
831
830
  'settleId': settleId,
832
831
  'type': type,
833
- 'spot': !swap,
832
+ 'spot': isSpot,
834
833
  'margin': false,
835
834
  'swap': swap,
836
835
  'future': false,
@@ -1906,7 +1905,7 @@ export default class gemini extends Exchange {
1906
1905
  if (networkCode === undefined) {
1907
1906
  throw new ArgumentsRequired(this.id + ' fetchDepositAddresses() requires a network parameter');
1908
1907
  }
1909
- const networkId = this.networkCodeToId(networkCode);
1908
+ const networkId = this.networkCodeToId(networkCode, currency['code']);
1910
1909
  const request = {
1911
1910
  'network': networkId,
1912
1911
  };
@@ -1924,8 +1923,9 @@ export default class gemini extends Exchange {
1924
1923
  throw new AuthenticationError(this.id + ' sign() requires an account-key, master-keys are not-supported');
1925
1924
  }
1926
1925
  const nonce = this.nonce().toString();
1926
+ const finalUrl = url;
1927
1927
  const request = this.extend({
1928
- 'request': url,
1928
+ 'request': finalUrl,
1929
1929
  'nonce': nonce,
1930
1930
  }, query);
1931
1931
  let payload = this.json(request);
package/js/src/grvt.d.ts CHANGED
@@ -226,7 +226,7 @@ export default class grvt extends Exchange {
226
226
  */
227
227
  transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
228
228
  parseTransfer(transfer: Dict, currency?: Currency): TransferEntry;
229
- loadAccountInfos(): Promise<void>;
229
+ loadAccountInfos(): Promise<boolean>;
230
230
  /**
231
231
  * @method
232
232
  * @name grvt#withdraw
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,
@@ -1826,7 +1826,7 @@ export default class grvt extends Exchange {
1826
1826
  }
1827
1827
  async loadAccountInfos() {
1828
1828
  if (this.safeString(this.options, 'userMainAccountId') !== undefined) {
1829
- return;
1829
+ return false;
1830
1830
  }
1831
1831
  const promises = [];
1832
1832
  promises.push(this.privateTradingPostFullV1AggregatedAccountSummary());
@@ -1879,6 +1879,7 @@ export default class grvt extends Exchange {
1879
1879
  const subAccountId = this.safeString(subAccountIds, 0);
1880
1880
  this.options['accountId'] = subAccountId;
1881
1881
  }
1882
+ return true;
1882
1883
  }
1883
1884
  /**
1884
1885
  * @method
@@ -1906,7 +1907,7 @@ export default class grvt extends Exchange {
1906
1907
  'signature': this.defaultSignature(),
1907
1908
  };
1908
1909
  const [networkCode, query] = this.handleNetworkCodeAndParams(params);
1909
- const networkId = this.networkCodeToId(networkCode);
1910
+ const networkId = this.networkCodeToId(networkCode, code);
1910
1911
  if (networkId === undefined) {
1911
1912
  throw new BadRequest(this.id + ' withdraw() requires a network parameter');
1912
1913
  }
@@ -1971,8 +1972,10 @@ export default class grvt extends Exchange {
1971
1972
  }
1972
1973
  params = this.omit(params, ['clientOrderId']);
1973
1974
  const isMarketOrder = (type === 'market');
1975
+ const subAccountId = this.getSubAccountId(params);
1976
+ const isReduceOnly = this.safeBool(params, 'reduceOnly', false);
1974
1977
  const orderRequest = {
1975
- 'sub_account_id': this.getSubAccountId(params),
1978
+ 'sub_account_id': subAccountId,
1976
1979
  'time_in_force': undefined,
1977
1980
  'legs': [orderLeg],
1978
1981
  'signature': this.defaultSignature(),
@@ -1981,7 +1984,7 @@ export default class grvt extends Exchange {
1981
1984
  },
1982
1985
  'is_market': isMarketOrder,
1983
1986
  'post_only': false,
1984
- 'reduce_only': this.safeBool(params, 'reduceOnly', false),
1987
+ 'reduce_only': isReduceOnly,
1985
1988
  // 'order_id': null,
1986
1989
  // 'state': null,
1987
1990
  };
@@ -2614,8 +2617,9 @@ export default class grvt extends Exchange {
2614
2617
  */
2615
2618
  async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
2616
2619
  await this.loadMarketsAndSignIn();
2620
+ const subAccountId = this.getSubAccountId(params);
2617
2621
  let request = {
2618
- 'sub_account_id': this.getSubAccountId(params),
2622
+ 'sub_account_id': subAccountId,
2619
2623
  };
2620
2624
  let market = undefined;
2621
2625
  if (symbol !== undefined) {
@@ -2791,8 +2795,9 @@ export default class grvt extends Exchange {
2791
2795
  */
2792
2796
  async fetchOrder(id, symbol = undefined, params = {}) {
2793
2797
  await this.loadMarketsAndSignIn();
2798
+ const subAccountId = this.getSubAccountId(params);
2794
2799
  const request = {
2795
- 'sub_account_id': this.getSubAccountId(params),
2800
+ 'sub_account_id': subAccountId,
2796
2801
  };
2797
2802
  const clientOrderId = this.safeString2(params, 'clientOrderId', 'client_order_id');
2798
2803
  if (clientOrderId !== undefined) {
@@ -3055,7 +3060,7 @@ export default class grvt extends Exchange {
3055
3060
  // }
3056
3061
  //
3057
3062
  const result = this.safeDict(response, 'result', {});
3058
- return this.parseOrders([result], undefined);
3063
+ return this.parseOrders([result]);
3059
3064
  }
3060
3065
  /**
3061
3066
  * @method
@@ -3070,8 +3075,9 @@ export default class grvt extends Exchange {
3070
3075
  */
3071
3076
  async cancelOrder(id, symbol = undefined, params = {}) {
3072
3077
  await this.loadMarketsAndSignIn();
3078
+ const subAccoubntId = this.getSubAccountId(params);
3073
3079
  const request = {
3074
- 'sub_account_id': this.getSubAccountId(params),
3080
+ 'sub_account_id': subAccoubntId,
3075
3081
  };
3076
3082
  const clientOrderId = this.safeString2(params, 'clientOrderId', 'client_order_id');
3077
3083
  if (clientOrderId !== undefined) {
@@ -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