ccxt 4.3.44 → 4.3.45
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.
- package/README.md +7 -7
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +6 -1
- package/dist/cjs/src/abstract/oxfun.js +9 -0
- package/dist/cjs/src/bitstamp.js +18 -2
- package/dist/cjs/src/kucoin.js +28 -1
- package/dist/cjs/src/luno.js +9 -1
- package/dist/cjs/src/oxfun.js +2900 -0
- package/dist/cjs/src/pro/oxfun.js +1034 -0
- package/dist/cjs/src/wavesexchange.js +121 -110
- package/dist/cjs/src/xt.js +1 -1
- package/js/ccxt.d.ts +8 -2
- package/js/ccxt.js +6 -2
- package/js/src/abstract/bitstamp.d.ts +16 -0
- package/js/src/abstract/kucoin.d.ts +14 -0
- package/js/src/abstract/kucoinfutures.d.ts +14 -0
- package/js/src/abstract/oxfun.d.ts +37 -0
- package/js/src/abstract/oxfun.js +11 -0
- package/js/src/bitstamp.js +18 -2
- package/js/src/kucoin.js +28 -1
- package/js/src/luno.d.ts +1 -1
- package/js/src/luno.js +9 -1
- package/js/src/oxfun.d.ts +129 -0
- package/js/src/oxfun.js +2901 -0
- package/js/src/pro/oxfun.d.ts +38 -0
- package/js/src/pro/oxfun.js +1035 -0
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/js/src/wavesexchange.d.ts +7 -7
- package/js/src/wavesexchange.js +122 -111
- package/js/src/xt.js +1 -1
- 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():
|
|
18
|
+
protected signum(): 1 | 0 | -1;
|
|
19
19
|
toByteArray(): number[];
|
|
20
20
|
protected equals(a: BigInteger): boolean;
|
|
21
21
|
protected min(a: BigInteger): BigInteger;
|
|
@@ -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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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;
|
package/js/src/wavesexchange.js
CHANGED
|
@@ -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 {
|
|
12
|
+
import { TICK_SIZE } from './base/functions/number.js';
|
|
13
13
|
// ---------------------------------------------------------------------------
|
|
14
14
|
/**
|
|
15
15
|
* @class wavesexchange
|
|
@@ -318,9 +318,9 @@ export default class wavesexchange extends Exchange {
|
|
|
318
318
|
},
|
|
319
319
|
},
|
|
320
320
|
'currencies': {
|
|
321
|
-
'WX': this.safeCurrencyStructure({ 'id': 'EMAMLxDnv3xiz8RXg8Btj33jcEw3wLczL3JKYYmuubpc', 'numericId': undefined, 'code': 'WX', 'precision': this.
|
|
321
|
+
'WX': this.safeCurrencyStructure({ 'id': 'EMAMLxDnv3xiz8RXg8Btj33jcEw3wLczL3JKYYmuubpc', 'numericId': undefined, 'code': 'WX', 'precision': this.parseNumber('1e-8') }),
|
|
322
322
|
},
|
|
323
|
-
'precisionMode':
|
|
323
|
+
'precisionMode': TICK_SIZE,
|
|
324
324
|
'options': {
|
|
325
325
|
'allowedCandles': 1440,
|
|
326
326
|
'accessToken': undefined,
|
|
@@ -331,7 +331,7 @@ export default class wavesexchange extends Exchange {
|
|
|
331
331
|
'wavesAddress': undefined,
|
|
332
332
|
'withdrawFeeUSDN': 7420,
|
|
333
333
|
'withdrawFeeWAVES': 100000,
|
|
334
|
-
'wavesPrecision': 8,
|
|
334
|
+
'wavesPrecision': 1e-8,
|
|
335
335
|
'messagePrefix': 'W',
|
|
336
336
|
'networks': {
|
|
337
337
|
'ERC20': 'ETH',
|
|
@@ -379,8 +379,8 @@ export default class wavesexchange extends Exchange {
|
|
|
379
379
|
async getFeesForAsset(symbol, side, amount, price, params = {}) {
|
|
380
380
|
await this.loadMarkets();
|
|
381
381
|
const market = this.market(symbol);
|
|
382
|
-
amount = this.
|
|
383
|
-
price = this.
|
|
382
|
+
amount = this.toRealSymbolAmount(symbol, amount);
|
|
383
|
+
price = this.toRealSymbolPrice(symbol, price);
|
|
384
384
|
const request = this.extend({
|
|
385
385
|
'baseId': market['baseId'],
|
|
386
386
|
'quoteId': market['quoteId'],
|
|
@@ -413,7 +413,7 @@ export default class wavesexchange extends Exchange {
|
|
|
413
413
|
const matcherFee = this.safeString(mode, 'matcherFee');
|
|
414
414
|
const feeAssetId = this.safeString(mode, 'feeAssetId');
|
|
415
415
|
const feeAsset = this.safeCurrencyCode(feeAssetId);
|
|
416
|
-
const adjustedMatcherFee = this.
|
|
416
|
+
const adjustedMatcherFee = this.fromRealCurrencyAmount(feeAsset, matcherFee);
|
|
417
417
|
const amountAsString = this.numberToString(amount);
|
|
418
418
|
const priceAsString = this.numberToString(price);
|
|
419
419
|
const feeCost = this.feeToPrecision(symbol, this.parseNumber(adjustedMatcherFee));
|
|
@@ -566,8 +566,8 @@ export default class wavesexchange extends Exchange {
|
|
|
566
566
|
'strike': undefined,
|
|
567
567
|
'optionType': undefined,
|
|
568
568
|
'precision': {
|
|
569
|
-
'amount': this.
|
|
570
|
-
'price': this.
|
|
569
|
+
'amount': this.parseNumber(this.parsePrecision(this.safeString(entry, 'amountAssetDecimals'))),
|
|
570
|
+
'price': this.parseNumber(this.parsePrecision(this.safeString(entry, 'priceAssetDecimals'))),
|
|
571
571
|
},
|
|
572
572
|
'limits': {
|
|
573
573
|
'leverage': {
|
|
@@ -624,12 +624,11 @@ export default class wavesexchange extends Exchange {
|
|
|
624
624
|
}
|
|
625
625
|
parseOrderBookSide(bookSide, market = undefined, limit = undefined) {
|
|
626
626
|
const precision = market['precision'];
|
|
627
|
-
const wavesPrecision = this.safeString(this.options, 'wavesPrecision', '8');
|
|
628
|
-
const
|
|
629
|
-
const
|
|
630
|
-
const
|
|
631
|
-
const
|
|
632
|
-
const pricePrecision = '1e' + Precise.stringSub(wavesPrecision, difference);
|
|
627
|
+
const wavesPrecision = this.safeString(this.options, 'wavesPrecision', '1e-8');
|
|
628
|
+
const amountPrecisionString = this.safeString(precision, 'amount');
|
|
629
|
+
const pricePrecisionString = this.safeString(precision, 'price');
|
|
630
|
+
const difference = Precise.stringDiv(amountPrecisionString, pricePrecisionString);
|
|
631
|
+
const pricePrecision = Precise.stringDiv(wavesPrecision, difference);
|
|
633
632
|
const result = [];
|
|
634
633
|
for (let i = 0; i < bookSide.length; i++) {
|
|
635
634
|
const entry = bookSide[i];
|
|
@@ -638,10 +637,10 @@ export default class wavesexchange extends Exchange {
|
|
|
638
637
|
let price = undefined;
|
|
639
638
|
let amount = undefined;
|
|
640
639
|
if ((pricePrecision !== undefined) && (entryPrice !== undefined)) {
|
|
641
|
-
price = Precise.
|
|
640
|
+
price = Precise.stringMul(entryPrice, pricePrecision);
|
|
642
641
|
}
|
|
643
|
-
if ((
|
|
644
|
-
amount = Precise.
|
|
642
|
+
if ((amountPrecisionString !== undefined) && (entryAmount !== undefined)) {
|
|
643
|
+
amount = Precise.stringMul(entryAmount, amountPrecisionString);
|
|
645
644
|
}
|
|
646
645
|
if ((limit !== undefined) && (i > limit)) {
|
|
647
646
|
break;
|
|
@@ -1227,51 +1226,36 @@ export default class wavesexchange extends Exchange {
|
|
|
1227
1226
|
}
|
|
1228
1227
|
return currencyId;
|
|
1229
1228
|
}
|
|
1230
|
-
|
|
1231
|
-
const
|
|
1232
|
-
const
|
|
1233
|
-
|
|
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));
|
|
1229
|
+
toRealCurrencyAmount(code, amount, networkCode = undefined) {
|
|
1230
|
+
const currency = this.currency(code);
|
|
1231
|
+
const stringValue = Precise.stringDiv(this.numberToString(amount), this.safeString(currency, 'precision'));
|
|
1232
|
+
return parseInt(stringValue);
|
|
1243
1233
|
}
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1234
|
+
fromRealCurrencyAmount(code, amountString) {
|
|
1235
|
+
if (!(code in this.currencies)) {
|
|
1236
|
+
return amountString;
|
|
1237
|
+
}
|
|
1238
|
+
const currency = this.currency(code);
|
|
1239
|
+
const precisionAmount = this.safeString(currency, 'precision');
|
|
1240
|
+
return Precise.stringMul(amountString, precisionAmount);
|
|
1247
1241
|
}
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
const precise = new Precise(amount);
|
|
1253
|
-
precise.decimals = this.sum(precise.decimals, scale);
|
|
1254
|
-
precise.reduce();
|
|
1255
|
-
return precise.toString();
|
|
1242
|
+
toRealSymbolPrice(symbol, price) {
|
|
1243
|
+
const market = this.market(symbol);
|
|
1244
|
+
const stringValue = Precise.stringDiv(this.numberToString(price), this.safeString(market['precision'], 'price'));
|
|
1245
|
+
return parseInt(stringValue);
|
|
1256
1246
|
}
|
|
1257
|
-
|
|
1258
|
-
const
|
|
1259
|
-
|
|
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;
|
|
1247
|
+
fromRealSymbolPrice(symbol, priceString) {
|
|
1248
|
+
const market = this.markets[symbol];
|
|
1249
|
+
return Precise.stringMul(priceString, this.safeString(market['precision'], 'price'));
|
|
1265
1250
|
}
|
|
1266
|
-
|
|
1267
|
-
const
|
|
1268
|
-
|
|
1251
|
+
toRealSymbolAmount(symbol, amount) {
|
|
1252
|
+
const market = this.market(symbol);
|
|
1253
|
+
const stringValue = Precise.stringDiv(this.numberToString(amount), this.safeString(market['precision'], 'amount'));
|
|
1254
|
+
return parseInt(stringValue);
|
|
1269
1255
|
}
|
|
1270
|
-
|
|
1256
|
+
fromRealSymbolAmount(symbol, amountString) {
|
|
1271
1257
|
const market = this.markets[symbol];
|
|
1272
|
-
|
|
1273
|
-
const scale = this.sum(wavesPrecision, market['precision']['price']) - market['precision']['amount'];
|
|
1274
|
-
return this.fromPrecision(price, scale);
|
|
1258
|
+
return Precise.stringMul(amountString, market['precision']['amount']);
|
|
1275
1259
|
}
|
|
1276
1260
|
safeGetDynamic(settings) {
|
|
1277
1261
|
const orderFee = this.safeValue(settings, 'orderFee');
|
|
@@ -1353,7 +1337,7 @@ export default class wavesexchange extends Exchange {
|
|
|
1353
1337
|
}
|
|
1354
1338
|
const matcherFeeAsset = this.safeCurrencyCode(matcherFeeAssetId);
|
|
1355
1339
|
const rawMatcherFee = (matcherFeeAssetId === baseFeeAssetId) ? baseMatcherFee : discountMatcherFee;
|
|
1356
|
-
const floatMatcherFee = parseFloat(this.
|
|
1340
|
+
const floatMatcherFee = parseFloat(this.fromRealCurrencyAmount(matcherFeeAsset, rawMatcherFee));
|
|
1357
1341
|
if ((matcherFeeAsset in balances) && (balances[matcherFeeAsset]['free'] >= floatMatcherFee)) {
|
|
1358
1342
|
matcherFee = parseInt(rawMatcherFee);
|
|
1359
1343
|
}
|
|
@@ -1361,26 +1345,26 @@ export default class wavesexchange extends Exchange {
|
|
|
1361
1345
|
throw new InsufficientFunds(this.id + ' not enough funds of the selected asset fee');
|
|
1362
1346
|
}
|
|
1363
1347
|
}
|
|
1348
|
+
const floatBaseMatcherFee = this.fromRealCurrencyAmount(baseFeeAsset, baseMatcherFee);
|
|
1349
|
+
const floatDiscountMatcherFee = this.fromRealCurrencyAmount(discountFeeAsset, discountMatcherFee);
|
|
1364
1350
|
if (matcherFeeAssetId === undefined) {
|
|
1365
1351
|
// try to the pay the fee using the base first then discount asset
|
|
1366
|
-
|
|
1367
|
-
if ((baseFeeAsset in balances) && (balances[baseFeeAsset]['free'] >= floatBaseMatcherFee)) {
|
|
1352
|
+
if ((baseFeeAsset in balances) && (balances[baseFeeAsset]['free'] >= parseFloat(floatBaseMatcherFee))) {
|
|
1368
1353
|
matcherFeeAssetId = baseFeeAssetId;
|
|
1369
1354
|
matcherFee = parseInt(baseMatcherFee);
|
|
1370
1355
|
}
|
|
1371
1356
|
else {
|
|
1372
|
-
|
|
1373
|
-
if ((discountFeeAsset in balances) && (balances[discountFeeAsset]['free'] >= floatDiscountMatcherFee)) {
|
|
1357
|
+
if ((discountFeeAsset in balances) && (balances[discountFeeAsset]['free'] >= parseFloat(floatDiscountMatcherFee))) {
|
|
1374
1358
|
matcherFeeAssetId = discountFeeAssetId;
|
|
1375
1359
|
matcherFee = parseInt(discountMatcherFee);
|
|
1376
1360
|
}
|
|
1377
1361
|
}
|
|
1378
1362
|
}
|
|
1379
1363
|
if (matcherFeeAssetId === undefined) {
|
|
1380
|
-
throw new InsufficientFunds(this.id + ' not enough funds on none of the eligible asset fees');
|
|
1364
|
+
throw new InsufficientFunds(this.id + ' not enough funds on none of the eligible asset fees: ' + baseFeeAsset + ' ' + floatBaseMatcherFee + ' or ' + discountFeeAsset + ' ' + floatDiscountMatcherFee);
|
|
1381
1365
|
}
|
|
1382
|
-
amount = this.
|
|
1383
|
-
price = this.
|
|
1366
|
+
amount = this.toRealSymbolAmount(symbol, amount);
|
|
1367
|
+
price = this.toRealSymbolPrice(symbol, price);
|
|
1384
1368
|
const assetPair = {
|
|
1385
1369
|
'amountAsset': amountAsset,
|
|
1386
1370
|
'priceAsset': priceAsset,
|
|
@@ -1418,7 +1402,7 @@ export default class wavesexchange extends Exchange {
|
|
|
1418
1402
|
'c': {
|
|
1419
1403
|
't': 'sp',
|
|
1420
1404
|
'v': {
|
|
1421
|
-
'p': this.
|
|
1405
|
+
'p': this.toRealSymbolPrice(symbol, stopPrice),
|
|
1422
1406
|
},
|
|
1423
1407
|
},
|
|
1424
1408
|
};
|
|
@@ -1766,24 +1750,24 @@ export default class wavesexchange extends Exchange {
|
|
|
1766
1750
|
symbol = market['symbol'];
|
|
1767
1751
|
}
|
|
1768
1752
|
const amountCurrency = this.safeCurrencyCode(this.safeString(assetPair, 'amountAsset', 'WAVES'));
|
|
1769
|
-
const price = this.
|
|
1770
|
-
const amount = this.
|
|
1771
|
-
const filled = this.
|
|
1772
|
-
const average = this.
|
|
1753
|
+
const price = this.fromRealSymbolPrice(symbol, priceString);
|
|
1754
|
+
const amount = this.fromRealCurrencyAmount(amountCurrency, amountString);
|
|
1755
|
+
const filled = this.fromRealCurrencyAmount(amountCurrency, filledString);
|
|
1756
|
+
const average = this.fromRealSymbolPrice(symbol, this.safeString(order, 'avgWeighedPrice'));
|
|
1773
1757
|
const status = this.parseOrderStatus(this.safeString(order, 'status'));
|
|
1774
1758
|
let fee = undefined;
|
|
1775
1759
|
if ('type' in order) {
|
|
1776
|
-
const
|
|
1760
|
+
const code = this.safeCurrencyCode(this.safeString(order, 'feeAsset'));
|
|
1777
1761
|
fee = {
|
|
1778
|
-
'currency':
|
|
1779
|
-
'fee': this.parseNumber(this.
|
|
1762
|
+
'currency': code,
|
|
1763
|
+
'fee': this.parseNumber(this.fromRealCurrencyAmount(code, this.safeString(order, 'filledFee'))),
|
|
1780
1764
|
};
|
|
1781
1765
|
}
|
|
1782
1766
|
else {
|
|
1783
|
-
const
|
|
1767
|
+
const code = this.safeCurrencyCode(this.safeString(order, 'matcherFeeAssetId', 'WAVES'));
|
|
1784
1768
|
fee = {
|
|
1785
|
-
'currency':
|
|
1786
|
-
'fee': this.parseNumber(this.
|
|
1769
|
+
'currency': code,
|
|
1770
|
+
'fee': this.parseNumber(this.fromRealCurrencyAmount(code, this.safeString(order, 'matcherFee'))),
|
|
1787
1771
|
};
|
|
1788
1772
|
}
|
|
1789
1773
|
let triggerPrice = undefined;
|
|
@@ -1896,7 +1880,7 @@ export default class wavesexchange extends Exchange {
|
|
|
1896
1880
|
// ]
|
|
1897
1881
|
// }
|
|
1898
1882
|
const balances = this.safeValue(totalBalance, 'balances', []);
|
|
1899
|
-
|
|
1883
|
+
let result = {};
|
|
1900
1884
|
let timestamp = undefined;
|
|
1901
1885
|
const assetIds = [];
|
|
1902
1886
|
const nonStandardBalances = [];
|
|
@@ -1907,17 +1891,15 @@ export default class wavesexchange extends Exchange {
|
|
|
1907
1891
|
const issueTransaction = this.safeValue(entry, 'issueTransaction');
|
|
1908
1892
|
const currencyId = this.safeString(entry, 'assetId');
|
|
1909
1893
|
const balance = this.safeString(entry, 'balance');
|
|
1910
|
-
|
|
1894
|
+
const currencyExists = (currencyId in this.currencies_by_id);
|
|
1895
|
+
if (currencyExists) {
|
|
1896
|
+
const code = this.safeCurrencyCode(currencyId);
|
|
1897
|
+
result[code] = this.account();
|
|
1898
|
+
result[code]['total'] = this.fromRealCurrencyAmount(code, balance);
|
|
1899
|
+
}
|
|
1900
|
+
else if (issueTransaction === undefined) {
|
|
1911
1901
|
assetIds.push(currencyId);
|
|
1912
1902
|
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
1903
|
}
|
|
1922
1904
|
}
|
|
1923
1905
|
const nonStandardAssets = assetIds.length;
|
|
@@ -1931,11 +1913,11 @@ export default class wavesexchange extends Exchange {
|
|
|
1931
1913
|
const entry = data[i];
|
|
1932
1914
|
const balance = nonStandardBalances[i];
|
|
1933
1915
|
const inner = this.safeValue(entry, 'data');
|
|
1934
|
-
const
|
|
1916
|
+
const precision = this.parsePrecision(this.safeString(inner, 'precision'));
|
|
1935
1917
|
const ticker = this.safeString(inner, 'ticker');
|
|
1936
1918
|
const code = this.safeCurrencyCode(ticker);
|
|
1937
1919
|
result[code] = this.account();
|
|
1938
|
-
result[code]['total'] =
|
|
1920
|
+
result[code]['total'] = Precise.stringMul(balance, precision);
|
|
1939
1921
|
}
|
|
1940
1922
|
}
|
|
1941
1923
|
const currentTimestamp = this.milliseconds();
|
|
@@ -1961,12 +1943,7 @@ export default class wavesexchange extends Exchange {
|
|
|
1961
1943
|
result[code] = this.account();
|
|
1962
1944
|
}
|
|
1963
1945
|
const amount = this.safeString(reservedBalance, currencyId);
|
|
1964
|
-
|
|
1965
|
-
result[code]['used'] = this.currencyFromPrecision(code, amount);
|
|
1966
|
-
}
|
|
1967
|
-
else {
|
|
1968
|
-
result[code]['used'] = amount;
|
|
1969
|
-
}
|
|
1946
|
+
result[code]['used'] = this.fromRealCurrencyAmount(code, amount);
|
|
1970
1947
|
}
|
|
1971
1948
|
const wavesRequest = {
|
|
1972
1949
|
'address': wavesAddress,
|
|
@@ -1977,18 +1954,22 @@ export default class wavesexchange extends Exchange {
|
|
|
1977
1954
|
// "confirmations": 0,
|
|
1978
1955
|
// "balance": 909085978
|
|
1979
1956
|
// }
|
|
1980
|
-
result['WAVES'] = this.safeValue(result, 'WAVES',
|
|
1981
|
-
result['WAVES']['total'] = this.
|
|
1982
|
-
|
|
1957
|
+
result['WAVES'] = this.safeValue(result, 'WAVES', this.account());
|
|
1958
|
+
result['WAVES']['total'] = this.fromRealCurrencyAmount('WAVES', this.safeString(wavesTotal, 'balance'));
|
|
1959
|
+
result = this.setUndefinedBalancesToZero(result);
|
|
1960
|
+
result['timestamp'] = timestamp;
|
|
1961
|
+
result['datetime'] = this.iso8601(timestamp);
|
|
1962
|
+
return this.safeBalance(result);
|
|
1963
|
+
}
|
|
1964
|
+
setUndefinedBalancesToZero(balances, key = 'used') {
|
|
1965
|
+
const codes = Object.keys(balances);
|
|
1983
1966
|
for (let i = 0; i < codes.length; i++) {
|
|
1984
1967
|
const code = codes[i];
|
|
1985
|
-
if (this.safeValue(
|
|
1986
|
-
|
|
1968
|
+
if (this.safeValue(balances[code], 'used') === undefined) {
|
|
1969
|
+
balances[code][key] = '0';
|
|
1987
1970
|
}
|
|
1988
1971
|
}
|
|
1989
|
-
|
|
1990
|
-
result['datetime'] = this.iso8601(timestamp);
|
|
1991
|
-
return this.safeBalance(result);
|
|
1972
|
+
return balances;
|
|
1992
1973
|
}
|
|
1993
1974
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1994
1975
|
/**
|
|
@@ -2526,7 +2507,7 @@ export default class wavesexchange extends Exchange {
|
|
|
2526
2507
|
const feeAssetId = 'WAVES';
|
|
2527
2508
|
const type = 4; // transfer
|
|
2528
2509
|
const version = 2;
|
|
2529
|
-
const amountInteger = this.
|
|
2510
|
+
const amountInteger = this.toRealCurrencyAmount(code, amount);
|
|
2530
2511
|
const currency = this.currency(code);
|
|
2531
2512
|
const timestamp = this.milliseconds();
|
|
2532
2513
|
const byteArray = [
|
|
@@ -2586,18 +2567,45 @@ export default class wavesexchange extends Exchange {
|
|
|
2586
2567
|
// "amount": 0
|
|
2587
2568
|
// }
|
|
2588
2569
|
//
|
|
2570
|
+
// withdraw new:
|
|
2571
|
+
// {
|
|
2572
|
+
// type: "4",
|
|
2573
|
+
// id: "2xnWTqG9ar7jEDrLxfbVyyspPZ6XZNrrw9ai9sQ81Eya",
|
|
2574
|
+
// fee: "100000",
|
|
2575
|
+
// feeAssetId: null,
|
|
2576
|
+
// timestamp: "1715786263807",
|
|
2577
|
+
// version: "2",
|
|
2578
|
+
// sender: "3P81LLX1kk2CSJC9L8C2enxdHB7XvnSGAEE",
|
|
2579
|
+
// senderPublicKey: "DdmzmXf9mty1FBE8AdVGnrncVLEAzP4gR4nWoTFAJoXz",
|
|
2580
|
+
// proofs: [ "RyoKwdSYv3EqotJCYftfFM9JE2j1ZpDRxKwYfiRhLAFeyNp6VfJUXNDS884XfeCeHeNypNmTCZt5NYR1ekyjCX3", ],
|
|
2581
|
+
// recipient: "3P9tXxu38a8tgewNEKFzourVxeqHd11ppOc",
|
|
2582
|
+
// assetId: null,
|
|
2583
|
+
// feeAsset: null,
|
|
2584
|
+
// amount: "2000000",
|
|
2585
|
+
// attachment: "",
|
|
2586
|
+
// }
|
|
2587
|
+
//
|
|
2589
2588
|
currency = this.safeCurrency(undefined, currency);
|
|
2589
|
+
const code = currency['code'];
|
|
2590
|
+
const typeRaw = this.safeString(transaction, 'type');
|
|
2591
|
+
const type = (typeRaw === '4') ? 'withdraw' : 'deposit';
|
|
2592
|
+
const amount = this.parseNumber(this.fromRealCurrencyAmount(code, this.safeString(transaction, 'amount')));
|
|
2593
|
+
const feeString = this.safeString(transaction, 'fee');
|
|
2594
|
+
const feeAssetId = this.safeString(transaction, 'feeAssetId', 'WAVES');
|
|
2595
|
+
const feeCode = this.safeCurrencyCode(feeAssetId);
|
|
2596
|
+
const feeAmount = this.parseNumber(this.fromRealCurrencyAmount(feeCode, feeString));
|
|
2597
|
+
const timestamp = this.safeInteger(transaction, 'timestamp');
|
|
2590
2598
|
return {
|
|
2591
|
-
'id':
|
|
2599
|
+
'id': this.safeString(transaction, 'id'),
|
|
2592
2600
|
'txid': undefined,
|
|
2593
|
-
'timestamp':
|
|
2594
|
-
'datetime':
|
|
2601
|
+
'timestamp': timestamp,
|
|
2602
|
+
'datetime': this.iso8601(timestamp),
|
|
2595
2603
|
'network': undefined,
|
|
2596
|
-
'addressFrom':
|
|
2604
|
+
'addressFrom': this.safeString(transaction, 'sender'),
|
|
2597
2605
|
'address': undefined,
|
|
2598
|
-
'addressTo':
|
|
2599
|
-
'amount':
|
|
2600
|
-
'type':
|
|
2606
|
+
'addressTo': this.safeString(transaction, 'recipient'),
|
|
2607
|
+
'amount': amount,
|
|
2608
|
+
'type': type,
|
|
2601
2609
|
'currency': currency['code'],
|
|
2602
2610
|
'status': undefined,
|
|
2603
2611
|
'updated': undefined,
|
|
@@ -2606,7 +2614,10 @@ export default class wavesexchange extends Exchange {
|
|
|
2606
2614
|
'tagTo': undefined,
|
|
2607
2615
|
'comment': undefined,
|
|
2608
2616
|
'internal': undefined,
|
|
2609
|
-
'fee':
|
|
2617
|
+
'fee': {
|
|
2618
|
+
'currency': feeCode,
|
|
2619
|
+
'cost': feeAmount,
|
|
2620
|
+
},
|
|
2610
2621
|
'info': transaction,
|
|
2611
2622
|
};
|
|
2612
2623
|
}
|
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':
|
|
26
|
+
'certified': false,
|
|
27
27
|
'pro': false,
|
|
28
28
|
'has': {
|
|
29
29
|
'CORS': false,
|
package/package.json
CHANGED