ccxt 4.2.43 → 4.2.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 +3 -3
- package/dist/ccxt.browser.js +1489 -463
- package/dist/ccxt.browser.min.js +6 -6
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +54 -0
- package/dist/cjs/src/binance.js +627 -51
- package/dist/cjs/src/bingx.js +46 -6
- package/dist/cjs/src/bitstamp.js +1 -1
- package/dist/cjs/src/blofin.js +2 -1
- package/dist/cjs/src/bybit.js +96 -43
- package/dist/cjs/src/coinbase.js +221 -41
- package/dist/cjs/src/deribit.js +1 -1
- package/dist/cjs/src/krakenfutures.js +3 -2
- package/dist/cjs/src/kucoin.js +9 -5
- package/dist/cjs/src/mexc.js +348 -266
- package/dist/cjs/src/pro/gate.js +76 -42
- package/dist/cjs/src/pro/hitbtc.js +1 -0
- package/dist/cjs/src/probit.js +3 -3
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/coinbase.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +4 -0
- package/js/src/base/Exchange.js +54 -0
- package/js/src/binance.d.ts +1 -0
- package/js/src/binance.js +627 -51
- package/js/src/bingx.d.ts +2 -1
- package/js/src/bingx.js +46 -6
- package/js/src/bitstamp.js +1 -1
- package/js/src/blofin.js +2 -1
- package/js/src/bybit.d.ts +4 -1
- package/js/src/bybit.js +96 -43
- package/js/src/coinbase.d.ts +10 -4
- package/js/src/coinbase.js +221 -41
- package/js/src/coinbasepro.d.ts +1 -1
- package/js/src/deribit.js +1 -1
- package/js/src/krakenfutures.js +3 -2
- package/js/src/kucoin.js +9 -5
- package/js/src/mexc.d.ts +4 -5
- package/js/src/mexc.js +348 -266
- package/js/src/pro/gate.d.ts +4 -0
- package/js/src/pro/gate.js +76 -42
- package/js/src/pro/hitbtc.js +1 -0
- package/js/src/probit.js +3 -3
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/package.json +1 -1
- package/skip-tests.json +2 -0
package/js/src/coinbase.js
CHANGED
|
@@ -65,6 +65,7 @@ export default class coinbase extends Exchange {
|
|
|
65
65
|
'fetchCrossBorrowRate': false,
|
|
66
66
|
'fetchCrossBorrowRates': false,
|
|
67
67
|
'fetchCurrencies': true,
|
|
68
|
+
'fetchDepositAddressesByNetwork': true,
|
|
68
69
|
'fetchDeposits': true,
|
|
69
70
|
'fetchFundingHistory': false,
|
|
70
71
|
'fetchFundingRate': false,
|
|
@@ -132,6 +133,7 @@ export default class coinbase extends Exchange {
|
|
|
132
133
|
'public': {
|
|
133
134
|
'get': [
|
|
134
135
|
'currencies',
|
|
136
|
+
'currencies/crypto',
|
|
135
137
|
'time',
|
|
136
138
|
'exchange-rates',
|
|
137
139
|
'users/{user_id}',
|
|
@@ -326,6 +328,10 @@ export default class coinbase extends Exchange {
|
|
|
326
328
|
'ACCOUNT_TYPE_CRYPTO',
|
|
327
329
|
'ACCOUNT_TYPE_FIAT',
|
|
328
330
|
],
|
|
331
|
+
'networks': {
|
|
332
|
+
'ERC20': 'ethereum',
|
|
333
|
+
'XLM': 'stellar',
|
|
334
|
+
},
|
|
329
335
|
'createMarketBuyOrderRequiresPrice': true,
|
|
330
336
|
'advanced': true,
|
|
331
337
|
'fetchMarkets': 'fetchMarketsV3',
|
|
@@ -681,10 +687,10 @@ export default class coinbase extends Exchange {
|
|
|
681
687
|
return this.parseTrades(buys['data'], undefined, since, limit);
|
|
682
688
|
}
|
|
683
689
|
async fetchTransactionsWithMethod(method, code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
684
|
-
|
|
690
|
+
let request = undefined;
|
|
691
|
+
[request, params] = await this.prepareAccountRequestWithCurrencyCode(code, limit, params);
|
|
685
692
|
await this.loadMarkets();
|
|
686
|
-
const
|
|
687
|
-
const response = await this[method](this.extend(request, query));
|
|
693
|
+
const response = await this[method](this.extend(request, params));
|
|
688
694
|
return this.parseTransactions(response['data'], undefined, since, limit);
|
|
689
695
|
}
|
|
690
696
|
async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -1236,15 +1242,45 @@ export default class coinbase extends Exchange {
|
|
|
1236
1242
|
const expires = this.safeInteger(options, 'expires', 1000);
|
|
1237
1243
|
const now = this.milliseconds();
|
|
1238
1244
|
if ((timestamp === undefined) || ((now - timestamp) > expires)) {
|
|
1239
|
-
const
|
|
1245
|
+
const promises = [
|
|
1246
|
+
this.v2PublicGetCurrencies(params),
|
|
1247
|
+
this.v2PublicGetCurrenciesCrypto(params),
|
|
1248
|
+
];
|
|
1249
|
+
const promisesResult = await Promise.all(promises);
|
|
1250
|
+
const fiatResponse = this.safeDict(promisesResult, 0, {});
|
|
1251
|
+
//
|
|
1252
|
+
// [
|
|
1253
|
+
// "data": {
|
|
1254
|
+
// id: 'IMP',
|
|
1255
|
+
// name: 'Isle of Man Pound',
|
|
1256
|
+
// min_size: '0.01'
|
|
1257
|
+
// },
|
|
1258
|
+
// ...
|
|
1259
|
+
// ]
|
|
1260
|
+
//
|
|
1261
|
+
const cryptoResponse = this.safeDict(promisesResult, 1, {});
|
|
1262
|
+
//
|
|
1263
|
+
// {
|
|
1264
|
+
// asset_id: '9476e3be-b731-47fa-82be-347fabc573d9',
|
|
1265
|
+
// code: 'AERO',
|
|
1266
|
+
// name: 'Aerodrome Finance',
|
|
1267
|
+
// color: '#0433FF',
|
|
1268
|
+
// sort_index: '340',
|
|
1269
|
+
// exponent: '8',
|
|
1270
|
+
// type: 'crypto',
|
|
1271
|
+
// address_regex: '^(?:0x)?[0-9a-fA-F]{40}$'
|
|
1272
|
+
// }
|
|
1273
|
+
//
|
|
1274
|
+
const fiatData = this.safeList(fiatResponse, 'data', []);
|
|
1275
|
+
const cryptoData = this.safeList(cryptoResponse, 'data', []);
|
|
1240
1276
|
const exchangeRates = await this.v2PublicGetExchangeRates(params);
|
|
1241
1277
|
this.options['fetchCurrencies'] = this.extend(options, {
|
|
1242
|
-
'currencies':
|
|
1278
|
+
'currencies': this.arrayConcat(fiatData, cryptoData),
|
|
1243
1279
|
'exchangeRates': exchangeRates,
|
|
1244
1280
|
'timestamp': now,
|
|
1245
1281
|
});
|
|
1246
1282
|
}
|
|
1247
|
-
return this.
|
|
1283
|
+
return this.safeDict(this.options, 'fetchCurrencies', {});
|
|
1248
1284
|
}
|
|
1249
1285
|
async fetchCurrencies(params = {}) {
|
|
1250
1286
|
/**
|
|
@@ -1259,18 +1295,27 @@ export default class coinbase extends Exchange {
|
|
|
1259
1295
|
const response = await this.fetchCurrenciesFromCache(params);
|
|
1260
1296
|
const currencies = this.safeValue(response, 'currencies', {});
|
|
1261
1297
|
//
|
|
1262
|
-
//
|
|
1263
|
-
//
|
|
1264
|
-
//
|
|
1265
|
-
//
|
|
1266
|
-
//
|
|
1267
|
-
//
|
|
1268
|
-
//
|
|
1269
|
-
//
|
|
1270
|
-
//
|
|
1271
|
-
//
|
|
1298
|
+
// fiat
|
|
1299
|
+
//
|
|
1300
|
+
// {
|
|
1301
|
+
// id: 'IMP',
|
|
1302
|
+
// name: 'Isle of Man Pound',
|
|
1303
|
+
// min_size: '0.01'
|
|
1304
|
+
// },
|
|
1305
|
+
//
|
|
1306
|
+
// crypto
|
|
1307
|
+
//
|
|
1308
|
+
// {
|
|
1309
|
+
// asset_id: '9476e3be-b731-47fa-82be-347fabc573d9',
|
|
1310
|
+
// code: 'AERO',
|
|
1311
|
+
// name: 'Aerodrome Finance',
|
|
1312
|
+
// color: '#0433FF',
|
|
1313
|
+
// sort_index: '340',
|
|
1314
|
+
// exponent: '8',
|
|
1315
|
+
// type: 'crypto',
|
|
1316
|
+
// address_regex: '^(?:0x)?[0-9a-fA-F]{40}$'
|
|
1317
|
+
// }
|
|
1272
1318
|
//
|
|
1273
|
-
const exchangeRates = this.safeValue(response, 'exchangeRates', {});
|
|
1274
1319
|
//
|
|
1275
1320
|
// {
|
|
1276
1321
|
// "data":{
|
|
@@ -1286,24 +1331,23 @@ export default class coinbase extends Exchange {
|
|
|
1286
1331
|
// }
|
|
1287
1332
|
// }
|
|
1288
1333
|
//
|
|
1289
|
-
const data = this.safeValue(currencies, 'data', []);
|
|
1290
|
-
const dataById = this.indexBy(data, 'id');
|
|
1291
|
-
const rates = this.safeValue(this.safeValue(exchangeRates, 'data', {}), 'rates', {});
|
|
1292
|
-
const keys = Object.keys(rates);
|
|
1293
1334
|
const result = {};
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
const currency =
|
|
1298
|
-
const
|
|
1299
|
-
const
|
|
1335
|
+
const networks = {};
|
|
1336
|
+
const networksById = {};
|
|
1337
|
+
for (let i = 0; i < currencies.length; i++) {
|
|
1338
|
+
const currency = currencies[i];
|
|
1339
|
+
const assetId = this.safeString(currency, 'asset_id');
|
|
1340
|
+
const id = this.safeString2(currency, 'id', 'code');
|
|
1300
1341
|
const code = this.safeCurrencyCode(id);
|
|
1342
|
+
const name = this.safeString(currency, 'name');
|
|
1343
|
+
this.options['networks'][code] = name.toLowerCase();
|
|
1344
|
+
this.options['networksById'][code] = name.toLowerCase();
|
|
1301
1345
|
result[code] = {
|
|
1346
|
+
'info': currency,
|
|
1302
1347
|
'id': id,
|
|
1303
1348
|
'code': code,
|
|
1304
|
-
'
|
|
1305
|
-
'
|
|
1306
|
-
'name': name,
|
|
1349
|
+
'type': (assetId !== undefined) ? 'crypto' : 'fiat',
|
|
1350
|
+
'name': this.safeString(currency, 'name'),
|
|
1307
1351
|
'active': true,
|
|
1308
1352
|
'deposit': undefined,
|
|
1309
1353
|
'withdraw': undefined,
|
|
@@ -1320,7 +1364,14 @@ export default class coinbase extends Exchange {
|
|
|
1320
1364
|
},
|
|
1321
1365
|
},
|
|
1322
1366
|
};
|
|
1367
|
+
if (assetId !== undefined) {
|
|
1368
|
+
const lowerCaseName = name.toLowerCase();
|
|
1369
|
+
networks[code] = lowerCaseName;
|
|
1370
|
+
networksById[lowerCaseName] = code;
|
|
1371
|
+
}
|
|
1323
1372
|
}
|
|
1373
|
+
this.options['networks'] = this.extend(networks, this.options['networks']);
|
|
1374
|
+
this.options['networksById'] = this.extend(networksById, this.options['networksById']);
|
|
1324
1375
|
return result;
|
|
1325
1376
|
}
|
|
1326
1377
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
@@ -1798,12 +1849,12 @@ export default class coinbase extends Exchange {
|
|
|
1798
1849
|
if (code !== undefined) {
|
|
1799
1850
|
currency = this.currency(code);
|
|
1800
1851
|
}
|
|
1801
|
-
|
|
1802
|
-
|
|
1852
|
+
let request = undefined;
|
|
1853
|
+
[request, params] = await this.prepareAccountRequestWithCurrencyCode(code, limit, params);
|
|
1803
1854
|
// for pagination use parameter 'starting_after'
|
|
1804
1855
|
// the value for the next page can be obtained from the result of the previous call in the 'pagination' field
|
|
1805
1856
|
// eg: instance.last_json_response.pagination.next_starting_after
|
|
1806
|
-
const response = await this.v2PrivateGetAccountsAccountIdTransactions(this.extend(request,
|
|
1857
|
+
const response = await this.v2PrivateGetAccountsAccountIdTransactions(this.extend(request, params));
|
|
1807
1858
|
return this.parseLedger(response['data'], currency, since, limit);
|
|
1808
1859
|
}
|
|
1809
1860
|
parseLedgerEntryStatus(status) {
|
|
@@ -2161,6 +2212,7 @@ export default class coinbase extends Exchange {
|
|
|
2161
2212
|
}
|
|
2162
2213
|
async prepareAccountRequestWithCurrencyCode(code = undefined, limit = undefined, params = {}) {
|
|
2163
2214
|
let accountId = this.safeString2(params, 'account_id', 'accountId');
|
|
2215
|
+
params = this.omit(params, ['account_id', 'accountId']);
|
|
2164
2216
|
if (accountId === undefined) {
|
|
2165
2217
|
if (code === undefined) {
|
|
2166
2218
|
throw new ArgumentsRequired(this.id + ' prepareAccountRequestWithCurrencyCode() method requires an account_id (or accountId) parameter OR a currency code argument');
|
|
@@ -2176,7 +2228,7 @@ export default class coinbase extends Exchange {
|
|
|
2176
2228
|
if (limit !== undefined) {
|
|
2177
2229
|
request['limit'] = limit;
|
|
2178
2230
|
}
|
|
2179
|
-
return request;
|
|
2231
|
+
return [request, params];
|
|
2180
2232
|
}
|
|
2181
2233
|
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
2182
2234
|
/**
|
|
@@ -3349,6 +3401,140 @@ export default class coinbase extends Exchange {
|
|
|
3349
3401
|
const data = this.safeValue(response, 'data', {});
|
|
3350
3402
|
return this.parseTransaction(data, currency);
|
|
3351
3403
|
}
|
|
3404
|
+
async fetchDepositAddressesByNetwork(code, params = {}) {
|
|
3405
|
+
/**
|
|
3406
|
+
* @method
|
|
3407
|
+
* @name ascendex#fetchDepositAddress
|
|
3408
|
+
* @description fetch the deposit address for a currency associated with this account
|
|
3409
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postcoinbaseaccountaddresses
|
|
3410
|
+
* @param {string} code unified currency code
|
|
3411
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3412
|
+
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
3413
|
+
*/
|
|
3414
|
+
await this.loadMarkets();
|
|
3415
|
+
const currency = this.currency(code);
|
|
3416
|
+
let request = undefined;
|
|
3417
|
+
[request, params] = await this.prepareAccountRequestWithCurrencyCode(currency['code']);
|
|
3418
|
+
const response = await this.v2PrivateGetAccountsAccountIdAddresses(this.extend(request, params));
|
|
3419
|
+
//
|
|
3420
|
+
// {
|
|
3421
|
+
// pagination: {
|
|
3422
|
+
// ending_before: null,
|
|
3423
|
+
// starting_after: null,
|
|
3424
|
+
// previous_ending_before: null,
|
|
3425
|
+
// next_starting_after: null,
|
|
3426
|
+
// limit: '25',
|
|
3427
|
+
// order: 'desc',
|
|
3428
|
+
// previous_uri: null,
|
|
3429
|
+
// next_uri: null
|
|
3430
|
+
// },
|
|
3431
|
+
// data: [
|
|
3432
|
+
// {
|
|
3433
|
+
// id: '64ceb5f1-5fa2-5310-a4ff-9fd46271003d',
|
|
3434
|
+
// address: '5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk',
|
|
3435
|
+
// address_info: { address: '5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk' },
|
|
3436
|
+
// name: null,
|
|
3437
|
+
// created_at: '2023-05-29T21:12:12Z',
|
|
3438
|
+
// updated_at: '2023-05-29T21:12:12Z',
|
|
3439
|
+
// network: 'solana',
|
|
3440
|
+
// uri_scheme: 'solana',
|
|
3441
|
+
// resource: 'address',
|
|
3442
|
+
// resource_path: '/v2/accounts/a7b3d387-bfb8-5ce7-b8da-1f507e81cf25/addresses/64ceb5f1-5fa2-5310-a4ff-9fd46271003d',
|
|
3443
|
+
// warnings: [
|
|
3444
|
+
// {
|
|
3445
|
+
// type: 'correct_address_warning',
|
|
3446
|
+
// title: 'This is an ERC20 USDC address.',
|
|
3447
|
+
// details: 'Only send ERC20 USD Coin (USDC) to this address.',
|
|
3448
|
+
// image_url: 'https://www.coinbase.com/assets/addresses/global-receive-warning-a3d91807e61c717e5a38d270965003dcc025ca8a3cea40ec3d7835b7c86087fa.png',
|
|
3449
|
+
// options: [ { text: 'I understand', style: 'primary', id: 'dismiss' } ]
|
|
3450
|
+
// }
|
|
3451
|
+
// ],
|
|
3452
|
+
// qr_code_image_url: 'https://static-assets.coinbase.com/p2p/l2/asset_network_combinations/v5/usdc-solana.png',
|
|
3453
|
+
// address_label: 'USDC address (Solana)',
|
|
3454
|
+
// default_receive: true,
|
|
3455
|
+
// deposit_uri: 'solana:5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk?spl-token=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
3456
|
+
// callback_url: null,
|
|
3457
|
+
// share_address_copy: {
|
|
3458
|
+
// line1: '5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk',
|
|
3459
|
+
// line2: 'This address can only receive USDC-SPL from Solana network. Don’t send USDC from other networks, other SPL tokens or NFTs, or it may result in a loss of funds.'
|
|
3460
|
+
// },
|
|
3461
|
+
// receive_subtitle: 'ERC-20',
|
|
3462
|
+
// inline_warning: {
|
|
3463
|
+
// text: 'This address can only receive USDC-SPL from Solana network. Don’t send USDC from other networks, other SPL tokens or NFTs, or it may result in a loss of funds.',
|
|
3464
|
+
// tooltip: {
|
|
3465
|
+
// title: 'USDC (Solana)',
|
|
3466
|
+
// subtitle: 'This address can only receive USDC-SPL from Solana network.'
|
|
3467
|
+
// }
|
|
3468
|
+
// }
|
|
3469
|
+
// },
|
|
3470
|
+
// ...
|
|
3471
|
+
// ]
|
|
3472
|
+
// }
|
|
3473
|
+
//
|
|
3474
|
+
const data = this.safeList(response, 'data', []);
|
|
3475
|
+
const addressStructures = this.parseDepositAddresses(data, undefined, false);
|
|
3476
|
+
return this.indexBy(addressStructures, 'network');
|
|
3477
|
+
}
|
|
3478
|
+
parseDepositAddress(depositAddress, currency = undefined) {
|
|
3479
|
+
//
|
|
3480
|
+
// {
|
|
3481
|
+
// id: '64ceb5f1-5fa2-5310-a4ff-9fd46271003d',
|
|
3482
|
+
// address: '5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk',
|
|
3483
|
+
// address_info: {
|
|
3484
|
+
// address: 'GCF74576I7AQ56SLMKBQAP255EGUOWCRVII3S44KEXVNJEOIFVBDMXVL',
|
|
3485
|
+
// destination_tag: '3722061866'
|
|
3486
|
+
// },
|
|
3487
|
+
// name: null,
|
|
3488
|
+
// created_at: '2023-05-29T21:12:12Z',
|
|
3489
|
+
// updated_at: '2023-05-29T21:12:12Z',
|
|
3490
|
+
// network: 'solana',
|
|
3491
|
+
// uri_scheme: 'solana',
|
|
3492
|
+
// resource: 'address',
|
|
3493
|
+
// resource_path: '/v2/accounts/a7b3d387-bfb8-5ce7-b8da-1f507e81cf25/addresses/64ceb5f1-5fa2-5310-a4ff-9fd46271003d',
|
|
3494
|
+
// warnings: [
|
|
3495
|
+
// {
|
|
3496
|
+
// type: 'correct_address_warning',
|
|
3497
|
+
// title: 'This is an ERC20 USDC address.',
|
|
3498
|
+
// details: 'Only send ERC20 USD Coin (USDC) to this address.',
|
|
3499
|
+
// image_url: 'https://www.coinbase.com/assets/addresses/global-receive-warning-a3d91807e61c717e5a38d270965003dcc025ca8a3cea40ec3d7835b7c86087fa.png',
|
|
3500
|
+
// options: [ { text: 'I understand', style: 'primary', id: 'dismiss' } ]
|
|
3501
|
+
// }
|
|
3502
|
+
// ],
|
|
3503
|
+
// qr_code_image_url: 'https://static-assets.coinbase.com/p2p/l2/asset_network_combinations/v5/usdc-solana.png',
|
|
3504
|
+
// address_label: 'USDC address (Solana)',
|
|
3505
|
+
// default_receive: true,
|
|
3506
|
+
// deposit_uri: 'solana:5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk?spl-token=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
3507
|
+
// callback_url: null,
|
|
3508
|
+
// share_address_copy: {
|
|
3509
|
+
// line1: '5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk',
|
|
3510
|
+
// line2: 'This address can only receive USDC-SPL from Solana network. Don’t send USDC from other networks, other SPL tokens or NFTs, or it may result in a loss of funds.'
|
|
3511
|
+
// },
|
|
3512
|
+
// receive_subtitle: 'ERC-20',
|
|
3513
|
+
// inline_warning: {
|
|
3514
|
+
// text: 'This address can only receive USDC-SPL from Solana network. Don’t send USDC from other networks, other SPL tokens or NFTs, or it may result in a loss of funds.',
|
|
3515
|
+
// tooltip: {
|
|
3516
|
+
// title: 'USDC (Solana)',
|
|
3517
|
+
// subtitle: 'This address can only receive USDC-SPL from Solana network.'
|
|
3518
|
+
// }
|
|
3519
|
+
// }
|
|
3520
|
+
// }
|
|
3521
|
+
//
|
|
3522
|
+
const address = this.safeString(depositAddress, 'address');
|
|
3523
|
+
this.checkAddress(address);
|
|
3524
|
+
const networkId = this.safeString(depositAddress, 'network');
|
|
3525
|
+
const code = this.safeCurrencyCode(undefined, currency);
|
|
3526
|
+
const addressLabel = this.safeString(depositAddress, 'address_label');
|
|
3527
|
+
const splitAddressLabel = addressLabel.split(' ');
|
|
3528
|
+
const marketId = this.safeString(splitAddressLabel, 0);
|
|
3529
|
+
const addressInfo = this.safeDict(depositAddress, 'address_info');
|
|
3530
|
+
return {
|
|
3531
|
+
'info': depositAddress,
|
|
3532
|
+
'currency': this.safeCurrencyCode(marketId, currency),
|
|
3533
|
+
'address': address,
|
|
3534
|
+
'tag': this.safeString(addressInfo, 'destination_tag'),
|
|
3535
|
+
'network': this.networkIdToCode(networkId, code),
|
|
3536
|
+
};
|
|
3537
|
+
}
|
|
3352
3538
|
sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
3353
3539
|
const version = api[0];
|
|
3354
3540
|
const signed = api[1] === 'private';
|
|
@@ -3391,13 +3577,7 @@ export default class coinbase extends Exchange {
|
|
|
3391
3577
|
payload = body;
|
|
3392
3578
|
}
|
|
3393
3579
|
}
|
|
3394
|
-
|
|
3395
|
-
if (version === 'v3') {
|
|
3396
|
-
auth = nonce + method + savedPath + payload;
|
|
3397
|
-
}
|
|
3398
|
-
else {
|
|
3399
|
-
auth = nonce + method + fullPath + payload;
|
|
3400
|
-
}
|
|
3580
|
+
const auth = nonce + method + savedPath + payload;
|
|
3401
3581
|
const signature = this.hmac(this.encode(auth), this.encode(this.secret), sha256);
|
|
3402
3582
|
headers = {
|
|
3403
3583
|
'CB-ACCESS-KEY': this.apiKey,
|
package/js/src/coinbasepro.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export default class coinbasepro extends Exchange {
|
|
|
62
62
|
fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
63
63
|
fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
64
64
|
fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
65
|
-
parseTransactionStatus(transaction: any): "ok" | "
|
|
65
|
+
parseTransactionStatus(transaction: any): "ok" | "canceled" | "failed" | "pending";
|
|
66
66
|
parseTransaction(transaction: any, currency?: Currency): Transaction;
|
|
67
67
|
createDepositAddress(code: string, params?: {}): Promise<{
|
|
68
68
|
currency: string;
|
package/js/src/deribit.js
CHANGED
|
@@ -1784,7 +1784,7 @@ export default class deribit extends Exchange {
|
|
|
1784
1784
|
const amount = this.safeString(order, 'amount');
|
|
1785
1785
|
let cost = Precise.stringMul(filledString, averageString);
|
|
1786
1786
|
if (market['inverse']) {
|
|
1787
|
-
if (
|
|
1787
|
+
if (averageString !== '0') {
|
|
1788
1788
|
cost = Precise.stringDiv(amount, averageString);
|
|
1789
1789
|
}
|
|
1790
1790
|
}
|
package/js/src/krakenfutures.js
CHANGED
|
@@ -864,6 +864,7 @@ export default class krakenfutures extends Exchange {
|
|
|
864
864
|
}
|
|
865
865
|
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
866
866
|
const market = this.market(symbol);
|
|
867
|
+
symbol = market['symbol'];
|
|
867
868
|
type = this.safeString(params, 'orderType', type);
|
|
868
869
|
const timeInForce = this.safeString(params, 'timeInForce');
|
|
869
870
|
let postOnly = false;
|
|
@@ -883,7 +884,7 @@ export default class krakenfutures extends Exchange {
|
|
|
883
884
|
const request = {
|
|
884
885
|
'symbol': market['id'],
|
|
885
886
|
'side': side,
|
|
886
|
-
'size': amount,
|
|
887
|
+
'size': this.amountToPrecision(symbol, amount),
|
|
887
888
|
};
|
|
888
889
|
const clientOrderId = this.safeString2(params, 'clientOrderId', 'cliOrdId');
|
|
889
890
|
if (clientOrderId !== undefined) {
|
|
@@ -921,7 +922,7 @@ export default class krakenfutures extends Exchange {
|
|
|
921
922
|
}
|
|
922
923
|
request['orderType'] = type;
|
|
923
924
|
if (price !== undefined) {
|
|
924
|
-
request['limitPrice'] = price;
|
|
925
|
+
request['limitPrice'] = this.priceToPrecision(symbol, price);
|
|
925
926
|
}
|
|
926
927
|
params = this.omit(params, ['clientOrderId', 'timeInForce', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice']);
|
|
927
928
|
return this.extend(request, params);
|
package/js/src/kucoin.js
CHANGED
|
@@ -3860,11 +3860,11 @@ export default class kucoin extends Exchange {
|
|
|
3860
3860
|
}
|
|
3861
3861
|
}
|
|
3862
3862
|
let fee = undefined;
|
|
3863
|
-
const feeCost = this.
|
|
3863
|
+
const feeCost = this.safeString(item, 'fee');
|
|
3864
3864
|
let feeCurrency = undefined;
|
|
3865
|
-
if (feeCost !== 0) {
|
|
3865
|
+
if (feeCost !== '0') {
|
|
3866
3866
|
feeCurrency = code;
|
|
3867
|
-
fee = { 'cost': feeCost, 'currency': feeCurrency };
|
|
3867
|
+
fee = { 'cost': this.parseNumber(feeCost), 'currency': feeCurrency };
|
|
3868
3868
|
}
|
|
3869
3869
|
return {
|
|
3870
3870
|
'id': id,
|
|
@@ -3978,8 +3978,12 @@ export default class kucoin extends Exchange {
|
|
|
3978
3978
|
// }
|
|
3979
3979
|
// }
|
|
3980
3980
|
//
|
|
3981
|
-
const
|
|
3982
|
-
|
|
3981
|
+
const dataList = this.safeList(response, 'data');
|
|
3982
|
+
if (dataList !== undefined) {
|
|
3983
|
+
return this.parseLedger(dataList, currency, since, limit);
|
|
3984
|
+
}
|
|
3985
|
+
const data = this.safeDict(response, 'data');
|
|
3986
|
+
const items = this.safeList(data, 'items', []);
|
|
3983
3987
|
return this.parseLedger(items, currency, since, limit);
|
|
3984
3988
|
}
|
|
3985
3989
|
calculateRateLimiterCost(api, method, path, params, config = {}) {
|
package/js/src/mexc.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export default class mexc extends Exchange {
|
|
|
15
15
|
}>;
|
|
16
16
|
fetchTime(params?: {}): Promise<number>;
|
|
17
17
|
fetchCurrencies(params?: {}): Promise<{}>;
|
|
18
|
-
safeNetwork(networkId: any): string;
|
|
19
18
|
fetchMarkets(params?: {}): Promise<any>;
|
|
20
19
|
fetchSpotMarkets(params?: {}): Promise<any[]>;
|
|
21
20
|
fetchSwapMarkets(params?: {}): Promise<any[]>;
|
|
@@ -108,17 +107,17 @@ export default class mexc extends Exchange {
|
|
|
108
107
|
parseDepositAddress(depositAddress: any, currency?: Currency): {
|
|
109
108
|
currency: string;
|
|
110
109
|
address: string;
|
|
111
|
-
tag:
|
|
110
|
+
tag: string;
|
|
112
111
|
network: string;
|
|
113
112
|
info: any;
|
|
114
113
|
};
|
|
115
|
-
fetchDepositAddressesByNetwork(code: string, params?: {}): Promise<
|
|
114
|
+
fetchDepositAddressesByNetwork(code: string, params?: {}): Promise<{}>;
|
|
116
115
|
createDepositAddress(code: string, params?: {}): Promise<{
|
|
117
|
-
info: any;
|
|
118
116
|
currency: string;
|
|
119
|
-
network: string;
|
|
120
117
|
address: string;
|
|
121
118
|
tag: string;
|
|
119
|
+
network: string;
|
|
120
|
+
info: any;
|
|
122
121
|
}>;
|
|
123
122
|
fetchDepositAddress(code: string, params?: {}): Promise<any>;
|
|
124
123
|
fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|