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
@@ -987,11 +987,11 @@ export default class coinmetro extends Exchange {
987
987
  /**
988
988
  * @method
989
989
  * @name coinmetro#fetchLedger
990
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
990
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
991
991
  * @see https://documenter.getpostman.com/view/3653795/SVfWN6KS#4e7831f7-a0e7-4c3e-9336-1d0e5dcb15cf
992
- * @param {string} code unified currency code, default is undefined
992
+ * @param {string} [code] unified currency code, default is undefined
993
993
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
994
- * @param {int} [limit] max number of ledger entrys to return (default 200, max 500)
994
+ * @param {int} [limit] max number of ledger entries to return (default 200, max 500)
995
995
  * @param {object} [params] extra parameters specific to the exchange API endpoint
996
996
  * @param {int} [params.until] the latest time in ms to fetch entries for
997
997
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/cryptocom.js';
2
- import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, Str, Ticker, OrderRequest, Balances, Transaction, OrderBook, Tickers, Strings, Currency, Market, Num, Account, CancellationRequest, Dict, int, TradingFeeInterface, TradingFees } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, Str, Ticker, OrderRequest, Balances, Transaction, OrderBook, Tickers, Strings, Currency, Market, Num, Account, CancellationRequest, Dict, int, TradingFeeInterface, TradingFees, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class cryptocom
5
5
  * @augments Exchange
@@ -44,27 +44,8 @@ export default class cryptocom extends Exchange {
44
44
  customHandleMarginModeAndParams(methodName: any, params?: {}): any[];
45
45
  parseDepositWithdrawFee(fee: any, currency?: Currency): Dict;
46
46
  fetchDepositWithdrawFees(codes?: Strings, params?: {}): Promise<any>;
47
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
48
- parseLedgerEntry(item: Dict, currency?: Currency): {
49
- id: string;
50
- direction: any;
51
- account: string;
52
- referenceId: string;
53
- referenceAccount: string;
54
- type: string;
55
- currency: string;
56
- amount: number;
57
- timestamp: number;
58
- datetime: string;
59
- before: any;
60
- after: any;
61
- status: any;
62
- fee: {
63
- currency: any;
64
- cost: any;
65
- };
66
- info: Dict;
67
- };
47
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
48
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
68
49
  parseLedgerEntryType(type: any): string;
69
50
  fetchAccounts(params?: {}): Promise<Account[]>;
70
51
  parseAccount(account: any): {
@@ -2396,7 +2396,7 @@ export default class cryptocom extends Exchange {
2396
2396
  * @name cryptocom#fetchLedger
2397
2397
  * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2398
2398
  * @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-transactions
2399
- * @param {string} code unified currency code
2399
+ * @param {string} [code] unified currency code
2400
2400
  * @param {int} [since] timestamp in ms of the earliest ledger entry
2401
2401
  * @param {int} [limit] max number of ledger entries to return
2402
2402
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2477,6 +2477,8 @@ export default class cryptocom extends Exchange {
2477
2477
  //
2478
2478
  const timestamp = this.safeInteger(item, 'event_timestamp_ms');
2479
2479
  const currencyId = this.safeString(item, 'instrument_name');
2480
+ const code = this.safeCurrencyCode(currencyId, currency);
2481
+ currency = this.safeCurrency(currencyId, currency);
2480
2482
  let amount = this.safeString(item, 'transaction_qty');
2481
2483
  let direction = undefined;
2482
2484
  if (Precise.stringLt(amount, '0')) {
@@ -2486,14 +2488,15 @@ export default class cryptocom extends Exchange {
2486
2488
  else {
2487
2489
  direction = 'in';
2488
2490
  }
2489
- return {
2491
+ return this.safeLedgerEntry({
2492
+ 'info': item,
2490
2493
  'id': this.safeString(item, 'order_id'),
2491
2494
  'direction': direction,
2492
2495
  'account': this.safeString(item, 'account_id'),
2493
2496
  'referenceId': this.safeString(item, 'trade_id'),
2494
2497
  'referenceAccount': this.safeString(item, 'trade_match_id'),
2495
2498
  'type': this.parseLedgerEntryType(this.safeString(item, 'journal_type')),
2496
- 'currency': this.safeCurrencyCode(currencyId, currency),
2499
+ 'currency': code,
2497
2500
  'amount': this.parseNumber(amount),
2498
2501
  'timestamp': timestamp,
2499
2502
  'datetime': this.iso8601(timestamp),
@@ -2504,8 +2507,7 @@ export default class cryptocom extends Exchange {
2504
2507
  'currency': undefined,
2505
2508
  'cost': undefined,
2506
2509
  },
2507
- 'info': item,
2508
- };
2510
+ }, currency);
2509
2511
  }
2510
2512
  parseLedgerEntryType(type) {
2511
2513
  const ledgerType = {
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/currencycom.js';
2
- import type { Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, Leverage, Num, Account, Currencies, TradingFees, Dict, int } from './base/types.js';
2
+ import type { Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, Leverage, Num, Account, Currencies, TradingFees, Dict, int, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class currencycom
5
5
  * @augments Exchange
@@ -39,8 +39,8 @@ export default class currencycom extends Exchange {
39
39
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
40
40
  parseTransactionStatus(status: Str): string;
41
41
  parseTransactionType(type: any): string;
42
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
43
- parseLedgerEntry(item: Dict, currency?: Currency): Dict;
42
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
43
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
44
44
  parseLedgerEntryStatus(status: any): string;
45
45
  parseLedgerEntryType(type: any): string;
46
46
  fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
@@ -1695,11 +1695,11 @@ export default class currencycom extends Exchange {
1695
1695
  /**
1696
1696
  * @method
1697
1697
  * @name currencycom#fetchLedger
1698
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
1698
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
1699
1699
  * @see https://apitradedoc.currency.com/swagger-ui.html#/rest-api/getLedgerUsingGET
1700
- * @param {string} code unified currency code, default is undefined
1700
+ * @param {string} [code] unified currency code, default is undefined
1701
1701
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
1702
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
1702
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
1703
1703
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1704
1704
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
1705
1705
  */
@@ -1752,13 +1752,14 @@ export default class currencycom extends Exchange {
1752
1752
  const timestamp = this.safeInteger(item, 'timestamp');
1753
1753
  const currencyId = this.safeString(item, 'currency');
1754
1754
  const code = this.safeCurrencyCode(currencyId, currency);
1755
+ currency = this.safeCurrency(currencyId, currency);
1755
1756
  const feeCost = this.safeString(item, 'commission');
1756
1757
  let fee = undefined;
1757
1758
  if (feeCost !== undefined) {
1758
1759
  fee = { 'currency': code, 'cost': feeCost };
1759
1760
  }
1760
1761
  const direction = Precise.stringLt(amountString, '0') ? 'out' : 'in';
1761
- const result = {
1762
+ return this.safeLedgerEntry({
1762
1763
  'id': id,
1763
1764
  'timestamp': timestamp,
1764
1765
  'datetime': this.iso8601(timestamp),
@@ -1774,8 +1775,7 @@ export default class currencycom extends Exchange {
1774
1775
  'status': this.parseLedgerEntryStatus(this.safeString(item, 'status')),
1775
1776
  'fee': fee,
1776
1777
  'info': item,
1777
- };
1778
- return result;
1778
+ }, currency);
1779
1779
  }
1780
1780
  parseLedgerEntryStatus(status) {
1781
1781
  const statuses = {
package/js/src/delta.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/delta.js';
2
- import type { Balances, Currency, Greeks, Int, Market, MarketInterface, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Position, Leverage, MarginMode, Num, Option, MarginModification, Currencies, Dict, int } from './base/types.js';
2
+ import type { Balances, Currency, Greeks, Int, Market, MarketInterface, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Position, Leverage, MarginMode, Num, Option, MarginModification, Currencies, Dict, int, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class delta
5
5
  * @augments Exchange
@@ -43,25 +43,9 @@ export default class delta extends Exchange {
43
43
  fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
44
44
  fetchOrdersWithMethod(method: any, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
45
45
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
46
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
46
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
47
47
  parseLedgerEntryType(type: any): string;
48
- parseLedgerEntry(item: Dict, currency?: Currency): {
49
- info: Dict;
50
- id: string;
51
- direction: any;
52
- account: any;
53
- referenceId: string;
54
- referenceAccount: any;
55
- type: string;
56
- currency: string;
57
- amount: number;
58
- before: number;
59
- after: number;
60
- status: string;
61
- timestamp: number;
62
- datetime: string;
63
- fee: any;
64
- };
48
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
65
49
  fetchDepositAddress(code: string, params?: {}): Promise<{
66
50
  currency: string;
67
51
  address: string;
package/js/src/delta.js CHANGED
@@ -2191,11 +2191,11 @@ export default class delta extends Exchange {
2191
2191
  /**
2192
2192
  * @method
2193
2193
  * @name delta#fetchLedger
2194
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
2194
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2195
2195
  * @see https://docs.delta.exchange/#get-wallet-transactions
2196
- * @param {string} code unified currency code, default is undefined
2196
+ * @param {string} [code] unified currency code, default is undefined
2197
2197
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2198
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
2198
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
2199
2199
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2200
2200
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
2201
2201
  */
@@ -2294,7 +2294,7 @@ export default class delta extends Exchange {
2294
2294
  const after = this.safeString(item, 'balance');
2295
2295
  const before = Precise.stringMax('0', Precise.stringSub(after, amount));
2296
2296
  const status = 'ok';
2297
- return {
2297
+ return this.safeLedgerEntry({
2298
2298
  'info': item,
2299
2299
  'id': id,
2300
2300
  'direction': direction,
@@ -2310,7 +2310,7 @@ export default class delta extends Exchange {
2310
2310
  'timestamp': timestamp,
2311
2311
  'datetime': this.iso8601(timestamp),
2312
2312
  'fee': undefined,
2313
- };
2313
+ }, currency);
2314
2314
  }
2315
2315
  async fetchDepositAddress(code, params = {}) {
2316
2316
  /**
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/digifinex.js';
2
- import type { FundingRateHistory, Int, OHLCV, Order, OrderSide, OrderType, OrderRequest, Trade, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Strings, Market, Currency, TransferEntry, Num, MarginModification, TradingFeeInterface, Currencies, CrossBorrowRate, CrossBorrowRates, Dict, LeverageTier, LeverageTiers, int } from './base/types.js';
2
+ import type { FundingRateHistory, Int, OHLCV, Order, OrderSide, OrderType, OrderRequest, Trade, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Strings, Market, Currency, TransferEntry, Num, MarginModification, TradingFeeInterface, Currencies, CrossBorrowRate, CrossBorrowRates, Dict, LeverageTier, LeverageTiers, int, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class digifinex
5
5
  * @augments Exchange
@@ -42,24 +42,8 @@ export default class digifinex extends Exchange {
42
42
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
43
43
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
44
44
  parseLedgerEntryType(type: any): string;
45
- parseLedgerEntry(item: Dict, currency?: Currency): {
46
- info: Dict;
47
- id: any;
48
- direction: any;
49
- account: any;
50
- referenceId: any;
51
- referenceAccount: any;
52
- type: string;
53
- currency: string;
54
- amount: number;
55
- before: any;
56
- after: number;
57
- status: any;
58
- timestamp: number;
59
- datetime: string;
60
- fee: any;
61
- };
62
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
45
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
46
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
63
47
  parseDepositAddress(depositAddress: any, currency?: Currency): {
64
48
  info: any;
65
49
  currency: string;
@@ -2602,14 +2602,16 @@ export default class digifinex extends Exchange {
2602
2602
  // }
2603
2603
  //
2604
2604
  const type = this.parseLedgerEntryType(this.safeString2(item, 'type', 'finance_type'));
2605
- const code = this.safeCurrencyCode(this.safeString2(item, 'currency_mark', 'currency'), currency);
2605
+ const currencyId = this.safeString2(item, 'currency_mark', 'currency');
2606
+ const code = this.safeCurrencyCode(currencyId, currency);
2607
+ currency = this.safeCurrency(currencyId, currency);
2606
2608
  const amount = this.safeNumber2(item, 'num', 'change');
2607
2609
  const after = this.safeNumber(item, 'balance');
2608
2610
  let timestamp = this.safeTimestamp(item, 'time');
2609
2611
  if (timestamp === undefined) {
2610
2612
  timestamp = this.safeInteger(item, 'timestamp');
2611
2613
  }
2612
- return {
2614
+ return this.safeLedgerEntry({
2613
2615
  'info': item,
2614
2616
  'id': undefined,
2615
2617
  'direction': undefined,
@@ -2625,18 +2627,18 @@ export default class digifinex extends Exchange {
2625
2627
  'timestamp': timestamp,
2626
2628
  'datetime': this.iso8601(timestamp),
2627
2629
  'fee': undefined,
2628
- };
2630
+ }, currency);
2629
2631
  }
2630
2632
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
2631
2633
  /**
2632
2634
  * @method
2633
2635
  * @name digifinex#fetchLedger
2634
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
2636
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2635
2637
  * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#spot-margin-otc-financial-logs
2636
2638
  * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#bills
2637
- * @param {string} code unified currency code, default is undefined
2639
+ * @param {string} [code] unified currency code, default is undefined
2638
2640
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2639
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
2641
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
2640
2642
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2641
2643
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
2642
2644
  */
package/js/src/gate.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/gate.js';
2
- import type { Int, OrderSide, OrderType, OHLCV, Trade, FundingRateHistory, OpenInterest, Order, Balances, OrderRequest, FundingHistory, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Leverage, Leverages, Num, OptionChain, Option, MarginModification, TradingFeeInterface, Currencies, TradingFees, Position, Dict, LeverageTier, LeverageTiers, int, CancellationRequest } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, OHLCV, Trade, FundingRateHistory, OpenInterest, Order, Balances, OrderRequest, FundingHistory, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Leverage, Leverages, Num, OptionChain, Option, MarginModification, TradingFeeInterface, Currencies, TradingFees, Position, Dict, LeverageTier, LeverageTiers, int, CancellationRequest, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class gate
5
5
  * @augments Exchange
@@ -267,24 +267,8 @@ export default class gate extends Exchange {
267
267
  datetime: string;
268
268
  };
269
269
  parseSettlements(settlements: any, market: any): any[];
270
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
271
- parseLedgerEntry(item: Dict, currency?: Currency): {
272
- id: string;
273
- direction: any;
274
- account: any;
275
- referenceAccount: any;
276
- referenceId: any;
277
- type: string;
278
- currency: string;
279
- amount: number;
280
- timestamp: any;
281
- datetime: string;
282
- before: number;
283
- after: number;
284
- status: any;
285
- fee: any;
286
- info: Dict;
287
- };
270
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
271
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
288
272
  parseLedgerEntryType(type: any): string;
289
273
  setPositionMode(hedged: boolean, symbol?: Str, params?: {}): Promise<any>;
290
274
  fetchUnderlyingAssets(params?: {}): Promise<any[]>;
package/js/src/gate.js CHANGED
@@ -6630,12 +6630,12 @@ export default class gate extends Exchange {
6630
6630
  * @see https://www.gate.io/docs/developers/apiv4/en/#query-account-book-2
6631
6631
  * @see https://www.gate.io/docs/developers/apiv4/en/#query-account-book-3
6632
6632
  * @see https://www.gate.io/docs/developers/apiv4/en/#list-account-changing-history
6633
- * @param {string} code unified currency code
6633
+ * @param {string} [code] unified currency code
6634
6634
  * @param {int} [since] timestamp in ms of the earliest ledger entry
6635
6635
  * @param {int} [limit] max number of ledger entries to return
6636
6636
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6637
6637
  * @param {int} [params.until] end time in ms
6638
- * @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)
6638
+ * @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)
6639
6639
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
6640
6640
  */
6641
6641
  await this.loadMarkets();
@@ -6792,6 +6792,7 @@ export default class gate extends Exchange {
6792
6792
  direction = 'in';
6793
6793
  }
6794
6794
  const currencyId = this.safeString(item, 'currency');
6795
+ currency = this.safeCurrency(currencyId, currency);
6795
6796
  const type = this.safeString(item, 'type');
6796
6797
  const rawTimestamp = this.safeString(item, 'time');
6797
6798
  let timestamp = undefined;
@@ -6804,7 +6805,8 @@ export default class gate extends Exchange {
6804
6805
  const balanceString = this.safeString(item, 'balance');
6805
6806
  const changeString = this.safeString(item, 'change');
6806
6807
  const before = this.parseNumber(Precise.stringSub(balanceString, changeString));
6807
- return {
6808
+ return this.safeLedgerEntry({
6809
+ 'info': item,
6808
6810
  'id': this.safeString(item, 'id'),
6809
6811
  'direction': direction,
6810
6812
  'account': undefined,
@@ -6819,8 +6821,7 @@ export default class gate extends Exchange {
6819
6821
  'after': this.safeNumber(item, 'balance'),
6820
6822
  'status': undefined,
6821
6823
  'fee': undefined,
6822
- 'info': item,
6823
- };
6824
+ }, currency);
6824
6825
  }
6825
6826
  parseLedgerEntryType(type) {
6826
6827
  const ledgerType = {
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/hashkey.js';
2
- import type { Account, Balances, Currencies, Currency, Dict, FundingRateHistory, LastPrice, LastPrices, Leverage, LeverageTier, LeverageTiers, Int, Market, Num, OHLCV, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry } from './base/types.js';
2
+ import type { Account, Balances, Currencies, Currency, Dict, FundingRateHistory, LastPrice, LastPrices, Leverage, LeverageTier, LeverageTiers, Int, Market, Num, OHLCV, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class hashkey
5
5
  * @augments Exchange
@@ -73,26 +73,9 @@ export default class hashkey extends Exchange {
73
73
  parseAccountType(type: any): string;
74
74
  encodeAccountType(type: any): number;
75
75
  encodeFlowType(type: any): number;
76
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
76
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
77
77
  parseLedgerEntryType(type: any): string;
78
- parseLedgerEntry(item: Dict, currency?: Currency): {
79
- id: string;
80
- info: Dict;
81
- timestamp: number;
82
- datetime: string;
83
- account: string;
84
- direction: string;
85
- referenceId: any;
86
- referenceAccount: any;
87
- type: string;
88
- currency: string;
89
- symbol: any;
90
- amount: number;
91
- before: any;
92
- after: number;
93
- status: string;
94
- fee: any;
95
- };
78
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
96
79
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
97
80
  createMarketBuyOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>;
98
81
  createSpotOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
package/js/src/hashkey.js CHANGED
@@ -2230,11 +2230,11 @@ export default class hashkey extends Exchange {
2230
2230
  /**
2231
2231
  * @method
2232
2232
  * @name hashkey#fetchLedger
2233
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
2233
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2234
2234
  * @see https://hashkeyglobal-apidoc.readme.io/reference/get-account-transaction-list
2235
- * @param {string} code unified currency code, default is undefined (not used)
2235
+ * @param {string} [code] unified currency code, default is undefined (not used)
2236
2236
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2237
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
2237
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
2238
2238
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2239
2239
  * @param {int} [params.until] the latest time in ms to fetch entries for
2240
2240
  * @param {int} [params.flowType] trade, fee, transfer, deposit, withdrawal
@@ -2319,7 +2319,9 @@ export default class hashkey extends Exchange {
2319
2319
  const account = this.safeString(item, 'accountId');
2320
2320
  const timestamp = this.safeInteger(item, 'created');
2321
2321
  const type = this.parseLedgerEntryType(this.safeString(item, 'flowTypeValue'));
2322
- const code = this.safeCurrencyCode(this.safeString(item, 'coin'), currency);
2322
+ const currencyId = this.safeString(item, 'coin');
2323
+ const code = this.safeCurrencyCode(currencyId, currency);
2324
+ currency = this.safeCurrency(currencyId, currency);
2323
2325
  const amountString = this.safeString(item, 'change');
2324
2326
  const amount = this.parseNumber(amountString);
2325
2327
  let direction = 'in';
@@ -2329,9 +2331,9 @@ export default class hashkey extends Exchange {
2329
2331
  const afterString = this.safeString(item, 'total');
2330
2332
  const after = this.parseNumber(afterString);
2331
2333
  const status = 'ok';
2332
- return {
2333
- 'id': id,
2334
+ return this.safeLedgerEntry({
2334
2335
  'info': item,
2336
+ 'id': id,
2335
2337
  'timestamp': timestamp,
2336
2338
  'datetime': this.iso8601(timestamp),
2337
2339
  'account': account,
@@ -2346,7 +2348,7 @@ export default class hashkey extends Exchange {
2346
2348
  'after': after,
2347
2349
  'status': status,
2348
2350
  'fee': undefined,
2349
- };
2351
+ }, currency);
2350
2352
  }
2351
2353
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
2352
2354
  /**
package/js/src/htx.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/htx.js';
2
- import type { TransferEntry, Int, OrderSide, OrderType, Order, OHLCV, Trade, FundingRateHistory, Balances, Str, Dict, Transaction, Ticker, OrderBook, Tickers, OrderRequest, Strings, Market, Currency, Num, Account, TradingFeeInterface, Currencies, IsolatedBorrowRates, IsolatedBorrowRate, LeverageTiers, LeverageTier, int } from './base/types.js';
2
+ import type { TransferEntry, Int, OrderSide, OrderType, Order, OHLCV, Trade, FundingRateHistory, Balances, Str, Dict, Transaction, Ticker, OrderBook, Tickers, OrderRequest, Strings, Market, Currency, Num, Account, TradingFeeInterface, Currencies, IsolatedBorrowRates, IsolatedBorrowRate, LeverageTiers, LeverageTier, int, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class huobi
5
5
  * @augments Exchange
@@ -189,24 +189,8 @@ export default class htx extends Exchange {
189
189
  fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
190
190
  fetchPosition(symbol: string, params?: {}): Promise<import("./base/types.js").Position>;
191
191
  parseLedgerEntryType(type: any): string;
192
- parseLedgerEntry(item: Dict, currency?: Currency): {
193
- id: string;
194
- direction: string;
195
- account: string;
196
- referenceId: string;
197
- referenceAccount: string;
198
- type: string;
199
- currency: string;
200
- amount: number;
201
- timestamp: number;
202
- datetime: string;
203
- before: any;
204
- after: any;
205
- status: any;
206
- fee: any;
207
- info: Dict;
208
- };
209
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
192
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
193
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
210
194
  fetchLeverageTiers(symbols?: Strings, params?: {}): Promise<LeverageTiers>;
211
195
  fetchMarketLeverageTiers(symbol: string, params?: {}): Promise<LeverageTier[]>;
212
196
  parseLeverageTiers(response: any, symbols?: Strings, marketIdKey?: any): Dict;
package/js/src/htx.js CHANGED
@@ -8106,46 +8106,43 @@ export default class htx extends Exchange {
8106
8106
  // "transferee": 13496526
8107
8107
  // }
8108
8108
  //
8109
- const id = this.safeString(item, 'transactId');
8110
8109
  const currencyId = this.safeString(item, 'currency');
8111
8110
  const code = this.safeCurrencyCode(currencyId, currency);
8112
- const amount = this.safeNumber(item, 'transactAmt');
8111
+ currency = this.safeCurrency(currencyId, currency);
8112
+ const id = this.safeString(item, 'transactId');
8113
8113
  const transferType = this.safeString(item, 'transferType');
8114
- const type = this.parseLedgerEntryType(transferType);
8115
- const direction = this.safeString(item, 'direction');
8116
8114
  const timestamp = this.safeInteger(item, 'transactTime');
8117
- const datetime = this.iso8601(timestamp);
8118
8115
  const account = this.safeString(item, 'accountId');
8119
- return {
8116
+ return this.safeLedgerEntry({
8117
+ 'info': item,
8120
8118
  'id': id,
8121
- 'direction': direction,
8119
+ 'direction': this.safeString(item, 'direction'),
8122
8120
  'account': account,
8123
8121
  'referenceId': id,
8124
8122
  'referenceAccount': account,
8125
- 'type': type,
8123
+ 'type': this.parseLedgerEntryType(transferType),
8126
8124
  'currency': code,
8127
- 'amount': amount,
8125
+ 'amount': this.safeNumber(item, 'transactAmt'),
8128
8126
  'timestamp': timestamp,
8129
- 'datetime': datetime,
8127
+ 'datetime': this.iso8601(timestamp),
8130
8128
  'before': undefined,
8131
8129
  'after': undefined,
8132
8130
  'status': undefined,
8133
8131
  'fee': undefined,
8134
- 'info': item,
8135
- };
8132
+ }, currency);
8136
8133
  }
8137
8134
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
8138
8135
  /**
8139
8136
  * @method
8140
8137
  * @name htx#fetchLedger
8138
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
8141
8139
  * @see https://huobiapi.github.io/docs/spot/v1/en/#get-account-history
8142
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
8143
- * @param {string} code unified currency code, default is undefined
8140
+ * @param {string} [code] unified currency code, default is undefined
8144
8141
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
8145
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
8142
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
8146
8143
  * @param {object} [params] extra parameters specific to the exchange API endpoint
8147
8144
  * @param {int} [params.until] the latest time in ms to fetch entries for
8148
- * @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)
8145
+ * @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)
8149
8146
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
8150
8147
  */
8151
8148
  await this.loadMarkets();
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/hyperliquid.js';
2
- import type { Market, TransferEntry, Balances, Int, OrderBook, OHLCV, Str, FundingRateHistory, Order, OrderType, OrderSide, Trade, Strings, Position, OrderRequest, Dict, Num, MarginModification, Currencies, CancellationRequest, int, Transaction, Currency, TradingFeeInterface, Ticker, Tickers } from './base/types.js';
2
+ import type { Market, TransferEntry, Balances, Int, OrderBook, OHLCV, Str, FundingRateHistory, Order, OrderType, OrderSide, Trade, Strings, Position, OrderRequest, Dict, Num, MarginModification, Currencies, CancellationRequest, int, Transaction, Currency, TradingFeeInterface, Ticker, Tickers, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class hyperliquid
5
5
  * @augments Exchange
@@ -88,24 +88,8 @@ export default class hyperliquid extends Exchange {
88
88
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
89
89
  fetchTradingFee(symbol: string, params?: {}): Promise<TradingFeeInterface>;
90
90
  parseTradingFee(fee: Dict, market?: Market): TradingFeeInterface;
91
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
92
- parseLedgerEntry(item: Dict, currency?: Currency): {
93
- id: string;
94
- direction: any;
95
- account: any;
96
- referenceAccount: string;
97
- referenceId: string;
98
- type: string;
99
- currency: any;
100
- amount: number;
101
- timestamp: number;
102
- datetime: string;
103
- before: any;
104
- after: any;
105
- status: any;
106
- fee: any;
107
- info: Dict;
108
- };
91
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
92
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
109
93
  parseLedgerEntryType(type: any): string;
110
94
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
111
95
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;