ccxt 4.4.3 → 4.4.4

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 (120) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/base/Exchange.js +2 -2
  5. package/dist/cjs/src/base/functions/misc.js +11 -0
  6. package/dist/cjs/src/base/functions.js +1 -0
  7. package/dist/cjs/src/base/ws/WsClient.js +2 -1
  8. package/dist/cjs/src/binance.js +39 -12
  9. package/dist/cjs/src/bingx.js +1 -0
  10. package/dist/cjs/src/bitfinex2.js +7 -6
  11. package/dist/cjs/src/bitget.js +10 -6
  12. package/dist/cjs/src/bitmex.js +11 -10
  13. package/dist/cjs/src/bitso.js +5 -4
  14. package/dist/cjs/src/bitstamp.js +9 -9
  15. package/dist/cjs/src/blofin.js +21 -23
  16. package/dist/cjs/src/bybit.js +21 -20
  17. package/dist/cjs/src/coinbase.js +28 -7
  18. package/dist/cjs/src/coinbaseexchange.js +11 -11
  19. package/dist/cjs/src/coinlist.js +6 -5
  20. package/dist/cjs/src/coinmetro.js +3 -3
  21. package/dist/cjs/src/cryptocom.js +7 -5
  22. package/dist/cjs/src/currencycom.js +6 -6
  23. package/dist/cjs/src/delta.js +5 -5
  24. package/dist/cjs/src/digifinex.js +8 -6
  25. package/dist/cjs/src/gate.js +6 -5
  26. package/dist/cjs/src/hashkey.js +9 -7
  27. package/dist/cjs/src/htx.js +13 -16
  28. package/dist/cjs/src/hyperliquid.js +67 -114
  29. package/dist/cjs/src/kraken.js +8 -6
  30. package/dist/cjs/src/kucoin.js +9 -8
  31. package/dist/cjs/src/luno.js +10 -9
  32. package/dist/cjs/src/mexc.js +35 -2
  33. package/dist/cjs/src/ndax.js +6 -5
  34. package/dist/cjs/src/okcoin.js +18 -27
  35. package/dist/cjs/src/okx.js +18 -26
  36. package/dist/cjs/src/p2b.js +2 -2
  37. package/dist/cjs/src/pro/bybit.js +56 -0
  38. package/dist/cjs/src/pro/mexc.js +83 -0
  39. package/dist/cjs/src/woo.js +7 -6
  40. package/dist/cjs/src/woofipro.js +8 -6
  41. package/dist/cjs/src/xt.js +4 -3
  42. package/dist/cjs/src/zonda.js +6 -5
  43. package/js/ccxt.d.ts +1 -1
  44. package/js/ccxt.js +1 -1
  45. package/js/src/base/Exchange.d.ts +2 -2
  46. package/js/src/base/Exchange.js +2 -2
  47. package/js/src/base/functions/misc.d.ts +2 -1
  48. package/js/src/base/functions/misc.js +11 -1
  49. package/js/src/base/types.d.ts +1 -1
  50. package/js/src/base/ws/WsClient.js +2 -2
  51. package/js/src/binance.d.ts +4 -20
  52. package/js/src/binance.js +39 -12
  53. package/js/src/bingx.js +1 -0
  54. package/js/src/bitfinex2.d.ts +3 -19
  55. package/js/src/bitfinex2.js +7 -6
  56. package/js/src/bitget.d.ts +3 -19
  57. package/js/src/bitget.js +10 -6
  58. package/js/src/bitmex.d.ts +3 -22
  59. package/js/src/bitmex.js +11 -10
  60. package/js/src/bitso.d.ts +3 -19
  61. package/js/src/bitso.js +5 -4
  62. package/js/src/bitstamp.d.ts +3 -35
  63. package/js/src/bitstamp.js +9 -9
  64. package/js/src/blofin.d.ts +3 -15
  65. package/js/src/blofin.js +21 -23
  66. package/js/src/bybit.d.ts +3 -19
  67. package/js/src/bybit.js +21 -20
  68. package/js/src/coinbase.d.ts +3 -19
  69. package/js/src/coinbase.js +28 -7
  70. package/js/src/coinbaseexchange.d.ts +3 -19
  71. package/js/src/coinbaseexchange.js +11 -11
  72. package/js/src/coinlist.d.ts +3 -19
  73. package/js/src/coinlist.js +6 -5
  74. package/js/src/coinmetro.d.ts +3 -19
  75. package/js/src/coinmetro.js +3 -3
  76. package/js/src/cryptocom.d.ts +3 -22
  77. package/js/src/cryptocom.js +7 -5
  78. package/js/src/currencycom.d.ts +3 -3
  79. package/js/src/currencycom.js +6 -6
  80. package/js/src/delta.d.ts +3 -19
  81. package/js/src/delta.js +5 -5
  82. package/js/src/digifinex.d.ts +3 -19
  83. package/js/src/digifinex.js +8 -6
  84. package/js/src/gate.d.ts +3 -19
  85. package/js/src/gate.js +6 -5
  86. package/js/src/hashkey.d.ts +3 -20
  87. package/js/src/hashkey.js +9 -7
  88. package/js/src/htx.d.ts +3 -19
  89. package/js/src/htx.js +13 -16
  90. package/js/src/hyperliquid.d.ts +3 -19
  91. package/js/src/hyperliquid.js +68 -115
  92. package/js/src/kraken.d.ts +5 -24
  93. package/js/src/kraken.js +8 -6
  94. package/js/src/kucoin.d.ts +3 -19
  95. package/js/src/kucoin.js +9 -8
  96. package/js/src/luno.d.ts +4 -20
  97. package/js/src/luno.js +10 -9
  98. package/js/src/mexc.js +35 -2
  99. package/js/src/ndax.d.ts +3 -19
  100. package/js/src/ndax.js +6 -5
  101. package/js/src/okcoin.d.ts +3 -19
  102. package/js/src/okcoin.js +18 -27
  103. package/js/src/okx.d.ts +3 -19
  104. package/js/src/okx.js +18 -26
  105. package/js/src/p2b.js +2 -2
  106. package/js/src/pro/bybit.d.ts +2 -0
  107. package/js/src/pro/bybit.js +56 -0
  108. package/js/src/pro/mexc.d.ts +4 -1
  109. package/js/src/pro/mexc.js +84 -1
  110. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  111. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +1 -1
  112. package/js/src/woo.d.ts +3 -19
  113. package/js/src/woo.js +7 -6
  114. package/js/src/woofipro.d.ts +3 -19
  115. package/js/src/woofipro.js +8 -6
  116. package/js/src/xt.d.ts +3 -22
  117. package/js/src/xt.js +4 -3
  118. package/js/src/zonda.d.ts +3 -19
  119. package/js/src/zonda.js +6 -5
  120. package/package.json +1 -1
@@ -2257,13 +2257,13 @@ class coinbase extends coinbase$1 {
2257
2257
  /**
2258
2258
  * @method
2259
2259
  * @name coinbase#fetchLedger
2260
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
2260
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2261
2261
  * @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-transactions#list-transactions
2262
- * @param {string} code unified currency code, default is undefined
2262
+ * @param {string} [code] unified currency code, default is undefined
2263
2263
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2264
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
2264
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
2265
2265
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2266
- * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
2266
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
2267
2267
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
2268
2268
  */
2269
2269
  await this.loadMarkets();
@@ -2292,8 +2292,28 @@ class coinbase extends coinbase$1 {
2292
2292
  const pagination = this.safeDict(response, 'pagination', {});
2293
2293
  const cursor = this.safeString(pagination, 'next_starting_after');
2294
2294
  if ((cursor !== undefined) && (cursor !== '')) {
2295
+ const lastFee = this.safeDict(last, 'fee');
2295
2296
  last['next_starting_after'] = cursor;
2296
- ledger[lastIndex] = last;
2297
+ ledger[lastIndex] = {
2298
+ 'info': this.safeDict(last, 'info'),
2299
+ 'id': this.safeString(last, 'id'),
2300
+ 'timestamp': this.safeInteger(last, 'timestamp'),
2301
+ 'datetime': this.safeString(last, 'datetime'),
2302
+ 'direction': this.safeString(last, 'direction'),
2303
+ 'account': this.safeString(last, 'account'),
2304
+ 'referenceId': undefined,
2305
+ 'referenceAccount': undefined,
2306
+ 'type': this.safeString(last, 'type'),
2307
+ 'currency': this.safeString(last, 'currency'),
2308
+ 'amount': this.safeNumber(last, 'amount'),
2309
+ 'before': undefined,
2310
+ 'after': undefined,
2311
+ 'status': this.safeString(last, 'status'),
2312
+ 'fee': {
2313
+ 'cost': this.safeNumber(lastFee, 'cost'),
2314
+ 'currency': this.safeString(lastFee, 'currency'),
2315
+ },
2316
+ };
2297
2317
  }
2298
2318
  return ledger;
2299
2319
  }
@@ -2573,6 +2593,7 @@ class coinbase extends coinbase$1 {
2573
2593
  }
2574
2594
  const currencyId = this.safeString(amountInfo, 'currency');
2575
2595
  const code = this.safeCurrencyCode(currencyId, currency);
2596
+ currency = this.safeCurrency(currencyId, currency);
2576
2597
  //
2577
2598
  // the address and txid do not belong to the unified ledger structure
2578
2599
  //
@@ -2608,7 +2629,7 @@ class coinbase extends coinbase$1 {
2608
2629
  accountId = parts[3];
2609
2630
  }
2610
2631
  }
2611
- return {
2632
+ return this.safeLedgerEntry({
2612
2633
  'info': item,
2613
2634
  'id': id,
2614
2635
  'timestamp': timestamp,
@@ -2624,7 +2645,7 @@ class coinbase extends coinbase$1 {
2624
2645
  'after': undefined,
2625
2646
  'status': status,
2626
2647
  'fee': fee,
2627
- };
2648
+ }, currency);
2628
2649
  }
2629
2650
  async findAccountId(code, params = {}) {
2630
2651
  await this.loadMarkets();
@@ -1469,33 +1469,33 @@ class coinbaseexchange extends coinbaseexchange$1 {
1469
1469
  referenceId = this.safeString(details, 'order_id');
1470
1470
  }
1471
1471
  const status = 'ok';
1472
- return {
1472
+ return this.safeLedgerEntry({
1473
+ 'info': item,
1473
1474
  'id': id,
1474
- 'currency': code,
1475
+ 'timestamp': timestamp,
1476
+ 'datetime': this.iso8601(timestamp),
1477
+ 'direction': direction,
1475
1478
  'account': account,
1476
1479
  'referenceAccount': referenceAccount,
1477
1480
  'referenceId': referenceId,
1478
- 'status': status,
1481
+ 'type': type,
1482
+ 'currency': code,
1479
1483
  'amount': amount,
1480
1484
  'before': before,
1481
1485
  'after': after,
1486
+ 'status': status,
1482
1487
  'fee': undefined,
1483
- 'direction': direction,
1484
- 'timestamp': timestamp,
1485
- 'datetime': this.iso8601(timestamp),
1486
- 'type': type,
1487
- 'info': item,
1488
- };
1488
+ }, currency);
1489
1489
  }
1490
1490
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
1491
1491
  /**
1492
1492
  * @method
1493
1493
  * @name coinbaseexchange#fetchLedger
1494
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
1494
1495
  * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccountledger
1495
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
1496
1496
  * @param {string} code unified currency code, default is undefined
1497
1497
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
1498
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
1498
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
1499
1499
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1500
1500
  * @param {int} [params.until] the latest time in ms to fetch trades for
1501
1501
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
@@ -2084,11 +2084,11 @@ class coinlist extends coinlist$1 {
2084
2084
  /**
2085
2085
  * @method
2086
2086
  * @name coinlist#fetchLedger
2087
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
2087
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2088
2088
  * @see https://trade-docs.coinlist.co/?javascript--nodejs#get-account-history
2089
- * @param {string} code unified currency code, default is undefined
2089
+ * @param {string} [code] unified currency code, default is undefined
2090
2090
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2091
- * @param {int} [limit] max number of ledger entrys to return (default 200, max 500)
2091
+ * @param {int} [limit] max number of ledger entries to return (default 200, max 500)
2092
2092
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2093
2093
  * @param {int} [params.until] the latest time in ms to fetch entries for
2094
2094
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
@@ -2272,8 +2272,9 @@ class coinlist extends coinlist$1 {
2272
2272
  }
2273
2273
  const currencyId = this.safeString(item, 'asset');
2274
2274
  const code = this.safeCurrencyCode(currencyId, currency);
2275
+ currency = this.safeCurrency(currencyId, currency);
2275
2276
  const type = this.parseLedgerEntryType(this.safeString(item, 'type'));
2276
- return {
2277
+ return this.safeLedgerEntry({
2277
2278
  'info': item,
2278
2279
  'id': id,
2279
2280
  'timestamp': timestamp,
@@ -2289,7 +2290,7 @@ class coinlist extends coinlist$1 {
2289
2290
  'after': undefined,
2290
2291
  'status': 'ok',
2291
2292
  'fee': undefined,
2292
- };
2293
+ }, currency);
2293
2294
  }
2294
2295
  parseLedgerEntryType(type) {
2295
2296
  const types = {
@@ -984,11 +984,11 @@ class coinmetro extends coinmetro$1 {
984
984
  /**
985
985
  * @method
986
986
  * @name coinmetro#fetchLedger
987
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
987
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
988
988
  * @see https://documenter.getpostman.com/view/3653795/SVfWN6KS#4e7831f7-a0e7-4c3e-9336-1d0e5dcb15cf
989
- * @param {string} code unified currency code, default is undefined
989
+ * @param {string} [code] unified currency code, default is undefined
990
990
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
991
- * @param {int} [limit] max number of ledger entrys to return (default 200, max 500)
991
+ * @param {int} [limit] max number of ledger entries to return (default 200, max 500)
992
992
  * @param {object} [params] extra parameters specific to the exchange API endpoint
993
993
  * @param {int} [params.until] the latest time in ms to fetch entries for
994
994
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
@@ -2393,7 +2393,7 @@ class cryptocom extends cryptocom$1 {
2393
2393
  * @name cryptocom#fetchLedger
2394
2394
  * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2395
2395
  * @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-transactions
2396
- * @param {string} code unified currency code
2396
+ * @param {string} [code] unified currency code
2397
2397
  * @param {int} [since] timestamp in ms of the earliest ledger entry
2398
2398
  * @param {int} [limit] max number of ledger entries to return
2399
2399
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2474,6 +2474,8 @@ class cryptocom extends cryptocom$1 {
2474
2474
  //
2475
2475
  const timestamp = this.safeInteger(item, 'event_timestamp_ms');
2476
2476
  const currencyId = this.safeString(item, 'instrument_name');
2477
+ const code = this.safeCurrencyCode(currencyId, currency);
2478
+ currency = this.safeCurrency(currencyId, currency);
2477
2479
  let amount = this.safeString(item, 'transaction_qty');
2478
2480
  let direction = undefined;
2479
2481
  if (Precise["default"].stringLt(amount, '0')) {
@@ -2483,14 +2485,15 @@ class cryptocom extends cryptocom$1 {
2483
2485
  else {
2484
2486
  direction = 'in';
2485
2487
  }
2486
- return {
2488
+ return this.safeLedgerEntry({
2489
+ 'info': item,
2487
2490
  'id': this.safeString(item, 'order_id'),
2488
2491
  'direction': direction,
2489
2492
  'account': this.safeString(item, 'account_id'),
2490
2493
  'referenceId': this.safeString(item, 'trade_id'),
2491
2494
  'referenceAccount': this.safeString(item, 'trade_match_id'),
2492
2495
  'type': this.parseLedgerEntryType(this.safeString(item, 'journal_type')),
2493
- 'currency': this.safeCurrencyCode(currencyId, currency),
2496
+ 'currency': code,
2494
2497
  'amount': this.parseNumber(amount),
2495
2498
  'timestamp': timestamp,
2496
2499
  'datetime': this.iso8601(timestamp),
@@ -2501,8 +2504,7 @@ class cryptocom extends cryptocom$1 {
2501
2504
  'currency': undefined,
2502
2505
  'cost': undefined,
2503
2506
  },
2504
- 'info': item,
2505
- };
2507
+ }, currency);
2506
2508
  }
2507
2509
  parseLedgerEntryType(type) {
2508
2510
  const ledgerType = {
@@ -1692,11 +1692,11 @@ class currencycom extends currencycom$1 {
1692
1692
  /**
1693
1693
  * @method
1694
1694
  * @name currencycom#fetchLedger
1695
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
1695
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
1696
1696
  * @see https://apitradedoc.currency.com/swagger-ui.html#/rest-api/getLedgerUsingGET
1697
- * @param {string} code unified currency code, default is undefined
1697
+ * @param {string} [code] unified currency code, default is undefined
1698
1698
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
1699
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
1699
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
1700
1700
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1701
1701
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
1702
1702
  */
@@ -1749,13 +1749,14 @@ class currencycom extends currencycom$1 {
1749
1749
  const timestamp = this.safeInteger(item, 'timestamp');
1750
1750
  const currencyId = this.safeString(item, 'currency');
1751
1751
  const code = this.safeCurrencyCode(currencyId, currency);
1752
+ currency = this.safeCurrency(currencyId, currency);
1752
1753
  const feeCost = this.safeString(item, 'commission');
1753
1754
  let fee = undefined;
1754
1755
  if (feeCost !== undefined) {
1755
1756
  fee = { 'currency': code, 'cost': feeCost };
1756
1757
  }
1757
1758
  const direction = Precise["default"].stringLt(amountString, '0') ? 'out' : 'in';
1758
- const result = {
1759
+ return this.safeLedgerEntry({
1759
1760
  'id': id,
1760
1761
  'timestamp': timestamp,
1761
1762
  'datetime': this.iso8601(timestamp),
@@ -1771,8 +1772,7 @@ class currencycom extends currencycom$1 {
1771
1772
  'status': this.parseLedgerEntryStatus(this.safeString(item, 'status')),
1772
1773
  'fee': fee,
1773
1774
  'info': item,
1774
- };
1775
- return result;
1775
+ }, currency);
1776
1776
  }
1777
1777
  parseLedgerEntryStatus(status) {
1778
1778
  const statuses = {
@@ -2188,11 +2188,11 @@ class delta extends delta$1 {
2188
2188
  /**
2189
2189
  * @method
2190
2190
  * @name delta#fetchLedger
2191
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
2191
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2192
2192
  * @see https://docs.delta.exchange/#get-wallet-transactions
2193
- * @param {string} code unified currency code, default is undefined
2193
+ * @param {string} [code] unified currency code, default is undefined
2194
2194
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2195
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
2195
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
2196
2196
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2197
2197
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
2198
2198
  */
@@ -2291,7 +2291,7 @@ class delta extends delta$1 {
2291
2291
  const after = this.safeString(item, 'balance');
2292
2292
  const before = Precise["default"].stringMax('0', Precise["default"].stringSub(after, amount));
2293
2293
  const status = 'ok';
2294
- return {
2294
+ return this.safeLedgerEntry({
2295
2295
  'info': item,
2296
2296
  'id': id,
2297
2297
  'direction': direction,
@@ -2307,7 +2307,7 @@ class delta extends delta$1 {
2307
2307
  'timestamp': timestamp,
2308
2308
  'datetime': this.iso8601(timestamp),
2309
2309
  'fee': undefined,
2310
- };
2310
+ }, currency);
2311
2311
  }
2312
2312
  async fetchDepositAddress(code, params = {}) {
2313
2313
  /**
@@ -2599,14 +2599,16 @@ class digifinex extends digifinex$1 {
2599
2599
  // }
2600
2600
  //
2601
2601
  const type = this.parseLedgerEntryType(this.safeString2(item, 'type', 'finance_type'));
2602
- const code = this.safeCurrencyCode(this.safeString2(item, 'currency_mark', 'currency'), currency);
2602
+ const currencyId = this.safeString2(item, 'currency_mark', 'currency');
2603
+ const code = this.safeCurrencyCode(currencyId, currency);
2604
+ currency = this.safeCurrency(currencyId, currency);
2603
2605
  const amount = this.safeNumber2(item, 'num', 'change');
2604
2606
  const after = this.safeNumber(item, 'balance');
2605
2607
  let timestamp = this.safeTimestamp(item, 'time');
2606
2608
  if (timestamp === undefined) {
2607
2609
  timestamp = this.safeInteger(item, 'timestamp');
2608
2610
  }
2609
- return {
2611
+ return this.safeLedgerEntry({
2610
2612
  'info': item,
2611
2613
  'id': undefined,
2612
2614
  'direction': undefined,
@@ -2622,18 +2624,18 @@ class digifinex extends digifinex$1 {
2622
2624
  'timestamp': timestamp,
2623
2625
  'datetime': this.iso8601(timestamp),
2624
2626
  'fee': undefined,
2625
- };
2627
+ }, currency);
2626
2628
  }
2627
2629
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
2628
2630
  /**
2629
2631
  * @method
2630
2632
  * @name digifinex#fetchLedger
2631
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
2633
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2632
2634
  * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#spot-margin-otc-financial-logs
2633
2635
  * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#bills
2634
- * @param {string} code unified currency code, default is undefined
2636
+ * @param {string} [code] unified currency code, default is undefined
2635
2637
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2636
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
2638
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
2637
2639
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2638
2640
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
2639
2641
  */
@@ -6627,12 +6627,12 @@ class gate extends gate$1 {
6627
6627
  * @see https://www.gate.io/docs/developers/apiv4/en/#query-account-book-2
6628
6628
  * @see https://www.gate.io/docs/developers/apiv4/en/#query-account-book-3
6629
6629
  * @see https://www.gate.io/docs/developers/apiv4/en/#list-account-changing-history
6630
- * @param {string} code unified currency code
6630
+ * @param {string} [code] unified currency code
6631
6631
  * @param {int} [since] timestamp in ms of the earliest ledger entry
6632
6632
  * @param {int} [limit] max number of ledger entries to return
6633
6633
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6634
6634
  * @param {int} [params.until] end time in ms
6635
- * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
6635
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
6636
6636
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
6637
6637
  */
6638
6638
  await this.loadMarkets();
@@ -6789,6 +6789,7 @@ class gate extends gate$1 {
6789
6789
  direction = 'in';
6790
6790
  }
6791
6791
  const currencyId = this.safeString(item, 'currency');
6792
+ currency = this.safeCurrency(currencyId, currency);
6792
6793
  const type = this.safeString(item, 'type');
6793
6794
  const rawTimestamp = this.safeString(item, 'time');
6794
6795
  let timestamp = undefined;
@@ -6801,7 +6802,8 @@ class gate extends gate$1 {
6801
6802
  const balanceString = this.safeString(item, 'balance');
6802
6803
  const changeString = this.safeString(item, 'change');
6803
6804
  const before = this.parseNumber(Precise["default"].stringSub(balanceString, changeString));
6804
- return {
6805
+ return this.safeLedgerEntry({
6806
+ 'info': item,
6805
6807
  'id': this.safeString(item, 'id'),
6806
6808
  'direction': direction,
6807
6809
  'account': undefined,
@@ -6816,8 +6818,7 @@ class gate extends gate$1 {
6816
6818
  'after': this.safeNumber(item, 'balance'),
6817
6819
  'status': undefined,
6818
6820
  'fee': undefined,
6819
- 'info': item,
6820
- };
6821
+ }, currency);
6821
6822
  }
6822
6823
  parseLedgerEntryType(type) {
6823
6824
  const ledgerType = {
@@ -2227,11 +2227,11 @@ class hashkey extends hashkey$1 {
2227
2227
  /**
2228
2228
  * @method
2229
2229
  * @name hashkey#fetchLedger
2230
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
2230
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2231
2231
  * @see https://hashkeyglobal-apidoc.readme.io/reference/get-account-transaction-list
2232
- * @param {string} code unified currency code, default is undefined (not used)
2232
+ * @param {string} [code] unified currency code, default is undefined (not used)
2233
2233
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2234
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
2234
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
2235
2235
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2236
2236
  * @param {int} [params.until] the latest time in ms to fetch entries for
2237
2237
  * @param {int} [params.flowType] trade, fee, transfer, deposit, withdrawal
@@ -2316,7 +2316,9 @@ class hashkey extends hashkey$1 {
2316
2316
  const account = this.safeString(item, 'accountId');
2317
2317
  const timestamp = this.safeInteger(item, 'created');
2318
2318
  const type = this.parseLedgerEntryType(this.safeString(item, 'flowTypeValue'));
2319
- const code = this.safeCurrencyCode(this.safeString(item, 'coin'), currency);
2319
+ const currencyId = this.safeString(item, 'coin');
2320
+ const code = this.safeCurrencyCode(currencyId, currency);
2321
+ currency = this.safeCurrency(currencyId, currency);
2320
2322
  const amountString = this.safeString(item, 'change');
2321
2323
  const amount = this.parseNumber(amountString);
2322
2324
  let direction = 'in';
@@ -2326,9 +2328,9 @@ class hashkey extends hashkey$1 {
2326
2328
  const afterString = this.safeString(item, 'total');
2327
2329
  const after = this.parseNumber(afterString);
2328
2330
  const status = 'ok';
2329
- return {
2330
- 'id': id,
2331
+ return this.safeLedgerEntry({
2331
2332
  'info': item,
2333
+ 'id': id,
2332
2334
  'timestamp': timestamp,
2333
2335
  'datetime': this.iso8601(timestamp),
2334
2336
  'account': account,
@@ -2343,7 +2345,7 @@ class hashkey extends hashkey$1 {
2343
2345
  'after': after,
2344
2346
  'status': status,
2345
2347
  'fee': undefined,
2346
- };
2348
+ }, currency);
2347
2349
  }
2348
2350
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
2349
2351
  /**
@@ -8103,46 +8103,43 @@ class htx extends htx$1 {
8103
8103
  // "transferee": 13496526
8104
8104
  // }
8105
8105
  //
8106
- const id = this.safeString(item, 'transactId');
8107
8106
  const currencyId = this.safeString(item, 'currency');
8108
8107
  const code = this.safeCurrencyCode(currencyId, currency);
8109
- const amount = this.safeNumber(item, 'transactAmt');
8108
+ currency = this.safeCurrency(currencyId, currency);
8109
+ const id = this.safeString(item, 'transactId');
8110
8110
  const transferType = this.safeString(item, 'transferType');
8111
- const type = this.parseLedgerEntryType(transferType);
8112
- const direction = this.safeString(item, 'direction');
8113
8111
  const timestamp = this.safeInteger(item, 'transactTime');
8114
- const datetime = this.iso8601(timestamp);
8115
8112
  const account = this.safeString(item, 'accountId');
8116
- return {
8113
+ return this.safeLedgerEntry({
8114
+ 'info': item,
8117
8115
  'id': id,
8118
- 'direction': direction,
8116
+ 'direction': this.safeString(item, 'direction'),
8119
8117
  'account': account,
8120
8118
  'referenceId': id,
8121
8119
  'referenceAccount': account,
8122
- 'type': type,
8120
+ 'type': this.parseLedgerEntryType(transferType),
8123
8121
  'currency': code,
8124
- 'amount': amount,
8122
+ 'amount': this.safeNumber(item, 'transactAmt'),
8125
8123
  'timestamp': timestamp,
8126
- 'datetime': datetime,
8124
+ 'datetime': this.iso8601(timestamp),
8127
8125
  'before': undefined,
8128
8126
  'after': undefined,
8129
8127
  'status': undefined,
8130
8128
  'fee': undefined,
8131
- 'info': item,
8132
- };
8129
+ }, currency);
8133
8130
  }
8134
8131
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
8135
8132
  /**
8136
8133
  * @method
8137
8134
  * @name htx#fetchLedger
8135
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
8138
8136
  * @see https://huobiapi.github.io/docs/spot/v1/en/#get-account-history
8139
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
8140
- * @param {string} code unified currency code, default is undefined
8137
+ * @param {string} [code] unified currency code, default is undefined
8141
8138
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
8142
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
8139
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
8143
8140
  * @param {object} [params] extra parameters specific to the exchange API endpoint
8144
8141
  * @param {int} [params.until] the latest time in ms to fetch entries for
8145
- * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
8142
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
8146
8143
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
8147
8144
  */
8148
8145
  await this.loadMarkets();