ccxt 4.3.44 → 4.3.46

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 (64) hide show
  1. package/README.md +130 -130
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +6 -1
  4. package/dist/cjs/src/abstract/oxfun.js +9 -0
  5. package/dist/cjs/src/base/Exchange.js +1 -0
  6. package/dist/cjs/src/binance.js +2 -0
  7. package/dist/cjs/src/bingx.js +25 -17
  8. package/dist/cjs/src/bitmart.js +5 -0
  9. package/dist/cjs/src/bitstamp.js +18 -2
  10. package/dist/cjs/src/bitteam.js +5 -7
  11. package/dist/cjs/src/coinmetro.js +8 -17
  12. package/dist/cjs/src/hyperliquid.js +29 -21
  13. package/dist/cjs/src/idex.js +1 -0
  14. package/dist/cjs/src/kucoin.js +28 -1
  15. package/dist/cjs/src/luno.js +9 -1
  16. package/dist/cjs/src/mexc.js +8 -6
  17. package/dist/cjs/src/okx.js +1 -0
  18. package/dist/cjs/src/oxfun.js +2900 -0
  19. package/dist/cjs/src/pro/binanceus.js +0 -8
  20. package/dist/cjs/src/pro/oxfun.js +1034 -0
  21. package/dist/cjs/src/tokocrypto.js +8 -10
  22. package/dist/cjs/src/wavesexchange.js +122 -110
  23. package/dist/cjs/src/woofipro.js +1 -0
  24. package/dist/cjs/src/xt.js +1 -1
  25. package/js/ccxt.d.ts +8 -2
  26. package/js/ccxt.js +6 -2
  27. package/js/src/abstract/binance.d.ts +2 -0
  28. package/js/src/abstract/binancecoinm.d.ts +2 -0
  29. package/js/src/abstract/binanceus.d.ts +2 -0
  30. package/js/src/abstract/binanceusdm.d.ts +2 -0
  31. package/js/src/abstract/bitstamp.d.ts +16 -0
  32. package/js/src/abstract/kucoin.d.ts +14 -0
  33. package/js/src/abstract/kucoinfutures.d.ts +14 -0
  34. package/js/src/abstract/mexc.d.ts +2 -0
  35. package/js/src/abstract/oxfun.d.ts +37 -0
  36. package/js/src/abstract/oxfun.js +11 -0
  37. package/js/src/base/Exchange.d.ts +1 -0
  38. package/js/src/base/Exchange.js +1 -0
  39. package/js/src/binance.js +2 -0
  40. package/js/src/bingx.js +26 -18
  41. package/js/src/bitmart.js +5 -0
  42. package/js/src/bitstamp.js +18 -2
  43. package/js/src/bitteam.js +6 -8
  44. package/js/src/coinmetro.js +9 -18
  45. package/js/src/hyperliquid.d.ts +3 -3
  46. package/js/src/hyperliquid.js +29 -21
  47. package/js/src/idex.js +1 -0
  48. package/js/src/kucoin.js +28 -1
  49. package/js/src/luno.d.ts +1 -1
  50. package/js/src/luno.js +9 -1
  51. package/js/src/mexc.js +8 -6
  52. package/js/src/okx.js +1 -0
  53. package/js/src/oxfun.d.ts +129 -0
  54. package/js/src/oxfun.js +2901 -0
  55. package/js/src/pro/binanceus.js +0 -8
  56. package/js/src/pro/oxfun.d.ts +38 -0
  57. package/js/src/pro/oxfun.js +1035 -0
  58. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  59. package/js/src/tokocrypto.js +9 -11
  60. package/js/src/wavesexchange.d.ts +7 -7
  61. package/js/src/wavesexchange.js +123 -111
  62. package/js/src/woofipro.js +1 -0
  63. package/js/src/xt.js +1 -1
  64. package/package.json +1 -1
@@ -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(): 0 | 1 | -1;
18
+ protected signum(): 1 | 0 | -1;
19
19
  toByteArray(): number[];
20
20
  protected equals(a: BigInteger): boolean;
21
21
  protected min(a: BigInteger): BigInteger;
@@ -6,7 +6,7 @@
6
6
 
7
7
  // ---------------------------------------------------------------------------
8
8
  import Exchange from './abstract/tokocrypto.js';
9
- import { TRUNCATE, DECIMAL_PLACES } from './base/functions/number.js';
9
+ import { TRUNCATE, TICK_SIZE } from './base/functions/number.js';
10
10
  import { ExchangeError, ExchangeNotAvailable, InsufficientFunds, OrderNotFound, InvalidOrder, DDoSProtection, InvalidNonce, AuthenticationError, RateLimitExceeded, PermissionDenied, NotSupported, BadRequest, BadSymbol, AccountSuspended, OrderImmediatelyFillable, OnMaintenance, BadResponse, RequestTimeout, OrderNotFillable, MarginModeAlreadySet, ArgumentsRequired } from './base/errors.js';
11
11
  import { Precise } from './base/Precise.js';
12
12
  import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
@@ -213,7 +213,7 @@ export default class tokocrypto extends Exchange {
213
213
  'maker': this.parseNumber('0.0075'), // 0.1% trading fee, zero fees for all trading pairs before November 1
214
214
  },
215
215
  },
216
- 'precisionMode': DECIMAL_PLACES,
216
+ 'precisionMode': TICK_SIZE,
217
217
  'options': {
218
218
  // 'fetchTradesMethod': 'binanceGetTrades', // binanceGetTrades, binanceGetAggTrades
219
219
  'createMarketBuyOrderRequiresPrice': true,
@@ -720,10 +720,10 @@ export default class tokocrypto extends Exchange {
720
720
  'strike': undefined,
721
721
  'optionType': undefined,
722
722
  'precision': {
723
- 'amount': this.safeInteger(market, 'quantityPrecision'),
724
- 'price': this.safeInteger(market, 'pricePrecision'),
725
- 'base': this.safeInteger(market, 'baseAssetPrecision'),
726
- 'quote': this.safeInteger(market, 'quotePrecision'),
723
+ 'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'quantityPrecision'))),
724
+ 'price': this.parseNumber(this.parsePrecision(this.safeString(market, 'pricePrecision'))),
725
+ 'base': this.parseNumber(this.parsePrecision(this.safeString(market, 'baseAssetPrecision'))),
726
+ 'quote': this.parseNumber(this.parsePrecision(this.safeString(market, 'quotePrecision'))),
727
727
  },
728
728
  'limits': {
729
729
  'leverage': {
@@ -748,8 +748,7 @@ export default class tokocrypto extends Exchange {
748
748
  };
749
749
  if ('PRICE_FILTER' in filtersByType) {
750
750
  const filter = this.safeValue(filtersByType, 'PRICE_FILTER', {});
751
- const tickSize = this.safeString(filter, 'tickSize');
752
- entry['precision']['price'] = this.precisionFromString(tickSize);
751
+ entry['precision']['price'] = this.safeNumber(filter, 'tickSize');
753
752
  // PRICE_FILTER reports zero values for maxPrice
754
753
  // since they updated filter types in November 2018
755
754
  // https://github.com/ccxt/ccxt/issues/4286
@@ -758,12 +757,11 @@ export default class tokocrypto extends Exchange {
758
757
  'min': this.safeNumber(filter, 'minPrice'),
759
758
  'max': this.safeNumber(filter, 'maxPrice'),
760
759
  };
761
- entry['precision']['price'] = this.precisionFromString(filter['tickSize']);
760
+ entry['precision']['price'] = filter['tickSize'];
762
761
  }
763
762
  if ('LOT_SIZE' in filtersByType) {
764
763
  const filter = this.safeValue(filtersByType, 'LOT_SIZE', {});
765
- const stepSize = this.safeString(filter, 'stepSize');
766
- entry['precision']['amount'] = this.precisionFromString(stepSize);
764
+ entry['precision']['amount'] = this.safeNumber(filter, 'stepSize');
767
765
  entry['limits']['amount'] = {
768
766
  'min': this.safeNumber(filter, 'minQty'),
769
767
  'max': this.safeNumber(filter, 'maxQty'),
@@ -43,13 +43,12 @@ export default class wavesexchange extends Exchange {
43
43
  getMatcherPublicKey(): Promise<any>;
44
44
  getAssetBytes(currencyId: any): Uint8Array;
45
45
  getAssetId(currencyId: any): any;
46
- customPriceToPrecision(symbol: any, price: any): number;
47
- customAmountToPrecision(symbol: any, amount: any): number;
48
- customCurrencyToPrecision(code: any, amount: any, networkCode?: any): number;
49
- fromPrecision(amount: any, scale: any): string;
50
- toPrecision(amount: any, scale: any): string;
51
- currencyFromPrecision(currency: any, amount: any): string;
52
- priceFromPrecision(symbol: any, price: any): string;
46
+ toRealCurrencyAmount(code: string, amount: number, networkCode?: any): number;
47
+ fromRealCurrencyAmount(code: string, amountString: string): string;
48
+ toRealSymbolPrice(symbol: string, price: number): number;
49
+ fromRealSymbolPrice(symbol: string, priceString: string): string;
50
+ toRealSymbolAmount(symbol: string, amount: number): number;
51
+ fromRealSymbolAmount(symbol: string, amountString: string): string;
53
52
  safeGetDynamic(settings: any): any;
54
53
  safeGetRates(dynamic: any): any;
55
54
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
@@ -63,6 +62,7 @@ export default class wavesexchange extends Exchange {
63
62
  parseOrder(order: Dict, market?: Market): Order;
64
63
  getWavesAddress(): Promise<any>;
65
64
  fetchBalance(params?: {}): Promise<Balances>;
65
+ setUndefinedBalancesToZero(balances: any, key?: string): any;
66
66
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
67
67
  fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
68
68
  parseTrade(trade: Dict, market?: Market): Trade;
@@ -9,7 +9,7 @@ import Exchange from './abstract/wavesexchange.js';
9
9
  import { AuthenticationError, InsufficientFunds, InvalidOrder, AccountSuspended, ExchangeError, DuplicateOrderId, OrderNotFound, BadSymbol, ExchangeNotAvailable, BadRequest, ArgumentsRequired } from './base/errors.js';
10
10
  import { Precise } from './base/Precise.js';
11
11
  import { ed25519 } from './static_dependencies/noble-curves/ed25519.js';
12
- import { DECIMAL_PLACES } from './base/functions/number.js';
12
+ import { TICK_SIZE } from './base/functions/number.js';
13
13
  // ---------------------------------------------------------------------------
14
14
  /**
15
15
  * @class wavesexchange
@@ -23,6 +23,7 @@ export default class wavesexchange extends Exchange {
23
23
  'countries': ['CH'],
24
24
  'certified': false,
25
25
  'pro': false,
26
+ 'dex': true,
26
27
  'has': {
27
28
  'CORS': undefined,
28
29
  'spot': true,
@@ -318,9 +319,9 @@ export default class wavesexchange extends Exchange {
318
319
  },
319
320
  },
320
321
  'currencies': {
321
- 'WX': this.safeCurrencyStructure({ 'id': 'EMAMLxDnv3xiz8RXg8Btj33jcEw3wLczL3JKYYmuubpc', 'numericId': undefined, 'code': 'WX', 'precision': this.parseToInt('8') }),
322
+ 'WX': this.safeCurrencyStructure({ 'id': 'EMAMLxDnv3xiz8RXg8Btj33jcEw3wLczL3JKYYmuubpc', 'numericId': undefined, 'code': 'WX', 'precision': this.parseNumber('1e-8') }),
322
323
  },
323
- 'precisionMode': DECIMAL_PLACES,
324
+ 'precisionMode': TICK_SIZE,
324
325
  'options': {
325
326
  'allowedCandles': 1440,
326
327
  'accessToken': undefined,
@@ -331,7 +332,7 @@ export default class wavesexchange extends Exchange {
331
332
  'wavesAddress': undefined,
332
333
  'withdrawFeeUSDN': 7420,
333
334
  'withdrawFeeWAVES': 100000,
334
- 'wavesPrecision': 8,
335
+ 'wavesPrecision': 1e-8,
335
336
  'messagePrefix': 'W',
336
337
  'networks': {
337
338
  'ERC20': 'ETH',
@@ -379,8 +380,8 @@ export default class wavesexchange extends Exchange {
379
380
  async getFeesForAsset(symbol, side, amount, price, params = {}) {
380
381
  await this.loadMarkets();
381
382
  const market = this.market(symbol);
382
- amount = this.customAmountToPrecision(symbol, amount);
383
- price = this.customPriceToPrecision(symbol, price);
383
+ amount = this.toRealSymbolAmount(symbol, amount);
384
+ price = this.toRealSymbolPrice(symbol, price);
384
385
  const request = this.extend({
385
386
  'baseId': market['baseId'],
386
387
  'quoteId': market['quoteId'],
@@ -413,7 +414,7 @@ export default class wavesexchange extends Exchange {
413
414
  const matcherFee = this.safeString(mode, 'matcherFee');
414
415
  const feeAssetId = this.safeString(mode, 'feeAssetId');
415
416
  const feeAsset = this.safeCurrencyCode(feeAssetId);
416
- const adjustedMatcherFee = this.currencyFromPrecision(feeAsset, matcherFee);
417
+ const adjustedMatcherFee = this.fromRealCurrencyAmount(feeAsset, matcherFee);
417
418
  const amountAsString = this.numberToString(amount);
418
419
  const priceAsString = this.numberToString(price);
419
420
  const feeCost = this.feeToPrecision(symbol, this.parseNumber(adjustedMatcherFee));
@@ -566,8 +567,8 @@ export default class wavesexchange extends Exchange {
566
567
  'strike': undefined,
567
568
  'optionType': undefined,
568
569
  'precision': {
569
- 'amount': this.safeInteger(entry, 'amountAssetDecimals'),
570
- 'price': this.safeInteger(entry, 'priceAssetDecimals'),
570
+ 'amount': this.parseNumber(this.parsePrecision(this.safeString(entry, 'amountAssetDecimals'))),
571
+ 'price': this.parseNumber(this.parsePrecision(this.safeString(entry, 'priceAssetDecimals'))),
571
572
  },
572
573
  'limits': {
573
574
  'leverage': {
@@ -624,12 +625,11 @@ export default class wavesexchange extends Exchange {
624
625
  }
625
626
  parseOrderBookSide(bookSide, market = undefined, limit = undefined) {
626
627
  const precision = market['precision'];
627
- const wavesPrecision = this.safeString(this.options, 'wavesPrecision', '8');
628
- const amountPrecision = '1e' + this.numberToString(precision['amount']);
629
- const amountPrecisionString = this.numberToString(precision['amount']);
630
- const pricePrecisionString = this.numberToString(precision['price']);
631
- const difference = Precise.stringSub(amountPrecisionString, pricePrecisionString);
632
- const pricePrecision = '1e' + Precise.stringSub(wavesPrecision, difference);
628
+ const wavesPrecision = this.safeString(this.options, 'wavesPrecision', '1e-8');
629
+ const amountPrecisionString = this.safeString(precision, 'amount');
630
+ const pricePrecisionString = this.safeString(precision, 'price');
631
+ const difference = Precise.stringDiv(amountPrecisionString, pricePrecisionString);
632
+ const pricePrecision = Precise.stringDiv(wavesPrecision, difference);
633
633
  const result = [];
634
634
  for (let i = 0; i < bookSide.length; i++) {
635
635
  const entry = bookSide[i];
@@ -638,10 +638,10 @@ export default class wavesexchange extends Exchange {
638
638
  let price = undefined;
639
639
  let amount = undefined;
640
640
  if ((pricePrecision !== undefined) && (entryPrice !== undefined)) {
641
- price = Precise.stringDiv(entryPrice, pricePrecision);
641
+ price = Precise.stringMul(entryPrice, pricePrecision);
642
642
  }
643
- if ((amountPrecision !== undefined) && (entryAmount !== undefined)) {
644
- amount = Precise.stringDiv(entryAmount, amountPrecision);
643
+ if ((amountPrecisionString !== undefined) && (entryAmount !== undefined)) {
644
+ amount = Precise.stringMul(entryAmount, amountPrecisionString);
645
645
  }
646
646
  if ((limit !== undefined) && (i > limit)) {
647
647
  break;
@@ -1227,51 +1227,36 @@ export default class wavesexchange extends Exchange {
1227
1227
  }
1228
1228
  return currencyId;
1229
1229
  }
1230
- customPriceToPrecision(symbol, price) {
1231
- const market = this.markets[symbol];
1232
- const wavesPrecision = this.safeString(this.options, 'wavesPrecision', '8');
1233
- const amount = this.numberToString(market['precision']['amount']);
1234
- const precisionPrice = this.numberToString(market['precision']['price']);
1235
- const difference = Precise.stringSub(amount, precisionPrice);
1236
- const precision = Precise.stringSub(wavesPrecision, difference);
1237
- const pricePrecision = this.toPrecision(price, precision).toString();
1238
- return this.parseToInt(parseFloat(pricePrecision));
1239
- }
1240
- customAmountToPrecision(symbol, amount) {
1241
- const amountPrecision = this.numberToString(this.toPrecision(amount, this.numberToString(this.markets[symbol]['precision']['amount'])));
1242
- return this.parseToInt(parseFloat(amountPrecision));
1230
+ toRealCurrencyAmount(code, amount, networkCode = undefined) {
1231
+ const currency = this.currency(code);
1232
+ const stringValue = Precise.stringDiv(this.numberToString(amount), this.safeString(currency, 'precision'));
1233
+ return parseInt(stringValue);
1243
1234
  }
1244
- customCurrencyToPrecision(code, amount, networkCode = undefined) {
1245
- const amountPrecision = this.numberToString(this.toPrecision(amount, this.currencies[code]['precision']));
1246
- return this.parseToInt(parseFloat(amountPrecision));
1235
+ fromRealCurrencyAmount(code, amountString) {
1236
+ if (!(code in this.currencies)) {
1237
+ return amountString;
1238
+ }
1239
+ const currency = this.currency(code);
1240
+ const precisionAmount = this.safeString(currency, 'precision');
1241
+ return Precise.stringMul(amountString, precisionAmount);
1247
1242
  }
1248
- fromPrecision(amount, scale) {
1249
- if (amount === undefined) {
1250
- return undefined;
1251
- }
1252
- const precise = new Precise(amount);
1253
- precise.decimals = this.sum(precise.decimals, scale);
1254
- precise.reduce();
1255
- return precise.toString();
1243
+ toRealSymbolPrice(symbol, price) {
1244
+ const market = this.market(symbol);
1245
+ const stringValue = Precise.stringDiv(this.numberToString(price), this.safeString(market['precision'], 'price'));
1246
+ return parseInt(stringValue);
1256
1247
  }
1257
- toPrecision(amount, scale) {
1258
- const amountString = this.numberToString(amount);
1259
- const precise = new Precise(amountString);
1260
- // precise.decimals should be integer
1261
- precise.decimals = this.parseToInt(Precise.stringSub(this.numberToString(precise.decimals), this.numberToString(scale)));
1262
- precise.reduce();
1263
- const stringValue = precise.toString();
1264
- return stringValue;
1248
+ fromRealSymbolPrice(symbol, priceString) {
1249
+ const market = this.markets[symbol];
1250
+ return Precise.stringMul(priceString, this.safeString(market['precision'], 'price'));
1265
1251
  }
1266
- currencyFromPrecision(currency, amount) {
1267
- const scale = this.currencies[currency]['precision'];
1268
- return this.fromPrecision(amount, scale);
1252
+ toRealSymbolAmount(symbol, amount) {
1253
+ const market = this.market(symbol);
1254
+ const stringValue = Precise.stringDiv(this.numberToString(amount), this.safeString(market['precision'], 'amount'));
1255
+ return parseInt(stringValue);
1269
1256
  }
1270
- priceFromPrecision(symbol, price) {
1257
+ fromRealSymbolAmount(symbol, amountString) {
1271
1258
  const market = this.markets[symbol];
1272
- const wavesPrecision = this.safeInteger(this.options, 'wavesPrecision', 8);
1273
- const scale = this.sum(wavesPrecision, market['precision']['price']) - market['precision']['amount'];
1274
- return this.fromPrecision(price, scale);
1259
+ return Precise.stringMul(amountString, market['precision']['amount']);
1275
1260
  }
1276
1261
  safeGetDynamic(settings) {
1277
1262
  const orderFee = this.safeValue(settings, 'orderFee');
@@ -1353,7 +1338,7 @@ export default class wavesexchange extends Exchange {
1353
1338
  }
1354
1339
  const matcherFeeAsset = this.safeCurrencyCode(matcherFeeAssetId);
1355
1340
  const rawMatcherFee = (matcherFeeAssetId === baseFeeAssetId) ? baseMatcherFee : discountMatcherFee;
1356
- const floatMatcherFee = parseFloat(this.currencyFromPrecision(matcherFeeAsset, rawMatcherFee));
1341
+ const floatMatcherFee = parseFloat(this.fromRealCurrencyAmount(matcherFeeAsset, rawMatcherFee));
1357
1342
  if ((matcherFeeAsset in balances) && (balances[matcherFeeAsset]['free'] >= floatMatcherFee)) {
1358
1343
  matcherFee = parseInt(rawMatcherFee);
1359
1344
  }
@@ -1361,26 +1346,26 @@ export default class wavesexchange extends Exchange {
1361
1346
  throw new InsufficientFunds(this.id + ' not enough funds of the selected asset fee');
1362
1347
  }
1363
1348
  }
1349
+ const floatBaseMatcherFee = this.fromRealCurrencyAmount(baseFeeAsset, baseMatcherFee);
1350
+ const floatDiscountMatcherFee = this.fromRealCurrencyAmount(discountFeeAsset, discountMatcherFee);
1364
1351
  if (matcherFeeAssetId === undefined) {
1365
1352
  // try to the pay the fee using the base first then discount asset
1366
- const floatBaseMatcherFee = parseFloat(this.currencyFromPrecision(baseFeeAsset, baseMatcherFee));
1367
- if ((baseFeeAsset in balances) && (balances[baseFeeAsset]['free'] >= floatBaseMatcherFee)) {
1353
+ if ((baseFeeAsset in balances) && (balances[baseFeeAsset]['free'] >= parseFloat(floatBaseMatcherFee))) {
1368
1354
  matcherFeeAssetId = baseFeeAssetId;
1369
1355
  matcherFee = parseInt(baseMatcherFee);
1370
1356
  }
1371
1357
  else {
1372
- const floatDiscountMatcherFee = parseFloat(this.currencyFromPrecision(discountFeeAsset, discountMatcherFee));
1373
- if ((discountFeeAsset in balances) && (balances[discountFeeAsset]['free'] >= floatDiscountMatcherFee)) {
1358
+ if ((discountFeeAsset in balances) && (balances[discountFeeAsset]['free'] >= parseFloat(floatDiscountMatcherFee))) {
1374
1359
  matcherFeeAssetId = discountFeeAssetId;
1375
1360
  matcherFee = parseInt(discountMatcherFee);
1376
1361
  }
1377
1362
  }
1378
1363
  }
1379
1364
  if (matcherFeeAssetId === undefined) {
1380
- throw new InsufficientFunds(this.id + ' not enough funds on none of the eligible asset fees');
1365
+ throw new InsufficientFunds(this.id + ' not enough funds on none of the eligible asset fees: ' + baseFeeAsset + ' ' + floatBaseMatcherFee + ' or ' + discountFeeAsset + ' ' + floatDiscountMatcherFee);
1381
1366
  }
1382
- amount = this.customAmountToPrecision(symbol, amount);
1383
- price = this.customPriceToPrecision(symbol, price);
1367
+ amount = this.toRealSymbolAmount(symbol, amount);
1368
+ price = this.toRealSymbolPrice(symbol, price);
1384
1369
  const assetPair = {
1385
1370
  'amountAsset': amountAsset,
1386
1371
  'priceAsset': priceAsset,
@@ -1418,7 +1403,7 @@ export default class wavesexchange extends Exchange {
1418
1403
  'c': {
1419
1404
  't': 'sp',
1420
1405
  'v': {
1421
- 'p': this.customPriceToPrecision(symbol, stopPrice),
1406
+ 'p': this.toRealSymbolPrice(symbol, stopPrice),
1422
1407
  },
1423
1408
  },
1424
1409
  };
@@ -1766,24 +1751,24 @@ export default class wavesexchange extends Exchange {
1766
1751
  symbol = market['symbol'];
1767
1752
  }
1768
1753
  const amountCurrency = this.safeCurrencyCode(this.safeString(assetPair, 'amountAsset', 'WAVES'));
1769
- const price = this.priceFromPrecision(symbol, priceString);
1770
- const amount = this.currencyFromPrecision(amountCurrency, amountString);
1771
- const filled = this.currencyFromPrecision(amountCurrency, filledString);
1772
- const average = this.priceFromPrecision(symbol, this.safeString(order, 'avgWeighedPrice'));
1754
+ const price = this.fromRealSymbolPrice(symbol, priceString);
1755
+ const amount = this.fromRealCurrencyAmount(amountCurrency, amountString);
1756
+ const filled = this.fromRealCurrencyAmount(amountCurrency, filledString);
1757
+ const average = this.fromRealSymbolPrice(symbol, this.safeString(order, 'avgWeighedPrice'));
1773
1758
  const status = this.parseOrderStatus(this.safeString(order, 'status'));
1774
1759
  let fee = undefined;
1775
1760
  if ('type' in order) {
1776
- const currency = this.safeCurrencyCode(this.safeString(order, 'feeAsset'));
1761
+ const code = this.safeCurrencyCode(this.safeString(order, 'feeAsset'));
1777
1762
  fee = {
1778
- 'currency': currency,
1779
- 'fee': this.parseNumber(this.currencyFromPrecision(currency, this.safeString(order, 'filledFee'))),
1763
+ 'currency': code,
1764
+ 'fee': this.parseNumber(this.fromRealCurrencyAmount(code, this.safeString(order, 'filledFee'))),
1780
1765
  };
1781
1766
  }
1782
1767
  else {
1783
- const currency = this.safeCurrencyCode(this.safeString(order, 'matcherFeeAssetId', 'WAVES'));
1768
+ const code = this.safeCurrencyCode(this.safeString(order, 'matcherFeeAssetId', 'WAVES'));
1784
1769
  fee = {
1785
- 'currency': currency,
1786
- 'fee': this.parseNumber(this.currencyFromPrecision(currency, this.safeString(order, 'matcherFee'))),
1770
+ 'currency': code,
1771
+ 'fee': this.parseNumber(this.fromRealCurrencyAmount(code, this.safeString(order, 'matcherFee'))),
1787
1772
  };
1788
1773
  }
1789
1774
  let triggerPrice = undefined;
@@ -1896,7 +1881,7 @@ export default class wavesexchange extends Exchange {
1896
1881
  // ]
1897
1882
  // }
1898
1883
  const balances = this.safeValue(totalBalance, 'balances', []);
1899
- const result = {};
1884
+ let result = {};
1900
1885
  let timestamp = undefined;
1901
1886
  const assetIds = [];
1902
1887
  const nonStandardBalances = [];
@@ -1907,17 +1892,15 @@ export default class wavesexchange extends Exchange {
1907
1892
  const issueTransaction = this.safeValue(entry, 'issueTransaction');
1908
1893
  const currencyId = this.safeString(entry, 'assetId');
1909
1894
  const balance = this.safeString(entry, 'balance');
1910
- if (issueTransaction === undefined) {
1895
+ const currencyExists = (currencyId in this.currencies_by_id);
1896
+ if (currencyExists) {
1897
+ const code = this.safeCurrencyCode(currencyId);
1898
+ result[code] = this.account();
1899
+ result[code]['total'] = this.fromRealCurrencyAmount(code, balance);
1900
+ }
1901
+ else if (issueTransaction === undefined) {
1911
1902
  assetIds.push(currencyId);
1912
1903
  nonStandardBalances.push(balance);
1913
- continue;
1914
- }
1915
- const decimals = this.safeInteger(issueTransaction, 'decimals');
1916
- let code = undefined;
1917
- if (currencyId in this.currencies_by_id) {
1918
- code = this.safeCurrencyCode(currencyId);
1919
- result[code] = this.account();
1920
- result[code]['total'] = this.fromPrecision(balance, decimals);
1921
1904
  }
1922
1905
  }
1923
1906
  const nonStandardAssets = assetIds.length;
@@ -1931,11 +1914,11 @@ export default class wavesexchange extends Exchange {
1931
1914
  const entry = data[i];
1932
1915
  const balance = nonStandardBalances[i];
1933
1916
  const inner = this.safeValue(entry, 'data');
1934
- const decimals = this.safeInteger(inner, 'precision');
1917
+ const precision = this.parsePrecision(this.safeString(inner, 'precision'));
1935
1918
  const ticker = this.safeString(inner, 'ticker');
1936
1919
  const code = this.safeCurrencyCode(ticker);
1937
1920
  result[code] = this.account();
1938
- result[code]['total'] = this.fromPrecision(balance, decimals);
1921
+ result[code]['total'] = Precise.stringMul(balance, precision);
1939
1922
  }
1940
1923
  }
1941
1924
  const currentTimestamp = this.milliseconds();
@@ -1961,12 +1944,7 @@ export default class wavesexchange extends Exchange {
1961
1944
  result[code] = this.account();
1962
1945
  }
1963
1946
  const amount = this.safeString(reservedBalance, currencyId);
1964
- if (code in this.currencies) {
1965
- result[code]['used'] = this.currencyFromPrecision(code, amount);
1966
- }
1967
- else {
1968
- result[code]['used'] = amount;
1969
- }
1947
+ result[code]['used'] = this.fromRealCurrencyAmount(code, amount);
1970
1948
  }
1971
1949
  const wavesRequest = {
1972
1950
  'address': wavesAddress,
@@ -1977,18 +1955,22 @@ export default class wavesexchange extends Exchange {
1977
1955
  // "confirmations": 0,
1978
1956
  // "balance": 909085978
1979
1957
  // }
1980
- result['WAVES'] = this.safeValue(result, 'WAVES', {});
1981
- result['WAVES']['total'] = this.currencyFromPrecision('WAVES', this.safeString(wavesTotal, 'balance'));
1982
- const codes = Object.keys(result);
1958
+ result['WAVES'] = this.safeValue(result, 'WAVES', this.account());
1959
+ result['WAVES']['total'] = this.fromRealCurrencyAmount('WAVES', this.safeString(wavesTotal, 'balance'));
1960
+ result = this.setUndefinedBalancesToZero(result);
1961
+ result['timestamp'] = timestamp;
1962
+ result['datetime'] = this.iso8601(timestamp);
1963
+ return this.safeBalance(result);
1964
+ }
1965
+ setUndefinedBalancesToZero(balances, key = 'used') {
1966
+ const codes = Object.keys(balances);
1983
1967
  for (let i = 0; i < codes.length; i++) {
1984
1968
  const code = codes[i];
1985
- if (this.safeValue(result[code], 'used') === undefined) {
1986
- result[code]['used'] = '0';
1969
+ if (this.safeValue(balances[code], 'used') === undefined) {
1970
+ balances[code][key] = '0';
1987
1971
  }
1988
1972
  }
1989
- result['timestamp'] = timestamp;
1990
- result['datetime'] = this.iso8601(timestamp);
1991
- return this.safeBalance(result);
1973
+ return balances;
1992
1974
  }
1993
1975
  async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1994
1976
  /**
@@ -2526,7 +2508,7 @@ export default class wavesexchange extends Exchange {
2526
2508
  const feeAssetId = 'WAVES';
2527
2509
  const type = 4; // transfer
2528
2510
  const version = 2;
2529
- const amountInteger = this.customCurrencyToPrecision(code, amount);
2511
+ const amountInteger = this.toRealCurrencyAmount(code, amount);
2530
2512
  const currency = this.currency(code);
2531
2513
  const timestamp = this.milliseconds();
2532
2514
  const byteArray = [
@@ -2586,18 +2568,45 @@ export default class wavesexchange extends Exchange {
2586
2568
  // "amount": 0
2587
2569
  // }
2588
2570
  //
2571
+ // withdraw new:
2572
+ // {
2573
+ // type: "4",
2574
+ // id: "2xnWTqG9ar7jEDrLxfbVyyspPZ6XZNrrw9ai9sQ81Eya",
2575
+ // fee: "100000",
2576
+ // feeAssetId: null,
2577
+ // timestamp: "1715786263807",
2578
+ // version: "2",
2579
+ // sender: "3P81LLX1kk2CSJC9L8C2enxdHB7XvnSGAEE",
2580
+ // senderPublicKey: "DdmzmXf9mty1FBE8AdVGnrncVLEAzP4gR4nWoTFAJoXz",
2581
+ // proofs: [ "RyoKwdSYv3EqotJCYftfFM9JE2j1ZpDRxKwYfiRhLAFeyNp6VfJUXNDS884XfeCeHeNypNmTCZt5NYR1ekyjCX3", ],
2582
+ // recipient: "3P9tXxu38a8tgewNEKFzourVxeqHd11ppOc",
2583
+ // assetId: null,
2584
+ // feeAsset: null,
2585
+ // amount: "2000000",
2586
+ // attachment: "",
2587
+ // }
2588
+ //
2589
2589
  currency = this.safeCurrency(undefined, currency);
2590
+ const code = currency['code'];
2591
+ const typeRaw = this.safeString(transaction, 'type');
2592
+ const type = (typeRaw === '4') ? 'withdraw' : 'deposit';
2593
+ const amount = this.parseNumber(this.fromRealCurrencyAmount(code, this.safeString(transaction, 'amount')));
2594
+ const feeString = this.safeString(transaction, 'fee');
2595
+ const feeAssetId = this.safeString(transaction, 'feeAssetId', 'WAVES');
2596
+ const feeCode = this.safeCurrencyCode(feeAssetId);
2597
+ const feeAmount = this.parseNumber(this.fromRealCurrencyAmount(feeCode, feeString));
2598
+ const timestamp = this.safeInteger(transaction, 'timestamp');
2590
2599
  return {
2591
- 'id': undefined,
2600
+ 'id': this.safeString(transaction, 'id'),
2592
2601
  'txid': undefined,
2593
- 'timestamp': undefined,
2594
- 'datetime': undefined,
2602
+ 'timestamp': timestamp,
2603
+ 'datetime': this.iso8601(timestamp),
2595
2604
  'network': undefined,
2596
- 'addressFrom': undefined,
2605
+ 'addressFrom': this.safeString(transaction, 'sender'),
2597
2606
  'address': undefined,
2598
- 'addressTo': undefined,
2599
- 'amount': undefined,
2600
- 'type': undefined,
2607
+ 'addressTo': this.safeString(transaction, 'recipient'),
2608
+ 'amount': amount,
2609
+ 'type': type,
2601
2610
  'currency': currency['code'],
2602
2611
  'status': undefined,
2603
2612
  'updated': undefined,
@@ -2606,7 +2615,10 @@ export default class wavesexchange extends Exchange {
2606
2615
  'tagTo': undefined,
2607
2616
  'comment': undefined,
2608
2617
  'internal': undefined,
2609
- 'fee': undefined,
2618
+ 'fee': {
2619
+ 'currency': feeCode,
2620
+ 'cost': feeAmount,
2621
+ },
2610
2622
  'info': transaction,
2611
2623
  };
2612
2624
  }
@@ -28,6 +28,7 @@ export default class woofipro extends Exchange {
28
28
  'version': 'v1',
29
29
  'certified': true,
30
30
  'pro': true,
31
+ 'dex': true,
31
32
  'hostname': 'dex.woo.org',
32
33
  'has': {
33
34
  'CORS': undefined,
package/js/src/xt.js CHANGED
@@ -23,7 +23,7 @@ export default class xt extends Exchange {
23
23
  // futures 1000 times per minute for each single IP -> Otherwise account locked for 10min
24
24
  'rateLimit': 100,
25
25
  'version': 'v4',
26
- 'certified': true,
26
+ 'certified': false,
27
27
  'pro': false,
28
28
  'has': {
29
29
  'CORS': false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.3.44",
3
+ "version": "4.3.46",
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",