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
@@ -6,7 +6,7 @@
6
6
 
7
7
  // ---------------------------------------------------------------------------
8
8
  import mexcRest from '../mexc.js';
9
- import { AuthenticationError } from '../base/errors.js';
9
+ import { ArgumentsRequired, AuthenticationError, NotSupported } from '../base/errors.js';
10
10
  import { ArrayCache, ArrayCacheBySymbolById, ArrayCacheByTimestamp } from '../base/ws/Cache.js';
11
11
  import { sha256 } from '../static_dependencies/noble-hashes/sha256.js';
12
12
  // ---------------------------------------------------------------------------
@@ -31,6 +31,7 @@ export default class mexc extends mexcRest {
31
31
  'watchOrders': true,
32
32
  'watchTicker': true,
33
33
  'watchTickers': true,
34
+ 'watchBidsAsks': true,
34
35
  'watchTrades': true,
35
36
  'watchTradesForSymbols': false,
36
37
  },
@@ -110,6 +111,7 @@ export default class mexc extends mexcRest {
110
111
  // "t": 1678643605721
111
112
  // }
112
113
  //
114
+ this.handleBidAsk(client, message);
113
115
  const rawTicker = this.safeValue2(message, 'd', 'data');
114
116
  const marketId = this.safeString2(message, 's', 'symbol');
115
117
  const timestamp = this.safeInteger(message, 't');
@@ -238,6 +240,87 @@ export default class mexc extends mexcRest {
238
240
  'info': ticker,
239
241
  }, market);
240
242
  }
243
+ async watchBidsAsks(symbols = undefined, params = {}) {
244
+ /**
245
+ * @method
246
+ * @name mexc#watchBidsAsks
247
+ * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#individual-symbol-book-ticker-streams
248
+ * @description watches best bid & ask for symbols
249
+ * @param {string[]} symbols unified symbol of the market to fetch the ticker for
250
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
251
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
252
+ */
253
+ await this.loadMarkets();
254
+ symbols = this.marketSymbols(symbols, undefined, true, false, true);
255
+ let marketType = undefined;
256
+ if (symbols === undefined) {
257
+ throw new ArgumentsRequired(this.id + 'watchBidsAsks required symbols argument');
258
+ }
259
+ const markets = this.marketsForSymbols(symbols);
260
+ [marketType, params] = this.handleMarketTypeAndParams('watchBidsAsks', markets[0], params);
261
+ const isSpot = marketType === 'spot';
262
+ if (!isSpot) {
263
+ throw new NotSupported(this.id + 'watchBidsAsks only support spot market');
264
+ }
265
+ const messageHashes = [];
266
+ const topics = [];
267
+ for (let i = 0; i < symbols.length; i++) {
268
+ if (isSpot) {
269
+ const market = this.market(symbols[i]);
270
+ topics.push('spot@public.bookTicker.v3.api@' + market['id']);
271
+ }
272
+ messageHashes.push('bidask:' + symbols[i]);
273
+ }
274
+ const url = this.urls['api']['ws']['spot'];
275
+ const request = {
276
+ 'method': 'SUBSCRIPTION',
277
+ 'params': topics,
278
+ };
279
+ const ticker = await this.watchMultiple(url, messageHashes, this.extend(request, params), messageHashes);
280
+ if (this.newUpdates) {
281
+ const tickers = {};
282
+ tickers[ticker['symbol']] = ticker;
283
+ return tickers;
284
+ }
285
+ return this.filterByArray(this.bidsasks, 'symbol', symbols);
286
+ }
287
+ handleBidAsk(client, message) {
288
+ //
289
+ // {
290
+ // "c": "spot@public.bookTicker.v3.api@BTCUSDT",
291
+ // "d": {
292
+ // "A": "4.70432",
293
+ // "B": "6.714863",
294
+ // "a": "20744.54",
295
+ // "b": "20744.17"
296
+ // },
297
+ // "s": "BTCUSDT",
298
+ // "t": 1678643605721
299
+ // }
300
+ //
301
+ const parsedTicker = this.parseWsBidAsk(message);
302
+ const symbol = parsedTicker['symbol'];
303
+ this.bidsasks[symbol] = parsedTicker;
304
+ const messageHash = 'bidask:' + symbol;
305
+ client.resolve(parsedTicker, messageHash);
306
+ }
307
+ parseWsBidAsk(ticker, market = undefined) {
308
+ const data = this.safeDict(ticker, 'd');
309
+ const marketId = this.safeString(ticker, 's');
310
+ market = this.safeMarket(marketId, market);
311
+ const symbol = this.safeString(market, 'symbol');
312
+ const timestamp = this.safeInteger(ticker, 't');
313
+ return this.safeTicker({
314
+ 'symbol': symbol,
315
+ 'timestamp': timestamp,
316
+ 'datetime': this.iso8601(timestamp),
317
+ 'ask': this.safeNumber(data, 'a'),
318
+ 'askVolume': this.safeNumber(data, 'A'),
319
+ 'bid': this.safeNumber(data, 'b'),
320
+ 'bidVolume': this.safeNumber(data, 'B'),
321
+ 'info': ticker,
322
+ }, market);
323
+ }
241
324
  async watchSpotPublic(channel, messageHash, params = {}) {
242
325
  const url = this.urls['api']['ws']['spot'];
243
326
  const request = {
@@ -15,7 +15,7 @@ export declare class BigInteger {
15
15
  protected intValue(): number;
16
16
  protected byteValue(): number;
17
17
  protected shortValue(): number;
18
- protected signum(): 1 | 0 | -1;
18
+ protected signum(): 0 | 1 | -1;
19
19
  toByteArray(): number[];
20
20
  protected equals(a: BigInteger): boolean;
21
21
  protected min(a: BigInteger): BigInteger;
@@ -1,5 +1,5 @@
1
1
  import { Abi, FunctionAbi, RawArgs } from '../../../types/index.js';
2
2
  import { AbiParserInterface } from './interface.js';
3
3
  export declare function createAbiParser(abi: Abi): AbiParserInterface;
4
- export declare function getAbiVersion(abi: Abi): 1 | 0 | 2;
4
+ export declare function getAbiVersion(abi: Abi): 0 | 1 | 2;
5
5
  export declare function isNoConstructorValid(method: string, argsCalldata: RawArgs, abiMethod?: FunctionAbi): boolean;
package/js/src/woo.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/woo.js';
2
- import type { TransferEntry, Balances, Conversion, Currency, FundingRateHistory, Int, Market, MarginModification, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Dict, Strings, Trade, Transaction, Leverage, Account, Currencies, TradingFees, int, FundingHistory } from './base/types.js';
2
+ import type { TransferEntry, Balances, Conversion, Currency, FundingRateHistory, Int, Market, MarginModification, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Dict, Strings, Trade, Transaction, Leverage, Account, Currencies, TradingFees, int, FundingHistory, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class woo
5
5
  * @augments Exchange
@@ -61,24 +61,8 @@ export default class woo extends Exchange {
61
61
  info: any;
62
62
  }>;
63
63
  getAssetHistoryRows(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
64
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
65
- parseLedgerEntry(item: Dict, currency?: Currency): {
66
- id: string;
67
- currency: any;
68
- account: string;
69
- referenceAccount: any;
70
- referenceId: string;
71
- status: string;
72
- amount: number;
73
- before: any;
74
- after: any;
75
- fee: any;
76
- direction: string;
77
- timestamp: number;
78
- datetime: string;
79
- type: string;
80
- info: Dict;
81
- };
64
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
65
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
82
66
  parseLedgerEntryType(type: any): string;
83
67
  getCurrencyFromChaincode(networkizedCode: any, currency: any): any;
84
68
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
package/js/src/woo.js CHANGED
@@ -2144,9 +2144,9 @@ export default class woo extends Exchange {
2144
2144
  * @name woo#fetchLedger
2145
2145
  * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
2146
2146
  * @see https://docs.woo.org/#get-asset-history
2147
- * @param {string} code unified currency code, default is undefined
2147
+ * @param {string} [code] unified currency code, default is undefined
2148
2148
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2149
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
2149
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
2150
2150
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2151
2151
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
2152
2152
  */
@@ -2157,12 +2157,14 @@ export default class woo extends Exchange {
2157
2157
  const networkizedCode = this.safeString(item, 'token');
2158
2158
  const currencyDefined = this.getCurrencyFromChaincode(networkizedCode, currency);
2159
2159
  const code = currencyDefined['code'];
2160
+ currency = this.safeCurrency(code, currency);
2160
2161
  const amount = this.safeNumber(item, 'amount');
2161
2162
  const side = this.safeString(item, 'token_side');
2162
2163
  const direction = (side === 'DEPOSIT') ? 'in' : 'out';
2163
2164
  const timestamp = this.safeTimestamp(item, 'created_time');
2164
2165
  const fee = this.parseTokenAndFeeTemp(item, 'fee_token', 'fee_amount');
2165
- return {
2166
+ return this.safeLedgerEntry({
2167
+ 'info': item,
2166
2168
  'id': this.safeString(item, 'id'),
2167
2169
  'currency': code,
2168
2170
  'account': this.safeString(item, 'account'),
@@ -2172,13 +2174,12 @@ export default class woo extends Exchange {
2172
2174
  'amount': amount,
2173
2175
  'before': undefined,
2174
2176
  'after': undefined,
2175
- 'fee': fee,
2176
2177
  'direction': direction,
2177
2178
  'timestamp': timestamp,
2178
2179
  'datetime': this.iso8601(timestamp),
2179
2180
  'type': this.parseLedgerEntryType(this.safeString(item, 'type')),
2180
- 'info': item,
2181
- };
2181
+ 'fee': fee,
2182
+ }, currency);
2182
2183
  }
2183
2184
  parseLedgerEntryType(type) {
2184
2185
  const types = {
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/woofipro.js';
2
- import type { Balances, Currency, FundingRateHistory, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, Transaction, Leverage, Currencies, TradingFees, OrderRequest, Dict, int } from './base/types.js';
2
+ import type { Balances, Currency, FundingRateHistory, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, Transaction, Leverage, Currencies, TradingFees, OrderRequest, Dict, int, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class woofipro
5
5
  * @augments Exchange
@@ -87,25 +87,9 @@ export default class woofipro extends Exchange {
87
87
  parseBalance(response: any): Balances;
88
88
  fetchBalance(params?: {}): Promise<Balances>;
89
89
  getAssetHistoryRows(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
90
- parseLedgerEntry(item: Dict, currency?: Currency): {
91
- id: string;
92
- currency: string;
93
- account: string;
94
- referenceAccount: any;
95
- referenceId: string;
96
- status: string;
97
- amount: number;
98
- before: any;
99
- after: any;
100
- fee: any;
101
- direction: string;
102
- timestamp: number;
103
- datetime: string;
104
- type: string;
105
- info: Dict;
106
- };
90
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
107
91
  parseLedgerEntryType(type: any): string;
108
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
92
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
109
93
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
110
94
  parseTransactionStatus(status: Str): string;
111
95
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
@@ -2122,13 +2122,15 @@ export default class woofipro extends Exchange {
2122
2122
  return [currency, this.safeList(data, 'rows', [])];
2123
2123
  }
2124
2124
  parseLedgerEntry(item, currency = undefined) {
2125
- const code = this.safeString(item, 'token');
2125
+ const currencyId = this.safeString(item, 'token');
2126
+ const code = this.safeCurrencyCode(currencyId, currency);
2127
+ currency = this.safeCurrency(currencyId, currency);
2126
2128
  const amount = this.safeNumber(item, 'amount');
2127
2129
  const side = this.safeString(item, 'token_side');
2128
2130
  const direction = (side === 'DEPOSIT') ? 'in' : 'out';
2129
2131
  const timestamp = this.safeInteger(item, 'created_time');
2130
2132
  const fee = this.parseTokenAndFeeTemp(item, 'fee_token', 'fee_amount');
2131
- return {
2133
+ return this.safeLedgerEntry({
2132
2134
  'id': this.safeString(item, 'id'),
2133
2135
  'currency': code,
2134
2136
  'account': this.safeString(item, 'account'),
@@ -2144,7 +2146,7 @@ export default class woofipro extends Exchange {
2144
2146
  'datetime': this.iso8601(timestamp),
2145
2147
  'type': this.parseLedgerEntryType(this.safeString(item, 'type')),
2146
2148
  'info': item,
2147
- };
2149
+ }, currency);
2148
2150
  }
2149
2151
  parseLedgerEntryType(type) {
2150
2152
  const types = {
@@ -2157,11 +2159,11 @@ export default class woofipro extends Exchange {
2157
2159
  /**
2158
2160
  * @method
2159
2161
  * @name woofipro#fetchLedger
2160
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
2162
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2161
2163
  * @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history
2162
- * @param {string} code unified currency code, default is undefined
2164
+ * @param {string} [code] unified currency code, default is undefined
2163
2165
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2164
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
2166
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
2165
2167
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2166
2168
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
2167
2169
  */
package/js/src/xt.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/xt.js';
2
- import { Currencies, Currency, Dict, FundingHistory, FundingRateHistory, Int, LeverageTier, MarginModification, Market, Num, OHLCV, Order, OrderSide, OrderType, Str, Tickers, Transaction, TransferEntry } from './base/types.js';
2
+ import { Currencies, Currency, Dict, FundingHistory, FundingRateHistory, Int, LeverageTier, MarginModification, Market, Num, OHLCV, Order, OrderSide, OrderType, Str, Tickers, Transaction, TransferEntry, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class xt
5
5
  * @augments Exchange
@@ -41,27 +41,8 @@ export default class xt extends Exchange {
41
41
  cancelOrders(ids: string[], symbol?: string, params?: {}): Promise<Order[]>;
42
42
  parseOrder(order: any, market?: any): Order;
43
43
  parseOrderStatus(status: any): string;
44
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
45
- parseLedgerEntry(item: any, currency?: any): {
46
- id: string;
47
- direction: string;
48
- account: any;
49
- referenceId: any;
50
- referenceAccount: any;
51
- type: string;
52
- currency: string;
53
- amount: number;
54
- timestamp: number;
55
- datetime: string;
56
- before: any;
57
- after: number;
58
- status: any;
59
- fee: {
60
- currency: any;
61
- cost: any;
62
- };
63
- info: any;
64
- };
44
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
45
+ parseLedgerEntry(item: any, currency?: any): LedgerEntry;
65
46
  parseLedgerEntryType(type: any): string;
66
47
  fetchDepositAddress(code: string, params?: {}): Promise<{
67
48
  currency: string;
package/js/src/xt.js CHANGED
@@ -3600,8 +3600,10 @@ export default class xt extends Exchange {
3600
3600
  const side = this.safeString(item, 'side');
3601
3601
  const direction = (side === 'ADD') ? 'in' : 'out';
3602
3602
  const currencyId = this.safeString(item, 'coin');
3603
+ currency = this.safeCurrency(currencyId, currency);
3603
3604
  const timestamp = this.safeInteger(item, 'createdTime');
3604
- return {
3605
+ return this.safeLedgerEntry({
3606
+ 'info': item,
3605
3607
  'id': this.safeString(item, 'id'),
3606
3608
  'direction': direction,
3607
3609
  'account': undefined,
@@ -3619,8 +3621,7 @@ export default class xt extends Exchange {
3619
3621
  'currency': undefined,
3620
3622
  'cost': undefined,
3621
3623
  },
3622
- 'info': item,
3623
- };
3624
+ }, currency);
3624
3625
  }
3625
3626
  parseLedgerEntryType(type) {
3626
3627
  const ledgerType = {
package/js/src/zonda.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/zonda.js';
2
- import type { TransferEntry, Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, Num, Dict, int } from './base/types.js';
2
+ import type { TransferEntry, Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, Num, Dict, int, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class zonda
5
5
  * @augments Exchange
@@ -17,24 +17,8 @@ export default class zonda extends Exchange {
17
17
  parseTicker(ticker: Dict, market?: Market): Ticker;
18
18
  fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
19
19
  fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
20
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
21
- parseLedgerEntry(item: Dict, currency?: Currency): {
22
- info: Dict;
23
- id: string;
24
- direction: string;
25
- account: any;
26
- referenceId: string;
27
- referenceAccount: any;
28
- type: string;
29
- currency: string;
30
- amount: number;
31
- before: number;
32
- after: number;
33
- status: string;
34
- timestamp: number;
35
- datetime: string;
36
- fee: any;
37
- };
20
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
21
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
38
22
  parseLedgerEntryType(type: any): string;
39
23
  parseOHLCV(ohlcv: any, market?: Market): OHLCV;
40
24
  fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
package/js/src/zonda.js CHANGED
@@ -822,11 +822,11 @@ export default class zonda extends Exchange {
822
822
  /**
823
823
  * @method
824
824
  * @name zonda#fetchLedger
825
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
825
826
  * @see https://docs.zondacrypto.exchange/reference/operations-history
826
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
827
- * @param {string} code unified currency code, default is undefined
827
+ * @param {string} [code] unified currency code, default is undefined
828
828
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
829
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
829
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
830
830
  * @param {object} [params] extra parameters specific to the exchange API endpoint
831
831
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
832
832
  */
@@ -1120,6 +1120,7 @@ export default class zonda extends Exchange {
1120
1120
  const timestamp = this.safeInteger(item, 'time');
1121
1121
  const balance = this.safeValue(item, 'balance', {});
1122
1122
  const currencyId = this.safeString(balance, 'currency');
1123
+ currency = this.safeCurrency(currencyId, currency);
1123
1124
  const change = this.safeValue(item, 'change', {});
1124
1125
  let amount = this.safeString(change, 'total');
1125
1126
  let direction = 'in';
@@ -1131,7 +1132,7 @@ export default class zonda extends Exchange {
1131
1132
  // that can be used to enrich the transfers with txid, address etc (you need to use info.detailId as a parameter)
1132
1133
  const fundsBefore = this.safeValue(item, 'fundsBefore', {});
1133
1134
  const fundsAfter = this.safeValue(item, 'fundsAfter', {});
1134
- return {
1135
+ return this.safeLedgerEntry({
1135
1136
  'info': item,
1136
1137
  'id': this.safeString(item, 'historyId'),
1137
1138
  'direction': direction,
@@ -1147,7 +1148,7 @@ export default class zonda extends Exchange {
1147
1148
  'timestamp': timestamp,
1148
1149
  'datetime': this.iso8601(timestamp),
1149
1150
  'fee': undefined,
1150
- };
1151
+ }, currency);
1151
1152
  }
1152
1153
  parseLedgerEntryType(type) {
1153
1154
  const types = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.4.3",
3
+ "version": "4.4.4",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.min.js",
6
6
  "type": "module",