ccxt 4.4.90 → 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.
Files changed (71) hide show
  1. package/README.md +5 -6
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +1 -4
  4. package/dist/cjs/src/base/Exchange.js +23 -33
  5. package/dist/cjs/src/base/ws/Client.js +4 -34
  6. package/dist/cjs/src/binance.js +1 -1
  7. package/dist/cjs/src/bitmart.js +7 -0
  8. package/dist/cjs/src/bitmex.js +2 -1
  9. package/dist/cjs/src/bitvavo.js +10 -1
  10. package/dist/cjs/src/cex.js +61 -0
  11. package/dist/cjs/src/cryptocom.js +21 -2
  12. package/dist/cjs/src/cryptomus.js +1 -1
  13. package/dist/cjs/src/exmo.js +25 -10
  14. package/dist/cjs/src/fmfwio.js +1 -1
  15. package/dist/cjs/src/gate.js +2 -2
  16. package/dist/cjs/src/htx.js +1 -1
  17. package/dist/cjs/src/hyperliquid.js +115 -59
  18. package/dist/cjs/src/kraken.js +29 -1
  19. package/dist/cjs/src/krakenfutures.js +1 -1
  20. package/dist/cjs/src/lbank.js +116 -32
  21. package/dist/cjs/src/mexc.js +1 -0
  22. package/dist/cjs/src/modetrade.js +2 -2
  23. package/dist/cjs/src/okx.js +2 -2
  24. package/dist/cjs/src/paradex.js +1 -1
  25. package/dist/cjs/src/pro/bitstamp.js +1 -1
  26. package/dist/cjs/src/pro/bybit.js +10 -149
  27. package/dist/cjs/src/pro/kraken.js +251 -264
  28. package/dist/cjs/src/pro/mexc.js +0 -1
  29. package/js/ccxt.d.ts +2 -5
  30. package/js/ccxt.js +2 -4
  31. package/js/src/abstract/lbank.d.ts +1 -0
  32. package/js/src/base/Exchange.d.ts +4 -1
  33. package/js/src/base/Exchange.js +24 -34
  34. package/js/src/base/ws/Client.d.ts +0 -2
  35. package/js/src/base/ws/Client.js +4 -34
  36. package/js/src/binance.js +1 -1
  37. package/js/src/bitmart.d.ts +7 -0
  38. package/js/src/bitmart.js +7 -0
  39. package/js/src/bitmex.js +2 -1
  40. package/js/src/bitvavo.js +10 -1
  41. package/js/src/cex.js +61 -0
  42. package/js/src/cryptocom.js +21 -2
  43. package/js/src/cryptomus.js +1 -1
  44. package/js/src/exmo.js +25 -10
  45. package/js/src/fmfwio.js +2 -2
  46. package/js/src/gate.js +2 -2
  47. package/js/src/htx.js +1 -1
  48. package/js/src/hyperliquid.d.ts +1 -0
  49. package/js/src/hyperliquid.js +115 -59
  50. package/js/src/kraken.js +29 -1
  51. package/js/src/krakenfutures.js +1 -1
  52. package/js/src/lbank.d.ts +9 -1
  53. package/js/src/lbank.js +116 -32
  54. package/js/src/mexc.js +1 -0
  55. package/js/src/modetrade.js +2 -2
  56. package/js/src/okx.d.ts +1 -1
  57. package/js/src/okx.js +2 -2
  58. package/js/src/p2b.d.ts +1 -2
  59. package/js/src/paradex.js +1 -1
  60. package/js/src/pro/bitstamp.js +1 -1
  61. package/js/src/pro/bybit.d.ts +0 -1
  62. package/js/src/pro/bybit.js +11 -150
  63. package/js/src/pro/kraken.d.ts +17 -17
  64. package/js/src/pro/kraken.js +251 -264
  65. package/js/src/pro/mexc.js +0 -1
  66. package/js/src/tradeogre.d.ts +1 -2
  67. package/package.json +1 -1
  68. package/js/src/abstract/coinlist.d.ts +0 -60
  69. package/js/src/abstract/coinlist.js +0 -11
  70. package/js/src/coinlist.d.ts +0 -384
  71. package/js/src/coinlist.js +0 -2610
@@ -47,6 +47,7 @@ class hyperliquid extends hyperliquid$1 {
47
47
  'createMarketSellOrderWithCost': false,
48
48
  'createOrder': true,
49
49
  'createOrders': true,
50
+ 'createOrderWithTakeProfitAndStopLoss': true,
50
51
  'createReduceOnlyOrder': true,
51
52
  'createStopOrder': true,
52
53
  'createTriggerOrder': true,
@@ -228,7 +229,16 @@ class hyperliquid extends hyperliquid$1 {
228
229
  'triggerDirection': false,
229
230
  'stopLossPrice': false,
230
231
  'takeProfitPrice': false,
231
- 'attachedStopLossTakeProfit': undefined,
232
+ 'attachedStopLossTakeProfit': {
233
+ 'triggerPriceType': {
234
+ 'last': false,
235
+ 'mark': false,
236
+ 'index': false,
237
+ },
238
+ 'triggerPrice': true,
239
+ 'type': true,
240
+ 'price': true,
241
+ },
232
242
  'timeInForce': {
233
243
  'IOC': true,
234
244
  'FOK': false,
@@ -1418,6 +1428,74 @@ class hyperliquid extends hyperliquid$1 {
1418
1428
  const statuses = this.safeList(data, 'statuses', []);
1419
1429
  return this.parseOrders(statuses, undefined);
1420
1430
  }
1431
+ createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
1432
+ const market = this.market(symbol);
1433
+ type = type.toUpperCase();
1434
+ side = side.toUpperCase();
1435
+ const isMarket = (type === 'MARKET');
1436
+ const isBuy = (side === 'BUY');
1437
+ const clientOrderId = this.safeString2(params, 'clientOrderId', 'client_id');
1438
+ const slippage = this.safeString(params, 'slippage');
1439
+ let defaultTimeInForce = (isMarket) ? 'ioc' : 'gtc';
1440
+ const postOnly = this.safeBool(params, 'postOnly', false);
1441
+ if (postOnly) {
1442
+ defaultTimeInForce = 'alo';
1443
+ }
1444
+ let timeInForce = this.safeStringLower(params, 'timeInForce', defaultTimeInForce);
1445
+ timeInForce = this.capitalize(timeInForce);
1446
+ let triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
1447
+ const stopLossPrice = this.safeString(params, 'stopLossPrice', triggerPrice);
1448
+ const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
1449
+ const isTrigger = (stopLossPrice || takeProfitPrice);
1450
+ let px = undefined;
1451
+ if (isMarket) {
1452
+ if (price === undefined) {
1453
+ throw new errors.ArgumentsRequired(this.id + ' market orders require price to calculate the max slippage price. Default slippage can be set in options (default is 5%).');
1454
+ }
1455
+ px = (isBuy) ? Precise["default"].stringMul(price, Precise["default"].stringAdd('1', slippage)) : Precise["default"].stringMul(price, Precise["default"].stringSub('1', slippage));
1456
+ px = this.priceToPrecision(symbol, px); // round after adding slippage
1457
+ }
1458
+ else {
1459
+ px = this.priceToPrecision(symbol, price);
1460
+ }
1461
+ const sz = this.amountToPrecision(symbol, amount);
1462
+ const reduceOnly = this.safeBool(params, 'reduceOnly', false);
1463
+ const orderType = {};
1464
+ if (isTrigger) {
1465
+ let isTp = false;
1466
+ if (takeProfitPrice !== undefined) {
1467
+ triggerPrice = this.priceToPrecision(symbol, takeProfitPrice);
1468
+ isTp = true;
1469
+ }
1470
+ else {
1471
+ triggerPrice = this.priceToPrecision(symbol, stopLossPrice);
1472
+ }
1473
+ orderType['trigger'] = {
1474
+ 'isMarket': isMarket,
1475
+ 'triggerPx': triggerPrice,
1476
+ 'tpsl': (isTp) ? 'tp' : 'sl',
1477
+ };
1478
+ }
1479
+ else {
1480
+ orderType['limit'] = {
1481
+ 'tif': timeInForce,
1482
+ };
1483
+ }
1484
+ params = this.omit(params, ['clientOrderId', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce', 'client_id', 'reduceOnly', 'postOnly']);
1485
+ const orderObj = {
1486
+ 'a': this.parseToInt(market['baseId']),
1487
+ 'b': isBuy,
1488
+ 'p': px,
1489
+ 's': sz,
1490
+ 'r': reduceOnly,
1491
+ 't': orderType,
1492
+ // 'c': clientOrderId,
1493
+ };
1494
+ if (clientOrderId !== undefined) {
1495
+ orderObj['c'] = clientOrderId;
1496
+ }
1497
+ return orderObj;
1498
+ }
1421
1499
  createOrdersRequest(orders, params = {}) {
1422
1500
  /**
1423
1501
  * @method
@@ -1452,79 +1530,57 @@ class hyperliquid extends hyperliquid$1 {
1452
1530
  params = this.omit(params, ['slippage', 'clientOrderId', 'client_id', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce']);
1453
1531
  const nonce = this.milliseconds();
1454
1532
  const orderReq = [];
1533
+ let grouping = 'na';
1455
1534
  for (let i = 0; i < orders.length; i++) {
1456
1535
  const rawOrder = orders[i];
1457
1536
  const marketId = this.safeString(rawOrder, 'symbol');
1458
1537
  const market = this.market(marketId);
1459
1538
  const symbol = market['symbol'];
1460
1539
  const type = this.safeStringUpper(rawOrder, 'type');
1461
- const isMarket = (type === 'MARKET');
1462
1540
  const side = this.safeStringUpper(rawOrder, 'side');
1463
- const isBuy = (side === 'BUY');
1464
1541
  const amount = this.safeString(rawOrder, 'amount');
1465
1542
  const price = this.safeString(rawOrder, 'price');
1466
1543
  let orderParams = this.safeDict(rawOrder, 'params', {});
1467
- const clientOrderId = this.safeString2(orderParams, 'clientOrderId', 'client_id');
1468
1544
  const slippage = this.safeString(orderParams, 'slippage', defaultSlippage);
1469
- let defaultTimeInForce = (isMarket) ? 'ioc' : 'gtc';
1470
- const postOnly = this.safeBool(orderParams, 'postOnly', false);
1471
- if (postOnly) {
1472
- defaultTimeInForce = 'alo';
1473
- }
1474
- let timeInForce = this.safeStringLower(orderParams, 'timeInForce', defaultTimeInForce);
1475
- timeInForce = this.capitalize(timeInForce);
1476
- let triggerPrice = this.safeString2(orderParams, 'triggerPrice', 'stopPrice');
1477
- const stopLossPrice = this.safeString(orderParams, 'stopLossPrice', triggerPrice);
1478
- const takeProfitPrice = this.safeString(orderParams, 'takeProfitPrice');
1479
- const isTrigger = (stopLossPrice || takeProfitPrice);
1480
- let px = undefined;
1481
- if (isMarket) {
1482
- if (price === undefined) {
1483
- throw new errors.ArgumentsRequired(this.id + ' market orders require price to calculate the max slippage price. Default slippage can be set in options (default is 5%).');
1484
- }
1485
- px = (isBuy) ? Precise["default"].stringMul(price, Precise["default"].stringAdd('1', slippage)) : Precise["default"].stringMul(price, Precise["default"].stringSub('1', slippage));
1486
- px = this.priceToPrecision(symbol, px); // round after adding slippage
1487
- }
1488
- else {
1489
- px = this.priceToPrecision(symbol, price);
1490
- }
1491
- const sz = this.amountToPrecision(symbol, amount);
1492
- const reduceOnly = this.safeBool(orderParams, 'reduceOnly', false);
1493
- const orderType = {};
1545
+ orderParams['slippage'] = slippage;
1546
+ const stopLoss = this.safeValue(orderParams, 'stopLoss');
1547
+ const takeProfit = this.safeValue(orderParams, 'takeProfit');
1548
+ const isTrigger = (stopLoss || takeProfit);
1549
+ orderParams = this.omit(orderParams, ['stopLoss', 'takeProfit']);
1550
+ const mainOrderObj = this.createOrderRequest(symbol, type, side, amount, price, orderParams);
1551
+ orderReq.push(mainOrderObj);
1494
1552
  if (isTrigger) {
1495
- let isTp = false;
1496
- if (takeProfitPrice !== undefined) {
1497
- triggerPrice = this.priceToPrecision(symbol, takeProfitPrice);
1498
- isTp = true;
1553
+ // grouping opposed orders for sl/tp
1554
+ const stopLossOrderTriggerPrice = this.safeStringN(stopLoss, ['triggerPrice', 'stopPrice']);
1555
+ const stopLossOrderType = this.safeString(stopLoss, 'type');
1556
+ const stopLossOrderLimitPrice = this.safeStringN(stopLoss, ['price', 'stopLossPrice'], stopLossOrderTriggerPrice);
1557
+ const takeProfitOrderTriggerPrice = this.safeStringN(takeProfit, ['triggerPrice', 'stopPrice']);
1558
+ const takeProfitOrderType = this.safeString(takeProfit, 'type');
1559
+ const takeProfitOrderLimitPrice = this.safeStringN(takeProfit, ['price', 'takeProfitPrice'], takeProfitOrderTriggerPrice);
1560
+ grouping = 'normalTpsl';
1561
+ orderParams = this.omit(orderParams, ['stopLoss', 'takeProfit']);
1562
+ let triggerOrderSide = '';
1563
+ if (side === 'BUY') {
1564
+ triggerOrderSide = 'sell';
1499
1565
  }
1500
1566
  else {
1501
- triggerPrice = this.priceToPrecision(symbol, stopLossPrice);
1567
+ triggerOrderSide = 'buy';
1568
+ }
1569
+ if (takeProfit !== undefined) {
1570
+ const orderObj = this.createOrderRequest(symbol, takeProfitOrderType, triggerOrderSide, amount, takeProfitOrderLimitPrice, this.extend(orderParams, {
1571
+ 'takeProfitPrice': takeProfitOrderTriggerPrice,
1572
+ 'reduceOnly': true,
1573
+ }));
1574
+ orderReq.push(orderObj);
1575
+ }
1576
+ if (stopLoss !== undefined) {
1577
+ const orderObj = this.createOrderRequest(symbol, stopLossOrderType, triggerOrderSide, amount, stopLossOrderLimitPrice, this.extend(orderParams, {
1578
+ 'stopLossPrice': stopLossOrderTriggerPrice,
1579
+ 'reduceOnly': true,
1580
+ }));
1581
+ orderReq.push(orderObj);
1502
1582
  }
1503
- orderType['trigger'] = {
1504
- 'isMarket': isMarket,
1505
- 'triggerPx': triggerPrice,
1506
- 'tpsl': (isTp) ? 'tp' : 'sl',
1507
- };
1508
- }
1509
- else {
1510
- orderType['limit'] = {
1511
- 'tif': timeInForce,
1512
- };
1513
- }
1514
- orderParams = this.omit(orderParams, ['clientOrderId', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce', 'client_id', 'reduceOnly', 'postOnly']);
1515
- const orderObj = {
1516
- 'a': this.parseToInt(market['baseId']),
1517
- 'b': isBuy,
1518
- 'p': px,
1519
- 's': sz,
1520
- 'r': reduceOnly,
1521
- 't': orderType,
1522
- // 'c': clientOrderId,
1523
- };
1524
- if (clientOrderId !== undefined) {
1525
- orderObj['c'] = clientOrderId;
1526
1583
  }
1527
- orderReq.push(orderObj);
1528
1584
  }
1529
1585
  let vaultAddress = undefined;
1530
1586
  [vaultAddress, params] = this.handleOptionAndParams(params, 'createOrder', 'vaultAddress');
@@ -1532,7 +1588,7 @@ class hyperliquid extends hyperliquid$1 {
1532
1588
  const orderAction = {
1533
1589
  'type': 'order',
1534
1590
  'orders': orderReq,
1535
- 'grouping': 'na',
1591
+ 'grouping': grouping,
1536
1592
  // 'brokerCode': 1, // cant
1537
1593
  };
1538
1594
  if (vaultAddress === undefined) {
@@ -1380,7 +1380,20 @@ class kraken extends kraken$1 {
1380
1380
  // "maker": false
1381
1381
  // }
1382
1382
  //
1383
+ // watchTrades
1384
+ //
1385
+ // {
1386
+ // "symbol": "BTC/USD",
1387
+ // "side": "buy",
1388
+ // "price": 109601.2,
1389
+ // "qty": 0.04561994,
1390
+ // "ord_type": "market",
1391
+ // "trade_id": 83449369,
1392
+ // "timestamp": "2025-05-27T11:24:03.847761Z"
1393
+ // }
1394
+ //
1383
1395
  let timestamp = undefined;
1396
+ let datetime = undefined;
1384
1397
  let side = undefined;
1385
1398
  let type = undefined;
1386
1399
  let price = undefined;
@@ -1431,6 +1444,15 @@ class kraken extends kraken$1 {
1431
1444
  };
1432
1445
  }
1433
1446
  }
1447
+ else {
1448
+ symbol = this.safeString(trade, 'symbol');
1449
+ datetime = this.safeString(trade, 'timestamp');
1450
+ id = this.safeString(trade, 'trade_id');
1451
+ side = this.safeString(trade, 'side');
1452
+ type = this.safeString(trade, 'ord_type');
1453
+ price = this.safeString(trade, 'price');
1454
+ amount = this.safeString(trade, 'qty');
1455
+ }
1434
1456
  if (market !== undefined) {
1435
1457
  symbol = market['symbol'];
1436
1458
  }
@@ -1440,12 +1462,18 @@ class kraken extends kraken$1 {
1440
1462
  if (maker !== undefined) {
1441
1463
  takerOrMaker = maker ? 'maker' : 'taker';
1442
1464
  }
1465
+ if (datetime === undefined) {
1466
+ datetime = this.iso8601(timestamp);
1467
+ }
1468
+ else {
1469
+ timestamp = this.parse8601(datetime);
1470
+ }
1443
1471
  return this.safeTrade({
1444
1472
  'id': id,
1445
1473
  'order': orderId,
1446
1474
  'info': trade,
1447
1475
  'timestamp': timestamp,
1448
- 'datetime': this.iso8601(timestamp),
1476
+ 'datetime': datetime,
1449
1477
  'symbol': symbol,
1450
1478
  'type': type,
1451
1479
  'side': side,
@@ -531,7 +531,7 @@ class krakenfutures extends krakenfutures$1 {
531
531
  'precision': undefined,
532
532
  });
533
533
  }
534
- this.currencies = this.deepExtend(currencies, this.currencies);
534
+ this.currencies = this.mapToSafeMap(this.deepExtend(currencies, this.currencies));
535
535
  return result;
536
536
  }
537
537
  /**
@@ -49,6 +49,7 @@ class lbank extends lbank$1 {
49
49
  'fetchClosedOrders': false,
50
50
  'fetchCrossBorrowRate': false,
51
51
  'fetchCrossBorrowRates': false,
52
+ 'fetchCurrencies': true,
52
53
  'fetchDepositAddress': true,
53
54
  'fetchDepositAddresses': false,
54
55
  'fetchDepositAddressesByNetwork': false,
@@ -123,6 +124,7 @@ class lbank extends lbank$1 {
123
124
  'currencyPairs': 2.5,
124
125
  'accuracy': 2.5,
125
126
  'usdToCny': 2.5,
127
+ 'assetConfigs': 2.5,
126
128
  'withdrawConfigs': 2.5,
127
129
  'timestamp': 2.5,
128
130
  'ticker/24hr': 2.5,
@@ -209,6 +211,7 @@ class lbank extends lbank$1 {
209
211
  },
210
212
  },
211
213
  'commonCurrencies': {
214
+ 'XBT': 'XBT',
212
215
  'HIT': 'Hiver',
213
216
  'VET_ERC20': 'VEN',
214
217
  'PNT': 'Penta',
@@ -276,21 +279,12 @@ class lbank extends lbank$1 {
276
279
  // ptx: 1
277
280
  // }
278
281
  },
279
- 'inverse-networks': {
282
+ 'networksById': {
280
283
  'erc20': 'ERC20',
281
284
  'trc20': 'TRC20',
282
- 'omni': 'OMNI',
283
- 'asa': 'ASA',
284
- 'bep20(bsc)': 'BSC',
285
- 'bep20': 'BSC',
286
- 'heco': 'HT',
287
- 'bep2': 'BNB',
288
- 'btc': 'BTC',
289
- 'dogecoin': 'DOGE',
290
- 'matic': 'MATIC',
291
- 'oec': 'OEC',
292
- 'btctron': 'BTCTRON',
293
- 'xrp': 'XRP',
285
+ 'TRX': 'TRC20',
286
+ 'bep20(bsc)': 'BEP20',
287
+ 'bep20': 'BEP20',
294
288
  },
295
289
  'defaultNetworks': {
296
290
  'USDT': 'TRC20',
@@ -413,6 +407,108 @@ class lbank extends lbank$1 {
413
407
  //
414
408
  return this.safeInteger(response, 'data');
415
409
  }
410
+ /**
411
+ * @method
412
+ * @name lbank#fetchCurrencies
413
+ * @description fetches all available currencies on an exchange
414
+ * @param {dict} [params] extra parameters specific to the exchange API endpoint
415
+ * @returns {dict} an associative dictionary of currencies
416
+ */
417
+ async fetchCurrencies(params = {}) {
418
+ const response = await this.spotPublicGetWithdrawConfigs(params);
419
+ //
420
+ // {
421
+ // "msg": "Success",
422
+ // "result": "true",
423
+ // "data": [
424
+ // {
425
+ // "amountScale": "4",
426
+ // "chain": "bep20(bsc)",
427
+ // "assetCode": "usdt",
428
+ // "min": "10",
429
+ // "transferAmtScale": "4",
430
+ // "canWithDraw": true,
431
+ // "fee": "0.0000",
432
+ // "minTransfer": "0.0001",
433
+ // "type": "1"
434
+ // },
435
+ // {
436
+ // "amountScale": "4",
437
+ // "chain": "trc20",
438
+ // "assetCode": "usdt",
439
+ // "min": "1",
440
+ // "transferAmtScale": "4",
441
+ // "canWithDraw": true,
442
+ // "fee": "1.0000",
443
+ // "minTransfer": "0.0001",
444
+ // "type": "1"
445
+ // },
446
+ // ...
447
+ // ],
448
+ // "error_code": "0",
449
+ // "ts": "1747973911431"
450
+ // }
451
+ //
452
+ const currenciesData = this.safeList(response, 'data', []);
453
+ const grouped = this.groupBy(currenciesData, 'assetCode');
454
+ const groupedKeys = Object.keys(grouped);
455
+ const result = {};
456
+ for (let i = 0; i < groupedKeys.length; i++) {
457
+ const id = (groupedKeys[i]).toString(); // some currencies are numeric
458
+ const code = this.safeCurrencyCode(id);
459
+ const networksRaw = grouped[id];
460
+ const networks = {};
461
+ for (let j = 0; j < networksRaw.length; j++) {
462
+ const networkEntry = networksRaw[j];
463
+ const networkId = this.safeString(networkEntry, 'chain');
464
+ const networkCode = this.networkIdToCode(networkId);
465
+ networks[networkCode] = {
466
+ 'id': networkId,
467
+ 'network': networkCode,
468
+ 'limits': {
469
+ 'withdraw': {
470
+ 'min': this.safeNumber(networkEntry, 'min'),
471
+ 'max': undefined,
472
+ },
473
+ 'deposit': {
474
+ 'min': this.safeNumber(networkEntry, 'minTransfer'),
475
+ 'max': undefined,
476
+ },
477
+ },
478
+ 'active': undefined,
479
+ 'deposit': undefined,
480
+ 'withdraw': this.safeBool(networkEntry, 'canWithDraw'),
481
+ 'fee': this.safeNumber(networkEntry, 'fee'),
482
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(networkEntry, 'transferAmtScale'))),
483
+ 'info': networkEntry,
484
+ };
485
+ }
486
+ result[code] = this.safeCurrencyStructure({
487
+ 'id': id,
488
+ 'code': code,
489
+ 'precision': undefined,
490
+ 'type': undefined,
491
+ 'name': undefined,
492
+ 'active': undefined,
493
+ 'deposit': undefined,
494
+ 'withdraw': undefined,
495
+ 'fee': undefined,
496
+ 'limits': {
497
+ 'withdraw': {
498
+ 'min': undefined,
499
+ 'max': undefined,
500
+ },
501
+ 'deposit': {
502
+ 'min': undefined,
503
+ 'max': undefined,
504
+ },
505
+ },
506
+ 'networks': networks,
507
+ 'info': networksRaw,
508
+ });
509
+ }
510
+ return result;
511
+ }
416
512
  /**
417
513
  * @method
418
514
  * @name lbank#fetchMarkets
@@ -2168,13 +2264,10 @@ class lbank extends lbank$1 {
2168
2264
  const result = this.safeValue(response, 'data');
2169
2265
  const address = this.safeString(result, 'address');
2170
2266
  const tag = this.safeString(result, 'memo');
2171
- const networkId = this.safeString(result, 'netWork');
2172
- const inverseNetworks = this.safeValue(this.options, 'inverse-networks', {});
2173
- const networkCode = this.safeStringUpper(inverseNetworks, networkId, networkId);
2174
2267
  return {
2175
2268
  'info': response,
2176
2269
  'currency': code,
2177
- 'network': networkCode,
2270
+ 'network': this.networkIdToCode(this.safeString(result, 'netWork')),
2178
2271
  'address': address,
2179
2272
  'tag': tag,
2180
2273
  };
@@ -2209,12 +2302,10 @@ class lbank extends lbank$1 {
2209
2302
  const result = this.safeValue(response, 'data');
2210
2303
  const address = this.safeString(result, 'address');
2211
2304
  const tag = this.safeString(result, 'memo');
2212
- const inverseNetworks = this.safeValue(this.options, 'inverse-networks', {});
2213
- const networkCode = this.safeStringUpper(inverseNetworks, network, network);
2214
2305
  return {
2215
2306
  'info': response,
2216
2307
  'currency': code,
2217
- 'network': networkCode,
2308
+ 'network': undefined,
2218
2309
  'address': address,
2219
2310
  'tag': tag,
2220
2311
  };
@@ -2338,9 +2429,6 @@ class lbank extends lbank$1 {
2338
2429
  }
2339
2430
  const txid = this.safeString(transaction, 'txId');
2340
2431
  const timestamp = this.safeInteger2(transaction, 'insertTime', 'applyTime');
2341
- const networks = this.safeValue(this.options, 'inverse-networks', {});
2342
- const networkId = this.safeString(transaction, 'networkName');
2343
- const network = this.safeString(networks, networkId, networkId);
2344
2432
  const address = this.safeString(transaction, 'address');
2345
2433
  let addressFrom = undefined;
2346
2434
  let addressTo = undefined;
@@ -2368,7 +2456,7 @@ class lbank extends lbank$1 {
2368
2456
  'txid': txid,
2369
2457
  'timestamp': timestamp,
2370
2458
  'datetime': this.iso8601(timestamp),
2371
- 'network': network,
2459
+ 'network': this.networkIdToCode(this.safeString(transaction, 'networkName')),
2372
2460
  'address': address,
2373
2461
  'addressTo': addressTo,
2374
2462
  'addressFrom': addressFrom,
@@ -2571,10 +2659,9 @@ class lbank extends lbank$1 {
2571
2659
  withdrawFees[code] = {};
2572
2660
  for (let j = 0; j < networkList.length; j++) {
2573
2661
  const networkEntry = networkList[j];
2574
- const networkId = this.safeString(networkEntry, 'name');
2575
- const networkCode = this.safeString(this.options['inverse-networks'], networkId, networkId);
2576
2662
  const fee = this.safeNumber(networkEntry, 'withdrawFee');
2577
2663
  if (fee !== undefined) {
2664
+ const networkCode = this.networkIdToCode(this.safeString(networkEntry, 'name'));
2578
2665
  withdrawFees[code][networkCode] = fee;
2579
2666
  }
2580
2667
  }
@@ -2626,8 +2713,7 @@ class lbank extends lbank$1 {
2626
2713
  if (canWithdraw === 'true') {
2627
2714
  const currencyId = this.safeString(item, 'assetCode');
2628
2715
  const codeInner = this.safeCurrencyCode(currencyId);
2629
- const chain = this.safeString(item, 'chain');
2630
- let network = this.safeString(this.options['inverse-networks'], chain, chain);
2716
+ let network = this.networkIdToCode(this.safeString(item, 'chain'));
2631
2717
  if (network === undefined) {
2632
2718
  network = codeInner;
2633
2719
  }
@@ -2778,8 +2864,7 @@ class lbank extends lbank$1 {
2778
2864
  const resultCodeInfo = result[code]['info'];
2779
2865
  resultCodeInfo.push(fee);
2780
2866
  }
2781
- const chain = this.safeString(fee, 'chain');
2782
- const networkCode = this.safeString(this.options['inverse-networks'], chain, chain);
2867
+ const networkCode = this.networkIdToCode(this.safeString(fee, 'chain'));
2783
2868
  if (networkCode !== undefined) {
2784
2869
  result[code]['networks'][networkCode] = {
2785
2870
  'withdraw': {
@@ -2835,8 +2920,7 @@ class lbank extends lbank$1 {
2835
2920
  const networkList = this.safeValue(fee, 'networkList', []);
2836
2921
  for (let j = 0; j < networkList.length; j++) {
2837
2922
  const networkEntry = networkList[j];
2838
- const networkId = this.safeString(networkEntry, 'name');
2839
- const networkCode = this.safeStringUpper(this.options['inverse-networks'], networkId, networkId);
2923
+ const networkCode = this.networkIdToCode(this.safeString(networkEntry, 'name'));
2840
2924
  const withdrawFee = this.safeNumber(networkEntry, 'withdrawFee');
2841
2925
  const isDefault = this.safeValue(networkEntry, 'isDefault');
2842
2926
  if (withdrawFee !== undefined) {
@@ -840,6 +840,7 @@ class mexc extends mexc$1 {
840
840
  'PROS': 'PROSFINANCE',
841
841
  'SIN': 'SINCITYTOKEN',
842
842
  'SOUL': 'SOULSWAP',
843
+ 'XBT': 'XBT', // restore original mapping
843
844
  },
844
845
  'exceptions': {
845
846
  'exact': {
@@ -1702,7 +1702,7 @@ class modetrade extends modetrade$1 {
1702
1702
  //
1703
1703
  // {
1704
1704
  // "success": true,
1705
- // "timestamp": 1702989203989,
1705
+ // "timestamp": 1702989203988,
1706
1706
  // "data": {
1707
1707
  // "status": "CANCEL_SENT"
1708
1708
  // }
@@ -1710,7 +1710,7 @@ class modetrade extends modetrade$1 {
1710
1710
  //
1711
1711
  // {
1712
1712
  // "success": true,
1713
- // "timestamp": 1702989203989,
1713
+ // "timestamp": 1702989203988,
1714
1714
  // "status": "CANCEL_SENT"
1715
1715
  // }
1716
1716
  //
@@ -5142,7 +5142,7 @@ class okx extends okx$1 {
5142
5142
  let fee = this.safeString(params, 'fee');
5143
5143
  if (fee === undefined) {
5144
5144
  const currencies = await this.fetchCurrencies();
5145
- this.currencies = this.deepExtend(this.currencies, currencies);
5145
+ this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, currencies));
5146
5146
  const targetNetwork = this.safeDict(currency['networks'], this.networkIdToCode(network), {});
5147
5147
  fee = this.safeString(targetNetwork, 'fee');
5148
5148
  if (fee === undefined) {
@@ -7197,7 +7197,7 @@ class okx extends okx$1 {
7197
7197
  /**
7198
7198
  * @method
7199
7199
  * @name okx#fetchBorrowInterest
7200
- * @description fetch the interest owed by the user for borrowing currency for margin trading
7200
+ * @description fetch the interest owed b the user for borrowing currency for margin trading
7201
7201
  * @see https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-data
7202
7202
  * @param {string} code the unified currency code for the currency of the interest
7203
7203
  * @param {string} symbol the market symbol of an isolated margin market, if undefined, the interest for cross margin markets is returned
@@ -789,7 +789,7 @@ class paradex extends paradex$1 {
789
789
  // "ask": "69578.2",
790
790
  // "volume_24h": "5815541.397939004",
791
791
  // "total_volume": "584031465.525259686",
792
- // "created_at": 1718170156580,
792
+ // "created_at": 1718170156581,
793
793
  // "underlying_price": "67367.37268422",
794
794
  // "open_interest": "162.272",
795
795
  // "funding_rate": "0.01629574927887",
@@ -520,7 +520,7 @@ class bitstamp extends bitstamp$1 {
520
520
  //
521
521
  const sessionToken = this.safeString(response, 'token');
522
522
  if (sessionToken !== undefined) {
523
- const userId = this.safeNumber(response, 'user_id');
523
+ const userId = this.safeString(response, 'user_id');
524
524
  const validity = this.safeIntegerProduct(response, 'valid_sec', 1000);
525
525
  this.options['expiresIn'] = this.sum(time, validity);
526
526
  this.options['userId'] = userId;