ccxt 4.3.41 → 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.
Files changed (52) hide show
  1. package/README.md +5 -5
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/binance.js +169 -44
  5. package/dist/cjs/src/bitmart.js +196 -100
  6. package/dist/cjs/src/blockchaincom.js +11 -7
  7. package/dist/cjs/src/btcmarkets.js +31 -2
  8. package/dist/cjs/src/coinex.js +107 -108
  9. package/dist/cjs/src/kraken.js +30 -3
  10. package/dist/cjs/src/krakenfutures.js +56 -1
  11. package/dist/cjs/src/kucoin.js +59 -2
  12. package/dist/cjs/src/phemex.js +5 -4
  13. package/dist/cjs/src/pro/bitget.js +36 -22
  14. package/dist/cjs/src/pro/bybit.js +1 -1
  15. package/dist/cjs/src/pro/mexc.js +2 -2
  16. package/dist/cjs/src/pro/upbit.js +8 -4
  17. package/dist/cjs/src/pro/woo.js +2 -2
  18. package/dist/cjs/src/tradeogre.js +11 -5
  19. package/dist/cjs/src/wavesexchange.js +2 -2
  20. package/dist/cjs/src/wazirx.js +38 -15
  21. package/dist/cjs/src/zonda.js +9 -1
  22. package/js/ccxt.d.ts +3 -3
  23. package/js/ccxt.js +1 -1
  24. package/js/src/abstract/coinex.d.ts +2 -1
  25. package/js/src/binance.js +169 -44
  26. package/js/src/bitmart.js +196 -100
  27. package/js/src/blockchaincom.d.ts +2 -8
  28. package/js/src/blockchaincom.js +11 -7
  29. package/js/src/btcmarkets.d.ts +2 -2
  30. package/js/src/btcmarkets.js +31 -2
  31. package/js/src/coinex.js +107 -108
  32. package/js/src/kraken.d.ts +3 -3
  33. package/js/src/kraken.js +30 -3
  34. package/js/src/krakenfutures.d.ts +1 -1
  35. package/js/src/krakenfutures.js +56 -1
  36. package/js/src/kucoin.d.ts +1 -1
  37. package/js/src/kucoin.js +59 -2
  38. package/js/src/phemex.js +6 -5
  39. package/js/src/pro/bitget.js +36 -22
  40. package/js/src/pro/bybit.js +1 -1
  41. package/js/src/pro/mexc.js +2 -2
  42. package/js/src/pro/upbit.js +8 -4
  43. package/js/src/pro/woo.js +2 -2
  44. package/js/src/tradeogre.d.ts +1 -1
  45. package/js/src/tradeogre.js +12 -6
  46. package/js/src/wavesexchange.d.ts +1 -20
  47. package/js/src/wavesexchange.js +2 -2
  48. package/js/src/wazirx.d.ts +1 -1
  49. package/js/src/wazirx.js +38 -15
  50. package/js/src/zonda.d.ts +1 -1
  51. package/js/src/zonda.js +9 -1
  52. package/package.json +1 -1
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.41';
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 = {}) {