ccxt 4.3.42 → 4.3.43

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/dist/cjs/ccxt.js CHANGED
@@ -185,7 +185,7 @@ var woofipro$1 = require('./src/pro/woofipro.js');
185
185
 
186
186
  //-----------------------------------------------------------------------------
187
187
  // this is updated by vss.js when building
188
- const version = '4.3.42';
188
+ const version = '4.3.43';
189
189
  Exchange["default"].ccxtVersion = version;
190
190
  const exchanges = {
191
191
  'ace': ace,
@@ -8108,8 +8108,56 @@ class binance extends binance$1 {
8108
8108
  // "tranId": 43000126248
8109
8109
  // }
8110
8110
  //
8111
- const id = this.safeString(transfer, 'tranId');
8112
- const currencyId = this.safeString(transfer, 'asset');
8111
+ // {
8112
+ // "orderType": "C2C", // Enum:PAY(C2B Merchant Acquiring Payment), PAY_REFUND(C2B Merchant Acquiring Payment,refund), C2C(C2C Transfer Payment),CRYPTO_BOX(Crypto box), CRYPTO_BOX_RF(Crypto Box, refund), C2C_HOLDING(Transfer to new Binance user), C2C_HOLDING_RF(Transfer to new Binance user,refund), PAYOUT(B2C Disbursement Payment), REMITTANCE(Send cash)
8113
+ // "transactionId": "M_P_71505104267788288",
8114
+ // "transactionTime": 1610090460133, //trade timestamp
8115
+ // "amount": "23.72469206", //order amount(up to 8 decimal places), positive is income, negative is expenditure
8116
+ // "currency": "BNB",
8117
+ // "walletType": 1, //main wallet type, 1 for funding wallet, 2 for spot wallet, 3 for fiat wallet, 4 or 6 for card payment, 5 for earn wallet
8118
+ // "walletTypes": [1,2], //array format,there are multiple values when using combination payment
8119
+ // "fundsDetail": [ // details
8120
+ // {
8121
+ // "currency": "USDT", //asset
8122
+ // "amount": "1.2",
8123
+ // "walletAssetCost":[ //details of asset cost per wallet
8124
+ // {"1":"0.6"},
8125
+ // {"2":"0.6"}
8126
+ // ]
8127
+ // },
8128
+ // {
8129
+ // "currency": "ETH",
8130
+ // "amount": "0.0001",
8131
+ // "walletAssetCost":[
8132
+ // {"1":"0.00005"},
8133
+ // {"2":"0.00005"}
8134
+ // ]
8135
+ // }
8136
+ // ],
8137
+ // "payerInfo":{
8138
+ // "name":"Jack", //nickname or merchant name
8139
+ // "type":"USER", //account type,USER for personal,MERCHANT for merchant
8140
+ // "binanceId":"12345678", //binance uid
8141
+ // "accountId":"67736251" //binance pay id
8142
+ // },
8143
+ // "receiverInfo":{
8144
+ // "name":"Alan", //nickname or merchant name
8145
+ // "type":"MERCHANT", //account type,USER for personal,MERCHANT for merchant
8146
+ // "email":"alan@binance.com", //email
8147
+ // "binanceId":"34355667", //binance uid
8148
+ // "accountId":"21326891", //binance pay id
8149
+ // "countryCode":"1", //International area code
8150
+ // "phoneNumber":"8057651210",
8151
+ // "mobileCode":"US", //country code
8152
+ // "extend":[ //extension field
8153
+ // "institutionName": "",
8154
+ // "cardNumber": "",
8155
+ // "digitalWalletId": ""
8156
+ // ]
8157
+ // }
8158
+ // }
8159
+ const id = this.safeString2(transfer, 'tranId', 'transactionId');
8160
+ const currencyId = this.safeString2(transfer, 'asset', 'currency');
8113
8161
  const code = this.safeCurrencyCode(currencyId, currency);
8114
8162
  const amount = this.safeNumber(transfer, 'amount');
8115
8163
  const type = this.safeString(transfer, 'type');
@@ -8123,7 +8171,14 @@ class binance extends binance$1 {
8123
8171
  fromAccount = this.safeString(accountsById, fromAccount, fromAccount);
8124
8172
  toAccount = this.safeString(accountsById, toAccount, toAccount);
8125
8173
  }
8126
- const timestamp = this.safeInteger(transfer, 'timestamp');
8174
+ const walletType = this.safeInteger(transfer, 'walletType');
8175
+ if (walletType !== undefined) {
8176
+ const payer = this.safeDict(transfer, 'payerInfo', {});
8177
+ const receiver = this.safeDict(transfer, 'receiverInfo', {});
8178
+ fromAccount = this.safeString(payer, 'accountId');
8179
+ toAccount = this.safeString(receiver, 'accountId');
8180
+ }
8181
+ const timestamp = this.safeInteger2(transfer, 'timestamp', 'transactionTime');
8127
8182
  const status = this.parseTransferStatus(this.safeString(transfer, 'status'));
8128
8183
  return {
8129
8184
  'info': transfer,
@@ -8275,74 +8330,144 @@ class binance extends binance$1 {
8275
8330
  * @name binance#fetchTransfers
8276
8331
  * @description fetch a history of internal transfers made on an account
8277
8332
  * @see https://binance-docs.github.io/apidocs/spot/en/#query-user-universal-transfer-history-user_data
8333
+ * @see https://binance-docs.github.io/apidocs/spot/en/#pay-endpoints
8278
8334
  * @param {string} code unified currency code of the currency transferred
8279
8335
  * @param {int} [since] the earliest time in ms to fetch transfers for
8280
8336
  * @param {int} [limit] the maximum number of transfers structures to retrieve
8281
8337
  * @param {object} [params] extra parameters specific to the exchange API endpoint
8282
8338
  * @param {int} [params.until] the latest time in ms to fetch transfers for
8283
8339
  * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
8340
+ * @param {boolean} [params.internal] default false, when true will fetch pay trade history
8284
8341
  * @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
8285
8342
  */
8286
8343
  await this.loadMarkets();
8344
+ const internal = this.safeBool(params, 'internal');
8345
+ params = this.omit(params, 'internal');
8287
8346
  let paginate = false;
8288
8347
  [paginate, params] = this.handleOptionAndParams(params, 'fetchTransfers', 'paginate');
8289
- if (paginate) {
8348
+ if (paginate && !internal) {
8290
8349
  return await this.fetchPaginatedCallDynamic('fetchTransfers', code, since, limit, params);
8291
8350
  }
8292
8351
  let currency = undefined;
8293
8352
  if (code !== undefined) {
8294
8353
  currency = this.currency(code);
8295
8354
  }
8296
- const defaultType = this.safeString2(this.options, 'fetchTransfers', 'defaultType', 'spot');
8297
- const fromAccount = this.safeString(params, 'fromAccount', defaultType);
8298
- const defaultTo = (fromAccount === 'future') ? 'spot' : 'future';
8299
- const toAccount = this.safeString(params, 'toAccount', defaultTo);
8300
- let type = this.safeString(params, 'type');
8301
- const accountsByType = this.safeDict(this.options, 'accountsByType', {});
8302
- const fromId = this.safeString(accountsByType, fromAccount);
8303
- const toId = this.safeString(accountsByType, toAccount);
8304
- if (type === undefined) {
8305
- if (fromId === undefined) {
8306
- const keys = Object.keys(accountsByType);
8307
- throw new errors.ExchangeError(this.id + ' fromAccount parameter must be one of ' + keys.join(', '));
8308
- }
8309
- if (toId === undefined) {
8310
- const keys = Object.keys(accountsByType);
8311
- throw new errors.ExchangeError(this.id + ' toAccount parameter must be one of ' + keys.join(', '));
8355
+ const request = {};
8356
+ let limitKey = 'limit';
8357
+ if (!internal) {
8358
+ const defaultType = this.safeString2(this.options, 'fetchTransfers', 'defaultType', 'spot');
8359
+ const fromAccount = this.safeString(params, 'fromAccount', defaultType);
8360
+ const defaultTo = (fromAccount === 'future') ? 'spot' : 'future';
8361
+ const toAccount = this.safeString(params, 'toAccount', defaultTo);
8362
+ let type = this.safeString(params, 'type');
8363
+ const accountsByType = this.safeDict(this.options, 'accountsByType', {});
8364
+ const fromId = this.safeString(accountsByType, fromAccount);
8365
+ const toId = this.safeString(accountsByType, toAccount);
8366
+ if (type === undefined) {
8367
+ if (fromId === undefined) {
8368
+ const keys = Object.keys(accountsByType);
8369
+ throw new errors.ExchangeError(this.id + ' fromAccount parameter must be one of ' + keys.join(', '));
8370
+ }
8371
+ if (toId === undefined) {
8372
+ const keys = Object.keys(accountsByType);
8373
+ throw new errors.ExchangeError(this.id + ' toAccount parameter must be one of ' + keys.join(', '));
8374
+ }
8375
+ type = fromId + '_' + toId;
8312
8376
  }
8313
- type = fromId + '_' + toId;
8377
+ request['type'] = type;
8378
+ limitKey = 'size';
8379
+ }
8380
+ if (limit !== undefined) {
8381
+ request[limitKey] = limit;
8314
8382
  }
8315
- const request = {
8316
- 'type': type,
8317
- };
8318
8383
  if (since !== undefined) {
8319
8384
  request['startTime'] = since;
8320
8385
  }
8321
- if (limit !== undefined) {
8322
- request['size'] = limit;
8323
- }
8324
8386
  const until = this.safeInteger(params, 'until');
8325
8387
  if (until !== undefined) {
8326
8388
  params = this.omit(params, 'until');
8327
8389
  request['endTime'] = until;
8328
8390
  }
8329
- const response = await this.sapiGetAssetTransfer(this.extend(request, params));
8330
- //
8331
- // {
8332
- // "total": 3,
8333
- // "rows": [
8334
- // {
8335
- // "timestamp": 1614640878000,
8336
- // "asset": "USDT",
8337
- // "amount": "25",
8338
- // "type": "MAIN_UMFUTURE",
8339
- // "status": "CONFIRMED",
8340
- // "tranId": 43000126248
8341
- // },
8342
- // ]
8343
- // }
8344
- //
8345
- const rows = this.safeList(response, 'rows', []);
8391
+ let response = undefined;
8392
+ if (internal) {
8393
+ response = await this.sapiGetPayTransactions(this.extend(request, params));
8394
+ //
8395
+ // {
8396
+ // "code": "000000",
8397
+ // "message": "success",
8398
+ // "data": [
8399
+ // {
8400
+ // "orderType": "C2C", // Enum:PAY(C2B Merchant Acquiring Payment), PAY_REFUND(C2B Merchant Acquiring Payment,refund), C2C(C2C Transfer Payment),CRYPTO_BOX(Crypto box), CRYPTO_BOX_RF(Crypto Box, refund), C2C_HOLDING(Transfer to new Binance user), C2C_HOLDING_RF(Transfer to new Binance user,refund), PAYOUT(B2C Disbursement Payment), REMITTANCE(Send cash)
8401
+ // "transactionId": "M_P_71505104267788288",
8402
+ // "transactionTime": 1610090460133, //trade timestamp
8403
+ // "amount": "23.72469206", //order amount(up to 8 decimal places), positive is income, negative is expenditure
8404
+ // "currency": "BNB",
8405
+ // "walletType": 1, //main wallet type, 1 for funding wallet, 2 for spot wallet, 3 for fiat wallet, 4 or 6 for card payment, 5 for earn wallet
8406
+ // "walletTypes": [1,2], //array format,there are multiple values when using combination payment
8407
+ // "fundsDetail": [ // details
8408
+ // {
8409
+ // "currency": "USDT", //asset
8410
+ // "amount": "1.2",
8411
+ // "walletAssetCost":[ //details of asset cost per wallet
8412
+ // {"1":"0.6"},
8413
+ // {"2":"0.6"}
8414
+ // ]
8415
+ // },
8416
+ // {
8417
+ // "currency": "ETH",
8418
+ // "amount": "0.0001",
8419
+ // "walletAssetCost":[
8420
+ // {"1":"0.00005"},
8421
+ // {"2":"0.00005"}
8422
+ // ]
8423
+ // }
8424
+ // ],
8425
+ // "payerInfo":{
8426
+ // "name":"Jack", //nickname or merchant name
8427
+ // "type":"USER", //account type,USER for personal,MERCHANT for merchant
8428
+ // "binanceId":"12345678", //binance uid
8429
+ // "accountId":"67736251" //binance pay id
8430
+ // },
8431
+ // "receiverInfo":{
8432
+ // "name":"Alan", //nickname or merchant name
8433
+ // "type":"MERCHANT", //account type,USER for personal,MERCHANT for merchant
8434
+ // "email":"alan@binance.com", //email
8435
+ // "binanceId":"34355667", //binance uid
8436
+ // "accountId":"21326891", //binance pay id
8437
+ // "countryCode":"1", //International area code
8438
+ // "phoneNumber":"8057651210",
8439
+ // "mobileCode":"US", //country code
8440
+ // "extend":[ //extension field
8441
+ // "institutionName": "",
8442
+ // "cardNumber": "",
8443
+ // "digitalWalletId": ""
8444
+ // ]
8445
+ // }
8446
+ // }
8447
+ // ],
8448
+ // "success": true
8449
+ // }
8450
+ //
8451
+ }
8452
+ else {
8453
+ response = await this.sapiGetAssetTransfer(this.extend(request, params));
8454
+ //
8455
+ // {
8456
+ // "total": 3,
8457
+ // "rows": [
8458
+ // {
8459
+ // "timestamp": 1614640878000,
8460
+ // "asset": "USDT",
8461
+ // "amount": "25",
8462
+ // "type": "MAIN_UMFUTURE",
8463
+ // "status": "CONFIRMED",
8464
+ // "tranId": 43000126248
8465
+ // },
8466
+ // ]
8467
+ // }
8468
+ //
8469
+ }
8470
+ const rows = this.safeList2(response, 'rows', 'data', []);
8346
8471
  return this.parseTransfers(rows, currency, since, limit);
8347
8472
  }
8348
8473
  async fetchDepositAddress(code, params = {}) {
@@ -897,7 +897,29 @@ class btcmarkets extends btcmarkets$1 {
897
897
  const request = {
898
898
  'ids': ids,
899
899
  };
900
- return await this.privateDeleteBatchordersIds(this.extend(request, params));
900
+ const response = await this.privateDeleteBatchordersIds(this.extend(request, params));
901
+ //
902
+ // {
903
+ // "cancelOrders": [
904
+ // {
905
+ // "orderId": "414186",
906
+ // "clientOrderId": "6"
907
+ // },
908
+ // ...
909
+ // ],
910
+ // "unprocessedRequests": [
911
+ // {
912
+ // "code": "OrderAlreadyCancelled",
913
+ // "message": "order is already cancelled.",
914
+ // "requestId": "1"
915
+ // }
916
+ // ]
917
+ // }
918
+ //
919
+ const cancelOrders = this.safeList(response, 'cancelOrders', []);
920
+ const unprocessedRequests = this.safeList(response, 'unprocessedRequests', []);
921
+ const orders = this.arrayConcat(cancelOrders, unprocessedRequests);
922
+ return this.parseOrders(orders);
901
923
  }
902
924
  async cancelOrder(id, symbol = undefined, params = {}) {
903
925
  /**
@@ -914,7 +936,14 @@ class btcmarkets extends btcmarkets$1 {
914
936
  const request = {
915
937
  'id': id,
916
938
  };
917
- return await this.privateDeleteOrdersId(this.extend(request, params));
939
+ const response = await this.privateDeleteOrdersId(this.extend(request, params));
940
+ //
941
+ // {
942
+ // "orderId": "7524",
943
+ // "clientOrderId": "123-456"
944
+ // }
945
+ //
946
+ return this.parseOrder(response);
918
947
  }
919
948
  calculateFee(symbol, type, side, amount, price, takerOrMaker = 'taker', params = {}) {
920
949
  /**
@@ -18,7 +18,7 @@ class coinex extends coinex$1 {
18
18
  return this.deepExtend(super.describe(), {
19
19
  'id': 'coinex',
20
20
  'name': 'CoinEx',
21
- 'version': 'v1',
21
+ 'version': 'v2',
22
22
  'countries': ['CN'],
23
23
  // IP ratelimit is 400 requests per second
24
24
  // rateLimit = 1000ms / 400 = 2.5
@@ -315,6 +315,8 @@ class coinex extends coinex$1 {
315
315
  'futures/position-level': 1,
316
316
  'futures/liquidation-history': 1,
317
317
  'futures/basis-history': 1,
318
+ 'assets/deposit-withdraw-config': 1,
319
+ 'assets/all-deposit-withdraw-config': 1,
318
320
  },
319
321
  },
320
322
  'private': {
@@ -337,7 +339,6 @@ class coinex extends coinex$1 {
337
339
  'assets/deposit-address': 40,
338
340
  'assets/deposit-history': 40,
339
341
  'assets/withdraw': 40,
340
- 'assets/deposit-withdraw-config': 1,
341
342
  'assets/transfer-history': 40,
342
343
  'spot/order-status': 8,
343
344
  'spot/batch-order-status': 8,
@@ -531,131 +532,129 @@ class coinex extends coinex$1 {
531
532
  });
532
533
  }
533
534
  async fetchCurrencies(params = {}) {
534
- const response = await this.v1PublicGetCommonAssetConfig(params);
535
+ /**
536
+ * @method
537
+ * @name coinex#fetchCurrencies
538
+ * @description fetches all available currencies on an exchange
539
+ * @see https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/list-all-deposit-withdrawal-config
540
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
541
+ * @returns {object} an associative dictionary of currencies
542
+ */
543
+ const response = await this.v2PublicGetAssetsAllDepositWithdrawConfig(params);
544
+ //
535
545
  // {
536
546
  // "code": 0,
537
- // "data": {
538
- // "USDT-ERC20": {
539
- // "asset": "USDT",
540
- // "chain": "ERC20",
541
- // "withdrawal_precision": 6,
542
- // "can_deposit": true,
543
- // "can_withdraw": true,
544
- // "deposit_least_amount": "4.9",
545
- // "withdraw_least_amount": "4.9",
546
- // "withdraw_tx_fee": "4.9",
547
- // "explorer_asset_url": "https://etherscan.io/token/0xdac17f958d2ee523a2206206994597c13d831ec7"
548
- // },
549
- // ...
550
- // },
551
- // "message": "Success",
547
+ // "data": [
548
+ // {
549
+ // "asset": {
550
+ // "ccy": "CET",
551
+ // "deposit_enabled": true,
552
+ // "withdraw_enabled": true,
553
+ // "inter_transfer_enabled": true,
554
+ // "is_st": false
555
+ // },
556
+ // "chains": [
557
+ // {
558
+ // "chain": "CSC",
559
+ // "min_deposit_amount": "0.8",
560
+ // "min_withdraw_amount": "8",
561
+ // "deposit_enabled": true,
562
+ // "withdraw_enabled": true,
563
+ // "deposit_delay_minutes": 0,
564
+ // "safe_confirmations": 10,
565
+ // "irreversible_confirmations": 20,
566
+ // "deflation_rate": "0",
567
+ // "withdrawal_fee": "0.026",
568
+ // "withdrawal_precision": 8,
569
+ // "memo": "",
570
+ // "is_memo_required_for_deposit": false,
571
+ // "explorer_asset_url": ""
572
+ // },
573
+ // ]
574
+ // }
575
+ // ],
576
+ // "message": "OK"
552
577
  // }
553
578
  //
554
- const data = this.safeValue(response, 'data', []);
555
- const coins = Object.keys(data);
579
+ const data = this.safeList(response, 'data', []);
556
580
  const result = {};
557
- for (let i = 0; i < coins.length; i++) {
558
- const coin = coins[i];
559
- const currency = data[coin];
560
- const currencyId = this.safeString(currency, 'asset');
561
- const networkId = this.safeString(currency, 'chain');
581
+ for (let i = 0; i < data.length; i++) {
582
+ const coin = data[i];
583
+ const asset = this.safeDict(coin, 'asset', {});
584
+ const chains = this.safeList(coin, 'chains', []);
585
+ const currencyId = this.safeString(asset, 'ccy');
586
+ if (currencyId === undefined) {
587
+ continue; // coinex returns empty structures for some reason
588
+ }
562
589
  const code = this.safeCurrencyCode(currencyId);
563
- const precisionString = this.parsePrecision(this.safeString(currency, 'withdrawal_precision'));
564
- const precision = this.parseNumber(precisionString);
565
- const canDeposit = this.safeValue(currency, 'can_deposit');
566
- const canWithdraw = this.safeValue(currency, 'can_withdraw');
567
- const feeString = this.safeString(currency, 'withdraw_tx_fee');
568
- const fee = this.parseNumber(feeString);
569
- const minNetworkDepositString = this.safeString(currency, 'deposit_least_amount');
570
- const minNetworkDeposit = this.parseNumber(minNetworkDepositString);
571
- const minNetworkWithdrawString = this.safeString(currency, 'withdraw_least_amount');
572
- const minNetworkWithdraw = this.parseNumber(minNetworkWithdrawString);
573
- if (this.safeValue(result, code) === undefined) {
574
- result[code] = {
575
- 'id': currencyId,
576
- 'numericId': undefined,
577
- 'code': code,
578
- 'info': undefined,
590
+ const canDeposit = this.safeBool(asset, 'deposit_enabled');
591
+ const canWithdraw = this.safeBool(asset, 'withdraw_enabled');
592
+ const firstChain = this.safeDict(chains, 0, {});
593
+ const firstPrecisionString = this.parsePrecision(this.safeString(firstChain, 'withdrawal_precision'));
594
+ result[code] = {
595
+ 'id': currencyId,
596
+ 'code': code,
597
+ 'name': undefined,
598
+ 'active': canDeposit && canWithdraw,
599
+ 'deposit': canDeposit,
600
+ 'withdraw': canWithdraw,
601
+ 'fee': undefined,
602
+ 'precision': this.parseNumber(firstPrecisionString),
603
+ 'limits': {
604
+ 'amount': {
605
+ 'min': undefined,
606
+ 'max': undefined,
607
+ },
608
+ 'deposit': {
609
+ 'min': undefined,
610
+ 'max': undefined,
611
+ },
612
+ 'withdraw': {
613
+ 'min': undefined,
614
+ 'max': undefined,
615
+ },
616
+ },
617
+ 'networks': {},
618
+ 'info': coin,
619
+ };
620
+ for (let j = 0; j < chains.length; j++) {
621
+ const chain = chains[j];
622
+ const networkId = this.safeString(chain, 'chain');
623
+ const precisionString = this.parsePrecision(this.safeString(chain, 'withdrawal_precision'));
624
+ const feeString = this.safeString(chain, 'withdrawal_fee');
625
+ const minNetworkDepositString = this.safeString(chain, 'min_deposit_amount');
626
+ const minNetworkWithdrawString = this.safeString(chain, 'min_withdraw_amount');
627
+ const canDepositChain = this.safeBool(chain, 'deposit_enabled');
628
+ const canWithdrawChain = this.safeBool(chain, 'withdraw_enabled');
629
+ const network = {
630
+ 'id': networkId,
631
+ 'network': networkId,
579
632
  'name': undefined,
580
- 'active': canDeposit && canWithdraw,
581
- 'deposit': canDeposit,
582
- 'withdraw': canWithdraw,
583
- 'fee': fee,
584
- 'precision': precision,
633
+ 'active': canDepositChain && canWithdrawChain,
634
+ 'deposit': canDepositChain,
635
+ 'withdraw': canWithdrawChain,
636
+ 'fee': this.parseNumber(feeString),
637
+ 'precision': this.parseNumber(precisionString),
585
638
  'limits': {
586
639
  'amount': {
587
640
  'min': undefined,
588
641
  'max': undefined,
589
642
  },
590
643
  'deposit': {
591
- 'min': minNetworkDeposit,
644
+ 'min': this.parseNumber(minNetworkDepositString),
592
645
  'max': undefined,
593
646
  },
594
647
  'withdraw': {
595
- 'min': minNetworkWithdraw,
648
+ 'min': this.parseNumber(minNetworkWithdrawString),
596
649
  'max': undefined,
597
650
  },
598
651
  },
652
+ 'info': chain,
599
653
  };
654
+ const networks = this.safeDict(result[code], 'networks', {});
655
+ networks[networkId] = network;
656
+ result[code]['networks'] = networks;
600
657
  }
601
- let minFeeString = this.safeString(result[code], 'fee');
602
- if (feeString !== undefined) {
603
- minFeeString = (minFeeString === undefined) ? feeString : Precise["default"].stringMin(feeString, minFeeString);
604
- }
605
- let depositAvailable = this.safeValue(result[code], 'deposit');
606
- depositAvailable = (canDeposit) ? canDeposit : depositAvailable;
607
- let withdrawAvailable = this.safeValue(result[code], 'withdraw');
608
- withdrawAvailable = (canWithdraw) ? canWithdraw : withdrawAvailable;
609
- let minDepositString = this.safeString(result[code]['limits']['deposit'], 'min');
610
- if (minNetworkDepositString !== undefined) {
611
- minDepositString = (minDepositString === undefined) ? minNetworkDepositString : Precise["default"].stringMin(minNetworkDepositString, minDepositString);
612
- }
613
- let minWithdrawString = this.safeString(result[code]['limits']['withdraw'], 'min');
614
- if (minNetworkWithdrawString !== undefined) {
615
- minWithdrawString = (minWithdrawString === undefined) ? minNetworkWithdrawString : Precise["default"].stringMin(minNetworkWithdrawString, minWithdrawString);
616
- }
617
- let minPrecisionString = this.safeString(result[code], 'precision');
618
- if (precisionString !== undefined) {
619
- minPrecisionString = (minPrecisionString === undefined) ? precisionString : Precise["default"].stringMin(precisionString, minPrecisionString);
620
- }
621
- const networks = this.safeValue(result[code], 'networks', {});
622
- const network = {
623
- 'info': currency,
624
- 'id': networkId,
625
- 'network': networkId,
626
- 'name': undefined,
627
- 'limits': {
628
- 'amount': {
629
- 'min': undefined,
630
- 'max': undefined,
631
- },
632
- 'deposit': {
633
- 'min': this.safeNumber(currency, 'deposit_least_amount'),
634
- 'max': undefined,
635
- },
636
- 'withdraw': {
637
- 'min': this.safeNumber(currency, 'withdraw_least_amount'),
638
- 'max': undefined,
639
- },
640
- },
641
- 'active': canDeposit && canWithdraw,
642
- 'deposit': canDeposit,
643
- 'withdraw': canWithdraw,
644
- 'fee': fee,
645
- 'precision': precision,
646
- };
647
- networks[networkId] = network;
648
- result[code]['networks'] = networks;
649
- result[code]['active'] = depositAvailable && withdrawAvailable;
650
- result[code]['deposit'] = depositAvailable;
651
- result[code]['withdraw'] = withdrawAvailable;
652
- const info = this.safeValue(result[code], 'info', []);
653
- info.push(currency);
654
- result[code]['info'] = info;
655
- result[code]['fee'] = this.parseNumber(minFeeString);
656
- result[code]['precision'] = this.parseNumber(minPrecisionString);
657
- result[code]['limits']['deposit']['min'] = this.parseNumber(minDepositString);
658
- result[code]['limits']['withdraw']['min'] = this.parseNumber(minWithdrawString);
659
658
  }
660
659
  return result;
661
660
  }
@@ -5428,7 +5427,7 @@ class coinex extends coinex$1 {
5428
5427
  const request = {
5429
5428
  'ccy': currency['id'],
5430
5429
  };
5431
- const response = await this.v2PrivateGetAssetsDepositWithdrawConfig(this.extend(request, params));
5430
+ const response = await this.v2PublicGetAssetsDepositWithdrawConfig(this.extend(request, params));
5432
5431
  //
5433
5432
  // {
5434
5433
  // "code": 0,
@@ -2954,6 +2954,7 @@ class phemex extends phemex$1 {
2954
2954
  /**
2955
2955
  * @method
2956
2956
  * @name phemex#fetchOrder
2957
+ * @see https://phemex-docs.github.io/#query-orders-by-ids
2957
2958
  * @description fetches information on an order made by the user
2958
2959
  * @param {string} symbol unified symbol of the market the order was made in
2959
2960
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2964,9 +2965,6 @@ class phemex extends phemex$1 {
2964
2965
  }
2965
2966
  await this.loadMarkets();
2966
2967
  const market = this.market(symbol);
2967
- if (market['settle'] === 'USDT') {
2968
- throw new errors.NotSupported(this.id + 'fetchOrder() is not supported yet for USDT settled swap markets'); // https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-user-order-by-orderid-or-query-user-order-by-client-order-id
2969
- }
2970
2968
  const request = {
2971
2969
  'symbol': market['id'],
2972
2970
  };
@@ -2979,7 +2977,10 @@ class phemex extends phemex$1 {
2979
2977
  request['orderID'] = id;
2980
2978
  }
2981
2979
  let response = undefined;
2982
- if (market['spot']) {
2980
+ if (market['settle'] === 'USDT') {
2981
+ response = await this.privateGetApiDataGFuturesOrdersByOrderId(this.extend(request, params));
2982
+ }
2983
+ else if (market['spot']) {
2983
2984
  response = await this.privateGetSpotOrdersActive(this.extend(request, params));
2984
2985
  }
2985
2986
  else {