ccxt 4.4.91 → 4.4.92

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.
@@ -841,6 +841,12 @@ export default class Exchange {
841
841
  return hexData;
842
842
  }
843
843
  }
844
+ mapToSafeMap(dict) {
845
+ return dict; // wrapper for go
846
+ }
847
+ safeMapToMap(dict) {
848
+ return dict; // wrapper for go
849
+ }
844
850
  spawn(method, ...args) {
845
851
  const future = Future();
846
852
  // using setTimeout 0 to force the execution to run after the future is returned
@@ -2801,14 +2807,14 @@ export default class Exchange {
2801
2807
  }
2802
2808
  values.push(market);
2803
2809
  }
2804
- this.markets = this.indexBy(values, 'symbol');
2810
+ this.markets = this.mapToSafeMap(this.indexBy(values, 'symbol'));
2805
2811
  const marketsSortedBySymbol = this.keysort(this.markets);
2806
2812
  const marketsSortedById = this.keysort(this.markets_by_id);
2807
2813
  this.symbols = Object.keys(marketsSortedBySymbol);
2808
2814
  this.ids = Object.keys(marketsSortedById);
2809
2815
  if (currencies !== undefined) {
2810
2816
  // currencies is always undefined when called in constructor but not when called from loadMarkets
2811
- this.currencies = this.deepExtend(this.currencies, currencies);
2817
+ this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, currencies));
2812
2818
  }
2813
2819
  else {
2814
2820
  let baseCurrencies = [];
@@ -2838,8 +2844,8 @@ export default class Exchange {
2838
2844
  }
2839
2845
  baseCurrencies = this.sortBy(baseCurrencies, 'code', false, '');
2840
2846
  quoteCurrencies = this.sortBy(quoteCurrencies, 'code', false, '');
2841
- this.baseCurrencies = this.indexBy(baseCurrencies, 'code');
2842
- this.quoteCurrencies = this.indexBy(quoteCurrencies, 'code');
2847
+ this.baseCurrencies = this.mapToSafeMap(this.indexBy(baseCurrencies, 'code'));
2848
+ this.quoteCurrencies = this.mapToSafeMap(this.indexBy(quoteCurrencies, 'code'));
2843
2849
  const allCurrencies = this.arrayConcat(baseCurrencies, quoteCurrencies);
2844
2850
  const groupedCurrencies = this.groupBy(allCurrencies, 'code');
2845
2851
  const codes = Object.keys(groupedCurrencies);
@@ -2860,7 +2866,7 @@ export default class Exchange {
2860
2866
  resultingCurrencies.push(highestPrecisionCurrency);
2861
2867
  }
2862
2868
  const sortedCurrencies = this.sortBy(resultingCurrencies, 'code');
2863
- this.currencies = this.deepExtend(this.currencies, this.indexBy(sortedCurrencies, 'code'));
2869
+ this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, this.indexBy(sortedCurrencies, 'code')));
2864
2870
  }
2865
2871
  this.currencies_by_id = this.indexBySafe(this.currencies, 'id');
2866
2872
  const currenciesSortedByCode = this.keysort(this.currencies);
@@ -7033,7 +7039,7 @@ export default class Exchange {
7033
7039
  return reconstructedDate;
7034
7040
  }
7035
7041
  convertMarketIdExpireDate(date) {
7036
- // parse 03JAN24 to 240103
7042
+ // parse 03JAN24 to 240103.
7037
7043
  const monthMappping = {
7038
7044
  'JAN': '01',
7039
7045
  'FEB': '02',
@@ -7183,24 +7189,10 @@ export default class Exchange {
7183
7189
  }
7184
7190
  else {
7185
7191
  if (topic === 'myTrades' && (this.myTrades !== undefined)) {
7186
- // don't reset this.myTrades directly here
7187
- // because in c# we need to use a different object (thread-safe dict)
7188
- const keys = Object.keys(this.myTrades);
7189
- for (let i = 0; i < keys.length; i++) {
7190
- const key = keys[i];
7191
- if (key in this.myTrades) {
7192
- delete this.myTrades[key];
7193
- }
7194
- }
7192
+ this.myTrades = undefined;
7195
7193
  }
7196
7194
  else if (topic === 'orders' && (this.orders !== undefined)) {
7197
- const orderSymbols = Object.keys(this.orders);
7198
- for (let i = 0; i < orderSymbols.length; i++) {
7199
- const orderSymbol = orderSymbols[i];
7200
- if (orderSymbol in this.orders) {
7201
- delete this.orders[orderSymbol];
7202
- }
7203
- }
7195
+ this.orders = undefined;
7204
7196
  }
7205
7197
  else if (topic === 'ticker' && (this.tickers !== undefined)) {
7206
7198
  const tickerSymbols = Object.keys(this.tickers);
@@ -167,6 +167,7 @@ export default class bitmart extends Exchange {
167
167
  * @param {object} [params] extra parameters specific to the exchange API endpoint
168
168
  * @param {int} [params.until] the latest time in ms to fetch trades for
169
169
  * @param {boolean} [params.marginMode] *spot* whether to fetch trades for margin orders or spot orders, defaults to spot orders (only isolated margin orders are supported)
170
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
170
171
  * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
171
172
  */
172
173
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
@@ -180,6 +181,7 @@ export default class bitmart extends Exchange {
180
181
  * @param {int} [since] the earliest time in ms to fetch trades for
181
182
  * @param {int} [limit] the maximum number of trades to retrieve
182
183
  * @param {object} [params] extra parameters specific to the exchange API endpoint
184
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
183
185
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
184
186
  */
185
187
  fetchOrderTrades(id: string, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
@@ -252,6 +254,7 @@ export default class bitmart extends Exchange {
252
254
  * @param {string} [params.stopLossPrice] *swap only* the price to trigger a stop-loss order
253
255
  * @param {string} [params.takeProfitPrice] *swap only* the price to trigger a take-profit order
254
256
  * @param {int} [params.plan_category] *swap tp/sl only* 1: tp/sl, 2: position tp/sl, default is 1
257
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
255
258
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
256
259
  */
257
260
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
@@ -262,6 +265,7 @@ export default class bitmart extends Exchange {
262
265
  * @see https://developer-pro.bitmart.com/en/spot/#new-batch-order-v4-signed
263
266
  * @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
264
267
  * @param {object} [params] extra parameters specific to the exchange API endpoint
268
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
265
269
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
266
270
  */
267
271
  createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
@@ -328,6 +332,7 @@ export default class bitmart extends Exchange {
328
332
  * @param {string} [params.orderType] *swap only* 'limit', 'market', or 'trailing'
329
333
  * @param {boolean} [params.trailing] *swap only* set to true if you want to fetch trailing orders
330
334
  * @param {boolean} [params.trigger] *swap only* set to true if you want to fetch trigger orders
335
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
331
336
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
332
337
  */
333
338
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
@@ -343,6 +348,7 @@ export default class bitmart extends Exchange {
343
348
  * @param {object} [params] extra parameters specific to the exchange API endpoint
344
349
  * @param {int} [params.until] timestamp in ms of the latest entry
345
350
  * @param {string} [params.marginMode] *spot only* 'cross' or 'isolated', for margin trading
351
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
346
352
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
347
353
  */
348
354
  fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
@@ -370,6 +376,7 @@ export default class bitmart extends Exchange {
370
376
  * @param {string} [params.clientOrderId] *spot* fetch the order by client order id instead of order id
371
377
  * @param {string} [params.orderType] *swap only* 'limit', 'market', 'liquidate', 'bankruptcy', 'adl' or 'trailing'
372
378
  * @param {boolean} [params.trailing] *swap only* set to true if you want to fetch a trailing order
379
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
373
380
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
374
381
  */
375
382
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
package/js/src/bitmart.js CHANGED
@@ -2211,6 +2211,7 @@ export default class bitmart extends Exchange {
2211
2211
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2212
2212
  * @param {int} [params.until] the latest time in ms to fetch trades for
2213
2213
  * @param {boolean} [params.marginMode] *spot* whether to fetch trades for margin orders or spot orders, defaults to spot orders (only isolated margin orders are supported)
2214
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
2214
2215
  * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
2215
2216
  */
2216
2217
  async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -2326,6 +2327,7 @@ export default class bitmart extends Exchange {
2326
2327
  * @param {int} [since] the earliest time in ms to fetch trades for
2327
2328
  * @param {int} [limit] the maximum number of trades to retrieve
2328
2329
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2330
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
2329
2331
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
2330
2332
  */
2331
2333
  async fetchOrderTrades(id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -2787,6 +2789,7 @@ export default class bitmart extends Exchange {
2787
2789
  * @param {string} [params.stopLossPrice] *swap only* the price to trigger a stop-loss order
2788
2790
  * @param {string} [params.takeProfitPrice] *swap only* the price to trigger a take-profit order
2789
2791
  * @param {int} [params.plan_category] *swap tp/sl only* 1: tp/sl, 2: position tp/sl, default is 1
2792
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
2790
2793
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2791
2794
  */
2792
2795
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -2857,6 +2860,7 @@ export default class bitmart extends Exchange {
2857
2860
  * @see https://developer-pro.bitmart.com/en/spot/#new-batch-order-v4-signed
2858
2861
  * @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
2859
2862
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2863
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
2860
2864
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2861
2865
  */
2862
2866
  async createOrders(orders, params = {}) {
@@ -3441,6 +3445,7 @@ export default class bitmart extends Exchange {
3441
3445
  * @param {string} [params.orderType] *swap only* 'limit', 'market', or 'trailing'
3442
3446
  * @param {boolean} [params.trailing] *swap only* set to true if you want to fetch trailing orders
3443
3447
  * @param {boolean} [params.trigger] *swap only* set to true if you want to fetch trigger orders
3448
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
3444
3449
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
3445
3450
  */
3446
3451
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -3567,6 +3572,7 @@ export default class bitmart extends Exchange {
3567
3572
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3568
3573
  * @param {int} [params.until] timestamp in ms of the latest entry
3569
3574
  * @param {string} [params.marginMode] *spot only* 'cross' or 'isolated', for margin trading
3575
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
3570
3576
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
3571
3577
  */
3572
3578
  async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -3635,6 +3641,7 @@ export default class bitmart extends Exchange {
3635
3641
  * @param {string} [params.clientOrderId] *spot* fetch the order by client order id instead of order id
3636
3642
  * @param {string} [params.orderType] *swap only* 'limit', 'market', 'liquidate', 'bankruptcy', 'adl' or 'trailing'
3637
3643
  * @param {boolean} [params.trailing] *swap only* set to true if you want to fetch a trailing order
3644
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
3638
3645
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3639
3646
  */
3640
3647
  async fetchOrder(id, symbol = undefined, params = {}) {
package/js/src/bitmex.js CHANGED
@@ -38,7 +38,6 @@ export default class bitmex extends Exchange {
38
38
  'swap': true,
39
39
  'future': true,
40
40
  'option': false,
41
- 'index': true,
42
41
  'addMargin': undefined,
43
42
  'cancelAllOrders': true,
44
43
  'cancelAllOrdersAfter': true,
@@ -94,6 +93,7 @@ export default class bitmex extends Exchange {
94
93
  'fetchTransactions': 'emulated',
95
94
  'fetchTransfer': false,
96
95
  'fetchTransfers': false,
96
+ 'index': true,
97
97
  'reduceMargin': undefined,
98
98
  'sandbox': true,
99
99
  'setLeverage': true,
package/js/src/bitvavo.js CHANGED
@@ -656,7 +656,7 @@ export default class bitvavo extends Exchange {
656
656
  });
657
657
  }
658
658
  // set currencies here to avoid calling publicGetAssets twice
659
- this.currencies = this.deepExtend(this.currencies, result);
659
+ this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, result));
660
660
  return result;
661
661
  }
662
662
  /**
@@ -1228,6 +1228,9 @@ export default class bitvavo extends Exchange {
1228
1228
  if (operatorId !== undefined) {
1229
1229
  request['operatorId'] = this.parseToInt(operatorId);
1230
1230
  }
1231
+ else {
1232
+ throw new ArgumentsRequired(this.id + ' createOrder() requires an operatorId in params or options, eg: exchange.options[\'operatorId\'] = 1234567890');
1233
+ }
1231
1234
  return this.extend(request, params);
1232
1235
  }
1233
1236
  /**
@@ -1332,6 +1335,9 @@ export default class bitvavo extends Exchange {
1332
1335
  if (operatorId !== undefined) {
1333
1336
  request['operatorId'] = this.parseToInt(operatorId);
1334
1337
  }
1338
+ else {
1339
+ throw new ArgumentsRequired(this.id + ' editOrder() requires an operatorId in params or options, eg: exchange.options[\'operatorId\'] = 1234567890');
1340
+ }
1335
1341
  request['market'] = market['id'];
1336
1342
  return request;
1337
1343
  }
@@ -1373,6 +1379,9 @@ export default class bitvavo extends Exchange {
1373
1379
  if (operatorId !== undefined) {
1374
1380
  request['operatorId'] = this.parseToInt(operatorId);
1375
1381
  }
1382
+ else {
1383
+ throw new ArgumentsRequired(this.id + ' cancelOrder() requires an operatorId in params or options, eg: exchange.options[\'operatorId\'] = 1234567890');
1384
+ }
1376
1385
  return this.extend(request, params);
1377
1386
  }
1378
1387
  /**
package/js/src/exmo.js CHANGED
@@ -673,8 +673,9 @@ export default class exmo extends Exchange {
673
673
  * @returns {object} an associative dictionary of currencies
674
674
  */
675
675
  async fetchCurrencies(params = {}) {
676
+ const promises = [];
676
677
  //
677
- const currencyList = await this.publicGetCurrencyListExtended(params);
678
+ promises.push(this.publicGetCurrencyListExtended(params));
678
679
  //
679
680
  // [
680
681
  // {"name":"VLX","description":"Velas"},
@@ -683,7 +684,7 @@ export default class exmo extends Exchange {
683
684
  // {"name":"USD","description":"US Dollar"}
684
685
  // ]
685
686
  //
686
- const cryptoList = await this.publicGetPaymentsProvidersCryptoList(params);
687
+ promises.push(this.publicGetPaymentsProvidersCryptoList(params));
687
688
  //
688
689
  // {
689
690
  // "BTC":[
@@ -708,6 +709,9 @@ export default class exmo extends Exchange {
708
709
  // ],
709
710
  // }
710
711
  //
712
+ const responses = await Promise.all(promises);
713
+ const currencyList = responses[0];
714
+ const cryptoList = responses[1];
711
715
  const result = {};
712
716
  for (let i = 0; i < currencyList.length; i++) {
713
717
  const currency = currencyList[i];
@@ -774,6 +778,10 @@ export default class exmo extends Exchange {
774
778
  }
775
779
  }
776
780
  const code = this.safeCurrencyCode(currencyId);
781
+ const info = {
782
+ 'currency': currency,
783
+ 'providers': providers,
784
+ };
777
785
  result[code] = {
778
786
  'id': currencyId,
779
787
  'code': code,
@@ -785,7 +793,7 @@ export default class exmo extends Exchange {
785
793
  'fee': fee,
786
794
  'precision': this.parseNumber('1e-8'),
787
795
  'limits': limits,
788
- 'info': providers,
796
+ 'info': info,
789
797
  'networks': {},
790
798
  };
791
799
  }
package/js/src/htx.js CHANGED
@@ -6859,7 +6859,7 @@ export default class htx extends Exchange {
6859
6859
  let fee = this.safeNumber(params, 'fee');
6860
6860
  if (fee === undefined) {
6861
6861
  const currencies = await this.fetchCurrencies();
6862
- this.currencies = this.deepExtend(this.currencies, currencies);
6862
+ this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, currencies));
6863
6863
  const targetNetwork = this.safeValue(currency['networks'], networkCode, {});
6864
6864
  fee = this.safeNumber(targetNetwork, 'fee');
6865
6865
  if (fee === undefined) {
@@ -48,9 +48,9 @@ export default class hyperliquid extends Exchange {
48
48
  'createMarketBuyOrderWithCost': false,
49
49
  'createMarketOrderWithCost': false,
50
50
  'createMarketSellOrderWithCost': false,
51
- 'createOrderWithTakeProfitAndStopLoss': true,
52
51
  'createOrder': true,
53
52
  'createOrders': true,
53
+ 'createOrderWithTakeProfitAndStopLoss': true,
54
54
  'createReduceOnlyOrder': true,
55
55
  'createStopOrder': true,
56
56
  'createTriggerOrder': true,
@@ -534,7 +534,7 @@ export default class krakenfutures extends Exchange {
534
534
  'precision': undefined,
535
535
  });
536
536
  }
537
- this.currencies = this.deepExtend(currencies, this.currencies);
537
+ this.currencies = this.mapToSafeMap(this.deepExtend(currencies, this.currencies));
538
538
  return result;
539
539
  }
540
540
  /**
package/js/src/lbank.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/lbank.js';
2
- import type { Balances, Currency, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, int, DepositAddress, FundingRates, FundingRate } from './base/types.js';
2
+ import type { Balances, Currency, Currencies, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, int, DepositAddress, FundingRates, FundingRate } from './base/types.js';
3
3
  /**
4
4
  * @class lbank
5
5
  * @augments Exchange
@@ -16,6 +16,14 @@ export default class lbank extends Exchange {
16
16
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
17
17
  */
18
18
  fetchTime(params?: {}): Promise<Int>;
19
+ /**
20
+ * @method
21
+ * @name lbank#fetchCurrencies
22
+ * @description fetches all available currencies on an exchange
23
+ * @param {dict} [params] extra parameters specific to the exchange API endpoint
24
+ * @returns {dict} an associative dictionary of currencies
25
+ */
26
+ fetchCurrencies(params?: {}): Promise<Currencies>;
19
27
  /**
20
28
  * @method
21
29
  * @name lbank#fetchMarkets
package/js/src/lbank.js CHANGED
@@ -52,6 +52,7 @@ export default class lbank extends Exchange {
52
52
  'fetchClosedOrders': false,
53
53
  'fetchCrossBorrowRate': false,
54
54
  'fetchCrossBorrowRates': false,
55
+ 'fetchCurrencies': true,
55
56
  'fetchDepositAddress': true,
56
57
  'fetchDepositAddresses': false,
57
58
  'fetchDepositAddressesByNetwork': false,
@@ -126,6 +127,7 @@ export default class lbank extends Exchange {
126
127
  'currencyPairs': 2.5,
127
128
  'accuracy': 2.5,
128
129
  'usdToCny': 2.5,
130
+ 'assetConfigs': 2.5,
129
131
  'withdrawConfigs': 2.5,
130
132
  'timestamp': 2.5,
131
133
  'ticker/24hr': 2.5,
@@ -212,6 +214,7 @@ export default class lbank extends Exchange {
212
214
  },
213
215
  },
214
216
  'commonCurrencies': {
217
+ 'XBT': 'XBT',
215
218
  'HIT': 'Hiver',
216
219
  'VET_ERC20': 'VEN',
217
220
  'PNT': 'Penta',
@@ -279,21 +282,12 @@ export default class lbank extends Exchange {
279
282
  // ptx: 1
280
283
  // }
281
284
  },
282
- 'inverse-networks': {
285
+ 'networksById': {
283
286
  'erc20': 'ERC20',
284
287
  'trc20': 'TRC20',
285
- 'omni': 'OMNI',
286
- 'asa': 'ASA',
287
- 'bep20(bsc)': 'BSC',
288
- 'bep20': 'BSC',
289
- 'heco': 'HT',
290
- 'bep2': 'BNB',
291
- 'btc': 'BTC',
292
- 'dogecoin': 'DOGE',
293
- 'matic': 'MATIC',
294
- 'oec': 'OEC',
295
- 'btctron': 'BTCTRON',
296
- 'xrp': 'XRP',
288
+ 'TRX': 'TRC20',
289
+ 'bep20(bsc)': 'BEP20',
290
+ 'bep20': 'BEP20',
297
291
  },
298
292
  'defaultNetworks': {
299
293
  'USDT': 'TRC20',
@@ -416,6 +410,108 @@ export default class lbank extends Exchange {
416
410
  //
417
411
  return this.safeInteger(response, 'data');
418
412
  }
413
+ /**
414
+ * @method
415
+ * @name lbank#fetchCurrencies
416
+ * @description fetches all available currencies on an exchange
417
+ * @param {dict} [params] extra parameters specific to the exchange API endpoint
418
+ * @returns {dict} an associative dictionary of currencies
419
+ */
420
+ async fetchCurrencies(params = {}) {
421
+ const response = await this.spotPublicGetWithdrawConfigs(params);
422
+ //
423
+ // {
424
+ // "msg": "Success",
425
+ // "result": "true",
426
+ // "data": [
427
+ // {
428
+ // "amountScale": "4",
429
+ // "chain": "bep20(bsc)",
430
+ // "assetCode": "usdt",
431
+ // "min": "10",
432
+ // "transferAmtScale": "4",
433
+ // "canWithDraw": true,
434
+ // "fee": "0.0000",
435
+ // "minTransfer": "0.0001",
436
+ // "type": "1"
437
+ // },
438
+ // {
439
+ // "amountScale": "4",
440
+ // "chain": "trc20",
441
+ // "assetCode": "usdt",
442
+ // "min": "1",
443
+ // "transferAmtScale": "4",
444
+ // "canWithDraw": true,
445
+ // "fee": "1.0000",
446
+ // "minTransfer": "0.0001",
447
+ // "type": "1"
448
+ // },
449
+ // ...
450
+ // ],
451
+ // "error_code": "0",
452
+ // "ts": "1747973911431"
453
+ // }
454
+ //
455
+ const currenciesData = this.safeList(response, 'data', []);
456
+ const grouped = this.groupBy(currenciesData, 'assetCode');
457
+ const groupedKeys = Object.keys(grouped);
458
+ const result = {};
459
+ for (let i = 0; i < groupedKeys.length; i++) {
460
+ const id = (groupedKeys[i]).toString(); // some currencies are numeric
461
+ const code = this.safeCurrencyCode(id);
462
+ const networksRaw = grouped[id];
463
+ const networks = {};
464
+ for (let j = 0; j < networksRaw.length; j++) {
465
+ const networkEntry = networksRaw[j];
466
+ const networkId = this.safeString(networkEntry, 'chain');
467
+ const networkCode = this.networkIdToCode(networkId);
468
+ networks[networkCode] = {
469
+ 'id': networkId,
470
+ 'network': networkCode,
471
+ 'limits': {
472
+ 'withdraw': {
473
+ 'min': this.safeNumber(networkEntry, 'min'),
474
+ 'max': undefined,
475
+ },
476
+ 'deposit': {
477
+ 'min': this.safeNumber(networkEntry, 'minTransfer'),
478
+ 'max': undefined,
479
+ },
480
+ },
481
+ 'active': undefined,
482
+ 'deposit': undefined,
483
+ 'withdraw': this.safeBool(networkEntry, 'canWithDraw'),
484
+ 'fee': this.safeNumber(networkEntry, 'fee'),
485
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(networkEntry, 'transferAmtScale'))),
486
+ 'info': networkEntry,
487
+ };
488
+ }
489
+ result[code] = this.safeCurrencyStructure({
490
+ 'id': id,
491
+ 'code': code,
492
+ 'precision': undefined,
493
+ 'type': undefined,
494
+ 'name': undefined,
495
+ 'active': undefined,
496
+ 'deposit': undefined,
497
+ 'withdraw': undefined,
498
+ 'fee': undefined,
499
+ 'limits': {
500
+ 'withdraw': {
501
+ 'min': undefined,
502
+ 'max': undefined,
503
+ },
504
+ 'deposit': {
505
+ 'min': undefined,
506
+ 'max': undefined,
507
+ },
508
+ },
509
+ 'networks': networks,
510
+ 'info': networksRaw,
511
+ });
512
+ }
513
+ return result;
514
+ }
419
515
  /**
420
516
  * @method
421
517
  * @name lbank#fetchMarkets
@@ -2171,13 +2267,10 @@ export default class lbank extends Exchange {
2171
2267
  const result = this.safeValue(response, 'data');
2172
2268
  const address = this.safeString(result, 'address');
2173
2269
  const tag = this.safeString(result, 'memo');
2174
- const networkId = this.safeString(result, 'netWork');
2175
- const inverseNetworks = this.safeValue(this.options, 'inverse-networks', {});
2176
- const networkCode = this.safeStringUpper(inverseNetworks, networkId, networkId);
2177
2270
  return {
2178
2271
  'info': response,
2179
2272
  'currency': code,
2180
- 'network': networkCode,
2273
+ 'network': this.networkIdToCode(this.safeString(result, 'netWork')),
2181
2274
  'address': address,
2182
2275
  'tag': tag,
2183
2276
  };
@@ -2212,12 +2305,10 @@ export default class lbank extends Exchange {
2212
2305
  const result = this.safeValue(response, 'data');
2213
2306
  const address = this.safeString(result, 'address');
2214
2307
  const tag = this.safeString(result, 'memo');
2215
- const inverseNetworks = this.safeValue(this.options, 'inverse-networks', {});
2216
- const networkCode = this.safeStringUpper(inverseNetworks, network, network);
2217
2308
  return {
2218
2309
  'info': response,
2219
2310
  'currency': code,
2220
- 'network': networkCode,
2311
+ 'network': undefined,
2221
2312
  'address': address,
2222
2313
  'tag': tag,
2223
2314
  };
@@ -2341,9 +2432,6 @@ export default class lbank extends Exchange {
2341
2432
  }
2342
2433
  const txid = this.safeString(transaction, 'txId');
2343
2434
  const timestamp = this.safeInteger2(transaction, 'insertTime', 'applyTime');
2344
- const networks = this.safeValue(this.options, 'inverse-networks', {});
2345
- const networkId = this.safeString(transaction, 'networkName');
2346
- const network = this.safeString(networks, networkId, networkId);
2347
2435
  const address = this.safeString(transaction, 'address');
2348
2436
  let addressFrom = undefined;
2349
2437
  let addressTo = undefined;
@@ -2371,7 +2459,7 @@ export default class lbank extends Exchange {
2371
2459
  'txid': txid,
2372
2460
  'timestamp': timestamp,
2373
2461
  'datetime': this.iso8601(timestamp),
2374
- 'network': network,
2462
+ 'network': this.networkIdToCode(this.safeString(transaction, 'networkName')),
2375
2463
  'address': address,
2376
2464
  'addressTo': addressTo,
2377
2465
  'addressFrom': addressFrom,
@@ -2574,10 +2662,9 @@ export default class lbank extends Exchange {
2574
2662
  withdrawFees[code] = {};
2575
2663
  for (let j = 0; j < networkList.length; j++) {
2576
2664
  const networkEntry = networkList[j];
2577
- const networkId = this.safeString(networkEntry, 'name');
2578
- const networkCode = this.safeString(this.options['inverse-networks'], networkId, networkId);
2579
2665
  const fee = this.safeNumber(networkEntry, 'withdrawFee');
2580
2666
  if (fee !== undefined) {
2667
+ const networkCode = this.networkIdToCode(this.safeString(networkEntry, 'name'));
2581
2668
  withdrawFees[code][networkCode] = fee;
2582
2669
  }
2583
2670
  }
@@ -2629,8 +2716,7 @@ export default class lbank extends Exchange {
2629
2716
  if (canWithdraw === 'true') {
2630
2717
  const currencyId = this.safeString(item, 'assetCode');
2631
2718
  const codeInner = this.safeCurrencyCode(currencyId);
2632
- const chain = this.safeString(item, 'chain');
2633
- let network = this.safeString(this.options['inverse-networks'], chain, chain);
2719
+ let network = this.networkIdToCode(this.safeString(item, 'chain'));
2634
2720
  if (network === undefined) {
2635
2721
  network = codeInner;
2636
2722
  }
@@ -2781,8 +2867,7 @@ export default class lbank extends Exchange {
2781
2867
  const resultCodeInfo = result[code]['info'];
2782
2868
  resultCodeInfo.push(fee);
2783
2869
  }
2784
- const chain = this.safeString(fee, 'chain');
2785
- const networkCode = this.safeString(this.options['inverse-networks'], chain, chain);
2870
+ const networkCode = this.networkIdToCode(this.safeString(fee, 'chain'));
2786
2871
  if (networkCode !== undefined) {
2787
2872
  result[code]['networks'][networkCode] = {
2788
2873
  'withdraw': {
@@ -2838,8 +2923,7 @@ export default class lbank extends Exchange {
2838
2923
  const networkList = this.safeValue(fee, 'networkList', []);
2839
2924
  for (let j = 0; j < networkList.length; j++) {
2840
2925
  const networkEntry = networkList[j];
2841
- const networkId = this.safeString(networkEntry, 'name');
2842
- const networkCode = this.safeStringUpper(this.options['inverse-networks'], networkId, networkId);
2926
+ const networkCode = this.networkIdToCode(this.safeString(networkEntry, 'name'));
2843
2927
  const withdrawFee = this.safeNumber(networkEntry, 'withdrawFee');
2844
2928
  const isDefault = this.safeValue(networkEntry, 'isDefault');
2845
2929
  if (withdrawFee !== undefined) {
package/js/src/okx.d.ts CHANGED
@@ -807,7 +807,7 @@ export default class okx extends Exchange {
807
807
  /**
808
808
  * @method
809
809
  * @name okx#fetchBorrowInterest
810
- * @description fetch the interest owed by the user for borrowing currency for margin trading
810
+ * @description fetch the interest owed b the user for borrowing currency for margin trading
811
811
  * @see https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-data
812
812
  * @param {string} code the unified currency code for the currency of the interest
813
813
  * @param {string} symbol the market symbol of an isolated margin market, if undefined, the interest for cross margin markets is returned
package/js/src/okx.js CHANGED
@@ -5145,7 +5145,7 @@ export default class okx extends Exchange {
5145
5145
  let fee = this.safeString(params, 'fee');
5146
5146
  if (fee === undefined) {
5147
5147
  const currencies = await this.fetchCurrencies();
5148
- this.currencies = this.deepExtend(this.currencies, currencies);
5148
+ this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, currencies));
5149
5149
  const targetNetwork = this.safeDict(currency['networks'], this.networkIdToCode(network), {});
5150
5150
  fee = this.safeString(targetNetwork, 'fee');
5151
5151
  if (fee === undefined) {
@@ -7200,7 +7200,7 @@ export default class okx extends Exchange {
7200
7200
  /**
7201
7201
  * @method
7202
7202
  * @name okx#fetchBorrowInterest
7203
- * @description fetch the interest owed by the user for borrowing currency for margin trading
7203
+ * @description fetch the interest owed b the user for borrowing currency for margin trading
7204
7204
  * @see https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-data
7205
7205
  * @param {string} code the unified currency code for the currency of the interest
7206
7206
  * @param {string} symbol the market symbol of an isolated margin market, if undefined, the interest for cross margin markets is returned