ccxt 4.5.15 → 4.5.17

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/js/src/woo.js CHANGED
@@ -212,9 +212,7 @@ export default class woo extends Exchange {
212
212
  'post': {
213
213
  'order': 1,
214
214
  'order/cancel_all_after': 1,
215
- 'asset/main_sub_transfer': 30,
216
215
  'asset/ltv': 30,
217
- 'asset/withdraw': 30,
218
216
  'asset/internal_withdraw': 30,
219
217
  'interest/repay': 60,
220
218
  'client/account_mode': 120,
@@ -288,7 +286,6 @@ export default class woo extends Exchange {
288
286
  'spotMargin/maxMargin': 60,
289
287
  'algo/order/{oid}': 1,
290
288
  'algo/orders': 1,
291
- 'balances': 1,
292
289
  'positions': 3.33,
293
290
  'buypower': 1,
294
291
  'convert/exchangeInfo': 1,
@@ -2423,7 +2420,7 @@ export default class woo extends Exchange {
2423
2420
  */
2424
2421
  async fetchBalance(params = {}) {
2425
2422
  await this.loadMarkets();
2426
- const response = await this.v3PrivateGetBalances(params);
2423
+ const response = await this.v3PrivateGetAssetBalances(params);
2427
2424
  //
2428
2425
  // {
2429
2426
  // "success": true,
@@ -2753,14 +2750,14 @@ export default class woo extends Exchange {
2753
2750
  const networkizedCode = this.safeString(transaction, 'token');
2754
2751
  const currencyDefined = this.getCurrencyFromChaincode(networkizedCode, currency);
2755
2752
  const code = currencyDefined['code'];
2756
- let movementDirection = this.safeStringLower2(transaction, 'token_side', 'tokenSide');
2753
+ let movementDirection = this.safeStringLowerN(transaction, ['token_side', 'tokenSide', 'type']);
2757
2754
  if (movementDirection === 'withdraw') {
2758
2755
  movementDirection = 'withdrawal';
2759
2756
  }
2760
2757
  const fee = this.parseTokenAndFeeTemp(transaction, ['fee_token', 'feeToken'], ['fee_amount', 'feeAmount']);
2761
- const addressTo = this.safeString2(transaction, 'target_address', 'targetAddress');
2758
+ const addressTo = this.safeStringN(transaction, ['target_address', 'targetAddress', 'addressTo']);
2762
2759
  const addressFrom = this.safeString2(transaction, 'source_address', 'sourceAddress');
2763
- const timestamp = this.safeTimestamp2(transaction, 'created_time', 'createdTime');
2760
+ const timestamp = this.safeTimestampN(transaction, ['created_time', 'createdTime'], this.safeInteger(transaction, 'timestamp'));
2764
2761
  return {
2765
2762
  'info': transaction,
2766
2763
  'id': this.safeStringN(transaction, ['id', 'withdraw_id', 'withdrawId']),
@@ -2770,7 +2767,7 @@ export default class woo extends Exchange {
2770
2767
  'address': undefined,
2771
2768
  'addressFrom': addressFrom,
2772
2769
  'addressTo': addressTo,
2773
- 'tag': this.safeString(transaction, 'extra'),
2770
+ 'tag': this.safeString2(transaction, 'extra', 'tag'),
2774
2771
  'tagFrom': undefined,
2775
2772
  'tagTo': undefined,
2776
2773
  'type': movementDirection,
@@ -2781,7 +2778,7 @@ export default class woo extends Exchange {
2781
2778
  'comment': undefined,
2782
2779
  'internal': undefined,
2783
2780
  'fee': fee,
2784
- 'network': undefined,
2781
+ 'network': this.networkIdToCode(this.safeString(transaction, 'network')),
2785
2782
  };
2786
2783
  }
2787
2784
  parseTransactionStatus(status) {
@@ -2812,17 +2809,25 @@ export default class woo extends Exchange {
2812
2809
  const request = {
2813
2810
  'token': currency['id'],
2814
2811
  'amount': this.parseToNumeric(amount),
2815
- 'from_application_id': fromAccount,
2816
- 'to_application_id': toAccount,
2812
+ 'from': {
2813
+ 'applicationId': fromAccount,
2814
+ },
2815
+ 'to': {
2816
+ 'applicationId': toAccount,
2817
+ },
2817
2818
  };
2818
- const response = await this.v1PrivatePostAssetMainSubTransfer(this.extend(request, params));
2819
+ const response = await this.v3PrivatePostAssetTransfer(this.extend(request, params));
2819
2820
  //
2820
2821
  // {
2821
2822
  // "success": true,
2822
2823
  // "id": 200
2823
2824
  // }
2824
2825
  //
2825
- const transfer = this.parseTransfer(response, currency);
2826
+ const data = this.safeDict(response, 'data', {});
2827
+ data['timestamp'] = this.safeInteger(response, 'timestamp');
2828
+ data['token'] = currency['id'];
2829
+ data['status'] = 'ok';
2830
+ const transfer = this.parseTransfer(data, currency);
2826
2831
  const transferOptions = this.safeDict(this.options, 'transfer', {});
2827
2832
  const fillResponseFromRequest = this.safeBool(transferOptions, 'fillResponseFromRequest', true);
2828
2833
  if (fillResponseFromRequest) {
@@ -2936,7 +2941,7 @@ export default class woo extends Exchange {
2936
2941
  // }
2937
2942
  //
2938
2943
  const code = this.safeCurrencyCode(this.safeString(transfer, 'token'), currency);
2939
- const timestamp = this.safeTimestamp(transfer, 'createdTime');
2944
+ const timestamp = this.safeTimestamp2(transfer, 'createdTime', 'timestamp');
2940
2945
  const success = this.safeBool(transfer, 'success');
2941
2946
  let status = undefined;
2942
2947
  if (success !== undefined) {
@@ -2970,7 +2975,7 @@ export default class woo extends Exchange {
2970
2975
  * @method
2971
2976
  * @name woo#withdraw
2972
2977
  * @description make a withdrawal
2973
- * @see https://docs.woox.io/#token-withdraw
2978
+ * @see https://docs.woox.io/#token-withdraw-v3
2974
2979
  * @param {string} code unified currency code
2975
2980
  * @param {float} amount the amount to withdraw
2976
2981
  * @param {string} address the address to withdraw to
@@ -2990,17 +2995,33 @@ export default class woo extends Exchange {
2990
2995
  if (tag !== undefined) {
2991
2996
  request['extra'] = tag;
2992
2997
  }
2993
- let specialNetworkId = undefined;
2994
- [specialNetworkId, params] = this.getDedicatedNetworkId(currency, params);
2995
- request['token'] = specialNetworkId;
2996
- const response = await this.v1PrivatePostAssetWithdraw(this.extend(request, params));
2998
+ const network = this.safeString(params, 'network');
2999
+ if (network === undefined) {
3000
+ throw new ArgumentsRequired(this.id + ' withdraw() requires a network parameter for ' + code);
3001
+ }
3002
+ params = this.omit(params, 'network');
3003
+ request['token'] = currency['id'];
3004
+ request['network'] = this.networkCodeToId(network);
3005
+ const response = await this.v3PrivatePostAssetWalletWithdraw(this.extend(request, params));
2997
3006
  //
2998
3007
  // {
2999
3008
  // "success": true,
3000
3009
  // "withdraw_id": "20200119145703654"
3001
3010
  // }
3002
3011
  //
3003
- return this.parseTransaction(response, currency);
3012
+ const data = this.safeDict(response, 'data', {});
3013
+ const transactionData = this.extend(data, {
3014
+ 'id': this.safeString(data, 'withdrawId'),
3015
+ 'timestamp': this.safeInteger(response, 'timestamp'),
3016
+ 'currency': code,
3017
+ 'amount': amount,
3018
+ 'addressTo': address,
3019
+ 'tag': tag,
3020
+ 'network': network,
3021
+ 'type': 'withdrawal',
3022
+ 'status': 'pending',
3023
+ });
3024
+ return this.parseTransaction(transactionData, currency);
3004
3025
  }
3005
3026
  /**
3006
3027
  * @method
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.5.15",
3
+ "version": "4.5.17",
4
4
  "description": "A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go",
5
5
  "unpkg": "dist/ccxt.browser.min.js",
6
6
  "type": "module",