ccxt 4.4.2 → 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 (137) 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 +49 -22
  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/bitmart.js +3 -1
  13. package/dist/cjs/src/bitmex.js +11 -10
  14. package/dist/cjs/src/bitso.js +5 -4
  15. package/dist/cjs/src/bitstamp.js +33 -45
  16. package/dist/cjs/src/blofin.js +21 -23
  17. package/dist/cjs/src/bybit.js +22 -20
  18. package/dist/cjs/src/coinbase.js +28 -7
  19. package/dist/cjs/src/coinbaseexchange.js +11 -11
  20. package/dist/cjs/src/coinlist.js +6 -5
  21. package/dist/cjs/src/coinmetro.js +3 -3
  22. package/dist/cjs/src/cryptocom.js +9 -6
  23. package/dist/cjs/src/currencycom.js +6 -6
  24. package/dist/cjs/src/delta.js +5 -5
  25. package/dist/cjs/src/digifinex.js +8 -6
  26. package/dist/cjs/src/gate.js +6 -5
  27. package/dist/cjs/src/hashkey.js +9 -7
  28. package/dist/cjs/src/htx.js +13 -16
  29. package/dist/cjs/src/hyperliquid.js +67 -114
  30. package/dist/cjs/src/kraken.js +8 -6
  31. package/dist/cjs/src/kucoin.js +9 -8
  32. package/dist/cjs/src/luno.js +10 -9
  33. package/dist/cjs/src/mexc.js +54 -2
  34. package/dist/cjs/src/ndax.js +6 -5
  35. package/dist/cjs/src/okcoin.js +18 -27
  36. package/dist/cjs/src/okx.js +18 -26
  37. package/dist/cjs/src/p2b.js +2 -2
  38. package/dist/cjs/src/pro/bybit.js +56 -0
  39. package/dist/cjs/src/pro/cryptocom.js +191 -21
  40. package/dist/cjs/src/pro/mexc.js +165 -3
  41. package/dist/cjs/src/pro/okx.js +6 -3
  42. package/dist/cjs/src/pro/oxfun.js +75 -0
  43. package/dist/cjs/src/pro/phemex.js +45 -1
  44. package/dist/cjs/src/pro/woofipro.js +67 -0
  45. package/dist/cjs/src/woo.js +7 -6
  46. package/dist/cjs/src/woofipro.js +8 -6
  47. package/dist/cjs/src/xt.js +10 -4
  48. package/dist/cjs/src/zonda.js +6 -5
  49. package/js/ccxt.d.ts +1 -1
  50. package/js/ccxt.js +1 -1
  51. package/js/src/abstract/bitmart.d.ts +1 -0
  52. package/js/src/base/Exchange.d.ts +2 -2
  53. package/js/src/base/Exchange.js +2 -2
  54. package/js/src/base/functions/misc.d.ts +2 -1
  55. package/js/src/base/functions/misc.js +11 -1
  56. package/js/src/base/types.d.ts +1 -1
  57. package/js/src/base/ws/WsClient.js +2 -2
  58. package/js/src/binance.d.ts +4 -20
  59. package/js/src/binance.js +49 -22
  60. package/js/src/bingx.js +1 -0
  61. package/js/src/bitfinex2.d.ts +3 -19
  62. package/js/src/bitfinex2.js +7 -6
  63. package/js/src/bitget.d.ts +3 -19
  64. package/js/src/bitget.js +10 -6
  65. package/js/src/bitmart.js +3 -1
  66. package/js/src/bitmex.d.ts +3 -22
  67. package/js/src/bitmex.js +11 -10
  68. package/js/src/bitso.d.ts +3 -19
  69. package/js/src/bitso.js +5 -4
  70. package/js/src/bitstamp.d.ts +3 -35
  71. package/js/src/bitstamp.js +33 -45
  72. package/js/src/blofin.d.ts +3 -15
  73. package/js/src/blofin.js +21 -23
  74. package/js/src/bybit.d.ts +3 -19
  75. package/js/src/bybit.js +23 -21
  76. package/js/src/coinbase.d.ts +3 -19
  77. package/js/src/coinbase.js +28 -7
  78. package/js/src/coinbaseexchange.d.ts +3 -19
  79. package/js/src/coinbaseexchange.js +11 -11
  80. package/js/src/coinlist.d.ts +3 -19
  81. package/js/src/coinlist.js +6 -5
  82. package/js/src/coinmetro.d.ts +3 -19
  83. package/js/src/coinmetro.js +3 -3
  84. package/js/src/cryptocom.d.ts +3 -22
  85. package/js/src/cryptocom.js +9 -6
  86. package/js/src/currencycom.d.ts +3 -3
  87. package/js/src/currencycom.js +6 -6
  88. package/js/src/delta.d.ts +3 -19
  89. package/js/src/delta.js +5 -5
  90. package/js/src/digifinex.d.ts +3 -19
  91. package/js/src/digifinex.js +8 -6
  92. package/js/src/gate.d.ts +3 -19
  93. package/js/src/gate.js +6 -5
  94. package/js/src/hashkey.d.ts +3 -20
  95. package/js/src/hashkey.js +9 -7
  96. package/js/src/htx.d.ts +3 -19
  97. package/js/src/htx.js +13 -16
  98. package/js/src/hyperliquid.d.ts +3 -19
  99. package/js/src/hyperliquid.js +68 -115
  100. package/js/src/kraken.d.ts +5 -24
  101. package/js/src/kraken.js +8 -6
  102. package/js/src/kucoin.d.ts +3 -19
  103. package/js/src/kucoin.js +9 -8
  104. package/js/src/luno.d.ts +4 -20
  105. package/js/src/luno.js +10 -9
  106. package/js/src/mexc.js +54 -2
  107. package/js/src/ndax.d.ts +3 -19
  108. package/js/src/ndax.js +6 -5
  109. package/js/src/okcoin.d.ts +3 -19
  110. package/js/src/okcoin.js +18 -27
  111. package/js/src/okx.d.ts +3 -19
  112. package/js/src/okx.js +18 -26
  113. package/js/src/p2b.js +2 -2
  114. package/js/src/pro/bybit.d.ts +2 -0
  115. package/js/src/pro/bybit.js +56 -0
  116. package/js/src/pro/cryptocom.d.ts +7 -1
  117. package/js/src/pro/cryptocom.js +191 -21
  118. package/js/src/pro/mexc.d.ts +6 -1
  119. package/js/src/pro/mexc.js +166 -4
  120. package/js/src/pro/okx.js +6 -3
  121. package/js/src/pro/oxfun.d.ts +3 -0
  122. package/js/src/pro/oxfun.js +75 -0
  123. package/js/src/pro/phemex.d.ts +2 -1
  124. package/js/src/pro/phemex.js +45 -1
  125. package/js/src/pro/woofipro.d.ts +3 -0
  126. package/js/src/pro/woofipro.js +67 -0
  127. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  128. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +1 -1
  129. package/js/src/woo.d.ts +3 -19
  130. package/js/src/woo.js +7 -6
  131. package/js/src/woofipro.d.ts +3 -19
  132. package/js/src/woofipro.js +8 -6
  133. package/js/src/xt.d.ts +3 -22
  134. package/js/src/xt.js +10 -4
  135. package/js/src/zonda.d.ts +3 -19
  136. package/js/src/zonda.js +6 -5
  137. package/package.json +1 -1
@@ -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[]>;