ccxt 4.4.86 → 4.4.87
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 +17 -5
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +11 -1
- package/dist/cjs/src/abstract/modetrade.js +9 -0
- package/dist/cjs/src/base/Exchange.js +10 -8
- package/dist/cjs/src/binance.js +1 -1
- package/dist/cjs/src/bitteam.js +31 -0
- package/dist/cjs/src/coinmetro.js +5 -1
- package/dist/cjs/src/derive.js +4 -5
- package/dist/cjs/src/ellipx.js +2 -3
- package/dist/cjs/src/gate.js +92 -76
- package/dist/cjs/src/htx.js +10 -8
- package/dist/cjs/src/hyperliquid.js +32 -16
- package/dist/cjs/src/kraken.js +5 -8
- package/dist/cjs/src/modetrade.js +2839 -0
- package/dist/cjs/src/okx.js +95 -2
- package/dist/cjs/src/okxus.js +53 -0
- package/dist/cjs/src/paradex.js +6 -1
- package/dist/cjs/src/phemex.js +4 -6
- package/dist/cjs/src/poloniex.js +181 -170
- package/dist/cjs/src/pro/modetrade.js +1334 -0
- package/dist/cjs/src/pro/okxus.js +38 -0
- package/dist/cjs/src/probit.js +18 -51
- package/dist/cjs/src/timex.js +5 -10
- package/dist/cjs/src/vertex.js +3 -4
- package/dist/cjs/src/whitebit.js +41 -11
- package/dist/cjs/src/woo.js +101 -77
- package/dist/cjs/src/woofipro.js +24 -21
- package/dist/cjs/src/xt.js +36 -44
- package/js/ccxt.d.ts +14 -2
- package/js/ccxt.js +10 -2
- package/js/src/abstract/modetrade.d.ts +122 -0
- package/js/src/abstract/modetrade.js +11 -0
- package/js/src/abstract/okxus.d.ts +352 -0
- package/js/src/abstract/okxus.js +11 -0
- package/js/src/base/Exchange.js +10 -8
- package/js/src/binance.js +1 -1
- package/js/src/bitteam.js +31 -0
- package/js/src/coinmetro.js +5 -1
- package/js/src/derive.js +4 -3
- package/js/src/ellipx.d.ts +1 -1
- package/js/src/ellipx.js +3 -5
- package/js/src/gate.js +92 -76
- package/js/src/htx.js +10 -8
- package/js/src/hyperliquid.js +32 -16
- package/js/src/kraken.js +5 -8
- package/js/src/modetrade.d.ts +475 -0
- package/js/src/modetrade.js +2840 -0
- package/js/src/okx.d.ts +24 -1
- package/js/src/okx.js +95 -2
- package/js/src/okxus.d.ts +4 -0
- package/js/src/okxus.js +54 -0
- package/js/src/paradex.js +6 -1
- package/js/src/phemex.js +4 -6
- package/js/src/poloniex.d.ts +2 -0
- package/js/src/poloniex.js +181 -170
- package/js/src/pro/modetrade.d.ts +155 -0
- package/js/src/pro/modetrade.js +1335 -0
- package/js/src/pro/okxus.d.ts +4 -0
- package/js/src/pro/okxus.js +39 -0
- package/js/src/probit.js +18 -51
- package/js/src/timex.js +5 -10
- package/js/src/vertex.js +3 -4
- package/js/src/whitebit.js +42 -11
- package/js/src/woo.d.ts +2 -0
- package/js/src/woo.js +101 -77
- package/js/src/woofipro.d.ts +2 -1
- package/js/src/woofipro.js +24 -21
- package/js/src/xt.js +36 -44
- package/package.json +1 -1
package/dist/cjs/src/poloniex.js
CHANGED
|
@@ -306,6 +306,11 @@ class poloniex extends poloniex$1 {
|
|
|
306
306
|
'BEP20': 'BSC',
|
|
307
307
|
'ERC20': 'ETH',
|
|
308
308
|
'TRC20': 'TRON',
|
|
309
|
+
'TRX': 'TRON',
|
|
310
|
+
},
|
|
311
|
+
'networksById': {
|
|
312
|
+
'TRX': 'TRC20',
|
|
313
|
+
'TRON': 'TRC20',
|
|
309
314
|
},
|
|
310
315
|
'limits': {
|
|
311
316
|
'cost': {
|
|
@@ -1148,105 +1153,107 @@ class poloniex extends poloniex$1 {
|
|
|
1148
1153
|
const response = await this.publicGetCurrencies(this.extend(params, { 'includeMultiChainCurrencies': true }));
|
|
1149
1154
|
//
|
|
1150
1155
|
// [
|
|
1151
|
-
//
|
|
1152
|
-
//
|
|
1153
|
-
//
|
|
1154
|
-
//
|
|
1155
|
-
//
|
|
1156
|
-
//
|
|
1157
|
-
//
|
|
1158
|
-
//
|
|
1159
|
-
//
|
|
1160
|
-
//
|
|
1161
|
-
//
|
|
1162
|
-
//
|
|
1163
|
-
//
|
|
1164
|
-
//
|
|
1165
|
-
//
|
|
1166
|
-
//
|
|
1167
|
-
//
|
|
1168
|
-
//
|
|
1169
|
-
//
|
|
1170
|
-
//
|
|
1171
|
-
//
|
|
1156
|
+
// {
|
|
1157
|
+
// "USDT": {
|
|
1158
|
+
// "id": 214,
|
|
1159
|
+
// "name": "Tether USD",
|
|
1160
|
+
// "description": "Sweep to Main Account",
|
|
1161
|
+
// "type": "address",
|
|
1162
|
+
// "withdrawalFee": "0.00000000",
|
|
1163
|
+
// "minConf": 2,
|
|
1164
|
+
// "depositAddress": null,
|
|
1165
|
+
// "blockchain": "OMNI",
|
|
1166
|
+
// "delisted": false,
|
|
1167
|
+
// "tradingState": "NORMAL",
|
|
1168
|
+
// "walletState": "DISABLED",
|
|
1169
|
+
// "walletDepositState": "DISABLED",
|
|
1170
|
+
// "walletWithdrawalState": "DISABLED",
|
|
1171
|
+
// "supportCollateral": true,
|
|
1172
|
+
// "supportBorrow": true,
|
|
1173
|
+
// "parentChain": null,
|
|
1174
|
+
// "isMultiChain": true,
|
|
1175
|
+
// "isChildChain": false,
|
|
1176
|
+
// "childChains": [
|
|
1177
|
+
// "USDTBSC",
|
|
1178
|
+
// "USDTETH",
|
|
1179
|
+
// "USDTSOL",
|
|
1180
|
+
// "USDTTRON"
|
|
1181
|
+
// ]
|
|
1182
|
+
// }
|
|
1183
|
+
// },
|
|
1184
|
+
// ...
|
|
1185
|
+
// {
|
|
1186
|
+
// "USDTBSC": {
|
|
1187
|
+
// "id": 582,
|
|
1188
|
+
// "name": "Binance-Peg BSC-USD",
|
|
1189
|
+
// "description": "Sweep to Main Account",
|
|
1190
|
+
// "type": "address",
|
|
1191
|
+
// "withdrawalFee": "0.00000000",
|
|
1192
|
+
// "minConf": 15,
|
|
1193
|
+
// "depositAddress": null,
|
|
1194
|
+
// "blockchain": "BSC",
|
|
1195
|
+
// "delisted": false,
|
|
1196
|
+
// "tradingState": "OFFLINE",
|
|
1197
|
+
// "walletState": "ENABLED",
|
|
1198
|
+
// "walletDepositState": "ENABLED",
|
|
1199
|
+
// "walletWithdrawalState": "DISABLED",
|
|
1200
|
+
// "supportCollateral": false,
|
|
1201
|
+
// "supportBorrow": false,
|
|
1202
|
+
// "parentChain": "USDT",
|
|
1203
|
+
// "isMultiChain": true,
|
|
1204
|
+
// "isChildChain": true,
|
|
1205
|
+
// "childChains": []
|
|
1206
|
+
// }
|
|
1207
|
+
// },
|
|
1208
|
+
// ...
|
|
1172
1209
|
// ]
|
|
1173
1210
|
//
|
|
1174
1211
|
const result = {};
|
|
1212
|
+
// poloniex has a complicated structure of currencies, so we handle them differently
|
|
1213
|
+
// at first, turn the response into a normal dictionary
|
|
1214
|
+
const currenciesDict = {};
|
|
1175
1215
|
for (let i = 0; i < response.length; i++) {
|
|
1176
|
-
const item = this.
|
|
1216
|
+
const item = this.safeDict(response, i);
|
|
1177
1217
|
const ids = Object.keys(item);
|
|
1178
|
-
const id = this.
|
|
1179
|
-
|
|
1218
|
+
const id = this.safeString(ids, 0);
|
|
1219
|
+
currenciesDict[id] = item[id];
|
|
1220
|
+
}
|
|
1221
|
+
const keys = Object.keys(currenciesDict);
|
|
1222
|
+
for (let i = 0; i < keys.length; i++) {
|
|
1223
|
+
const id = keys[i];
|
|
1224
|
+
const entry = currenciesDict[id];
|
|
1180
1225
|
const code = this.safeCurrencyCode(id);
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
if (networkId !== undefined) {
|
|
1185
|
-
networkCode = this.networkIdToCode(networkId, code);
|
|
1186
|
-
}
|
|
1187
|
-
const delisted = this.safeValue(currency, 'delisted');
|
|
1188
|
-
const walletEnabled = this.safeString(currency, 'walletState') === 'ENABLED';
|
|
1189
|
-
const depositEnabled = this.safeString(currency, 'walletDepositState') === 'ENABLED';
|
|
1190
|
-
const withdrawEnabled = this.safeString(currency, 'walletWithdrawalState') === 'ENABLED';
|
|
1191
|
-
const active = !delisted && walletEnabled && depositEnabled && withdrawEnabled;
|
|
1192
|
-
const numericId = this.safeInteger(currency, 'id');
|
|
1193
|
-
const feeString = this.safeString(currency, 'withdrawalFee');
|
|
1194
|
-
const parentChain = this.safeValue(currency, 'parentChain');
|
|
1195
|
-
const noParentChain = parentChain === undefined;
|
|
1196
|
-
if (this.safeValue(result, code) === undefined) {
|
|
1197
|
-
result[code] = {
|
|
1198
|
-
'id': id,
|
|
1199
|
-
'code': code,
|
|
1200
|
-
'info': undefined,
|
|
1201
|
-
'name': name,
|
|
1202
|
-
'active': active,
|
|
1203
|
-
'deposit': depositEnabled,
|
|
1204
|
-
'withdraw': withdrawEnabled,
|
|
1205
|
-
'fee': this.parseNumber(feeString),
|
|
1206
|
-
'precision': undefined,
|
|
1207
|
-
'type': 'crypto',
|
|
1208
|
-
'limits': {
|
|
1209
|
-
'amount': {
|
|
1210
|
-
'min': undefined,
|
|
1211
|
-
'max': undefined,
|
|
1212
|
-
},
|
|
1213
|
-
'deposit': {
|
|
1214
|
-
'min': undefined,
|
|
1215
|
-
'max': undefined,
|
|
1216
|
-
},
|
|
1217
|
-
'withdraw': {
|
|
1218
|
-
'min': undefined,
|
|
1219
|
-
'max': undefined,
|
|
1220
|
-
},
|
|
1221
|
-
},
|
|
1222
|
-
};
|
|
1226
|
+
// skip childChains, as they are collected in parentChain loop
|
|
1227
|
+
if (this.safeBool(entry, 'isChildChain')) {
|
|
1228
|
+
continue;
|
|
1223
1229
|
}
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1230
|
+
const allChainEntries = [];
|
|
1231
|
+
const childChains = this.safeList(entry, 'childChains', []);
|
|
1232
|
+
if (childChains !== undefined) {
|
|
1233
|
+
for (let j = 0; j < childChains.length; j++) {
|
|
1234
|
+
const childChainId = childChains[j];
|
|
1235
|
+
const childNetworkEntry = this.safeDict(currenciesDict, childChainId);
|
|
1236
|
+
allChainEntries.push(childNetworkEntry);
|
|
1237
|
+
}
|
|
1227
1238
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
let
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1239
|
+
allChainEntries.push(entry);
|
|
1240
|
+
const networks = {};
|
|
1241
|
+
for (let j = 0; j < allChainEntries.length; j++) {
|
|
1242
|
+
const chainEntry = allChainEntries[j];
|
|
1243
|
+
const networkName = this.safeString(chainEntry, 'blockchain');
|
|
1244
|
+
const networkCode = this.networkIdToCode(networkName, code);
|
|
1245
|
+
const specialNetworkId = this.safeString(childChains, j, id); // in case it's primary chain, defeault to ID
|
|
1234
1246
|
networks[networkCode] = {
|
|
1235
|
-
'info':
|
|
1236
|
-
'id':
|
|
1247
|
+
'info': chainEntry,
|
|
1248
|
+
'id': specialNetworkId,
|
|
1249
|
+
'numericId': this.safeInteger(chainEntry, 'id'),
|
|
1237
1250
|
'network': networkCode,
|
|
1238
|
-
'
|
|
1239
|
-
'
|
|
1240
|
-
'
|
|
1241
|
-
'
|
|
1242
|
-
'active': active,
|
|
1243
|
-
'fee': this.parseNumber(feeString),
|
|
1251
|
+
'active': this.safeBool(chainEntry, 'walletState'),
|
|
1252
|
+
'deposit': this.safeString(chainEntry, 'walletDepositState') === 'ENABLED',
|
|
1253
|
+
'withdraw': this.safeString(chainEntry, 'walletWithdrawalState') === 'ENABLED',
|
|
1254
|
+
'fee': this.safeNumber(chainEntry, 'withdrawalFee'),
|
|
1244
1255
|
'precision': undefined,
|
|
1245
1256
|
'limits': {
|
|
1246
|
-
'amount': {
|
|
1247
|
-
'min': undefined,
|
|
1248
|
-
'max': undefined,
|
|
1249
|
-
},
|
|
1250
1257
|
'withdraw': {
|
|
1251
1258
|
'min': undefined,
|
|
1252
1259
|
'max': undefined,
|
|
@@ -1258,20 +1265,34 @@ class poloniex extends poloniex$1 {
|
|
|
1258
1265
|
},
|
|
1259
1266
|
};
|
|
1260
1267
|
}
|
|
1261
|
-
result[code]
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1268
|
+
result[code] = this.safeCurrencyStructure({
|
|
1269
|
+
'info': entry,
|
|
1270
|
+
'code': code,
|
|
1271
|
+
'id': id,
|
|
1272
|
+
'numericId': this.safeInteger(entry, 'id'),
|
|
1273
|
+
'type': 'crypto',
|
|
1274
|
+
'name': this.safeString(entry, 'name'),
|
|
1275
|
+
'active': undefined,
|
|
1276
|
+
'deposit': undefined,
|
|
1277
|
+
'withdraw': undefined,
|
|
1278
|
+
'fee': undefined,
|
|
1279
|
+
'precision': undefined,
|
|
1280
|
+
'limits': {
|
|
1281
|
+
'amount': {
|
|
1282
|
+
'min': undefined,
|
|
1283
|
+
'max': undefined,
|
|
1284
|
+
},
|
|
1285
|
+
'withdraw': {
|
|
1286
|
+
'min': undefined,
|
|
1287
|
+
'max': undefined,
|
|
1288
|
+
},
|
|
1289
|
+
'deposit': {
|
|
1290
|
+
'min': undefined,
|
|
1291
|
+
'max': undefined,
|
|
1292
|
+
},
|
|
1293
|
+
},
|
|
1294
|
+
'networks': networks,
|
|
1295
|
+
});
|
|
1275
1296
|
}
|
|
1276
1297
|
return result;
|
|
1277
1298
|
}
|
|
@@ -2666,45 +2687,15 @@ class poloniex extends poloniex$1 {
|
|
|
2666
2687
|
*/
|
|
2667
2688
|
async createDepositAddress(code, params = {}) {
|
|
2668
2689
|
await this.loadMarkets();
|
|
2669
|
-
const currency = this.
|
|
2670
|
-
|
|
2671
|
-
'currency': currency['id'],
|
|
2672
|
-
};
|
|
2673
|
-
const networks = this.safeValue(this.options, 'networks', {});
|
|
2674
|
-
let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
|
|
2675
|
-
network = this.safeString(networks, network, network); // handle ERC20>ETH alias
|
|
2676
|
-
if (network !== undefined) {
|
|
2677
|
-
request['currency'] = request['currency'] + network; // when network the currency need to be changed to currency+network https://docs.poloniex.com/#withdraw on MultiChain Currencies section
|
|
2678
|
-
params = this.omit(params, 'network');
|
|
2679
|
-
}
|
|
2680
|
-
else {
|
|
2681
|
-
if (currency['id'] === 'USDT') {
|
|
2682
|
-
throw new errors.ArgumentsRequired(this.id + ' createDepositAddress requires a network parameter for ' + code + '.');
|
|
2683
|
-
}
|
|
2684
|
-
}
|
|
2690
|
+
const [request, extraParams, currency, networkEntry] = this.prepareRequestForDepositAddress(code, params);
|
|
2691
|
+
params = extraParams;
|
|
2685
2692
|
const response = await this.privatePostWalletsAddress(this.extend(request, params));
|
|
2686
2693
|
//
|
|
2687
2694
|
// {
|
|
2688
2695
|
// "address" : "0xfxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxf"
|
|
2689
2696
|
// }
|
|
2690
2697
|
//
|
|
2691
|
-
|
|
2692
|
-
let tag = undefined;
|
|
2693
|
-
this.checkAddress(address);
|
|
2694
|
-
if (currency !== undefined) {
|
|
2695
|
-
const depositAddress = this.safeString(currency['info'], 'depositAddress');
|
|
2696
|
-
if (depositAddress !== undefined) {
|
|
2697
|
-
tag = address;
|
|
2698
|
-
address = depositAddress;
|
|
2699
|
-
}
|
|
2700
|
-
}
|
|
2701
|
-
return {
|
|
2702
|
-
'currency': code,
|
|
2703
|
-
'address': address,
|
|
2704
|
-
'tag': tag,
|
|
2705
|
-
'network': network,
|
|
2706
|
-
'info': response,
|
|
2707
|
-
};
|
|
2698
|
+
return this.parseDepositAddressSpecial(response, currency, networkEntry);
|
|
2708
2699
|
}
|
|
2709
2700
|
/**
|
|
2710
2701
|
* @method
|
|
@@ -2717,33 +2708,55 @@ class poloniex extends poloniex$1 {
|
|
|
2717
2708
|
*/
|
|
2718
2709
|
async fetchDepositAddress(code, params = {}) {
|
|
2719
2710
|
await this.loadMarkets();
|
|
2720
|
-
const currency = this.
|
|
2721
|
-
|
|
2722
|
-
'currency': currency['id'],
|
|
2723
|
-
};
|
|
2724
|
-
const networks = this.safeValue(this.options, 'networks', {});
|
|
2725
|
-
let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
|
|
2726
|
-
network = this.safeString(networks, network, network); // handle ERC20>ETH alias
|
|
2727
|
-
if (network !== undefined) {
|
|
2728
|
-
request['currency'] = request['currency'] + network; // when network the currency need to be changed to currency+network https://docs.poloniex.com/#withdraw on MultiChain Currencies section
|
|
2729
|
-
params = this.omit(params, 'network');
|
|
2730
|
-
}
|
|
2731
|
-
else {
|
|
2732
|
-
if (currency['id'] === 'USDT') {
|
|
2733
|
-
throw new errors.ArgumentsRequired(this.id + ' fetchDepositAddress requires a network parameter for ' + code + '.');
|
|
2734
|
-
}
|
|
2735
|
-
}
|
|
2711
|
+
const [request, extraParams, currency, networkEntry] = this.prepareRequestForDepositAddress(code, params);
|
|
2712
|
+
params = extraParams;
|
|
2736
2713
|
const response = await this.privateGetWalletsAddresses(this.extend(request, params));
|
|
2737
2714
|
//
|
|
2738
2715
|
// {
|
|
2739
2716
|
// "USDTTRON" : "Txxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxp"
|
|
2740
2717
|
// }
|
|
2741
2718
|
//
|
|
2742
|
-
|
|
2719
|
+
const keys = Object.keys(response);
|
|
2720
|
+
const length = keys.length;
|
|
2721
|
+
if (length < 1) {
|
|
2722
|
+
throw new errors.ExchangeError(this.id + ' fetchDepositAddress() returned an empty response, you might need to try "createDepositAddress" at first and then use "fetchDepositAddress"');
|
|
2723
|
+
}
|
|
2724
|
+
return this.parseDepositAddressSpecial(response, currency, networkEntry);
|
|
2725
|
+
}
|
|
2726
|
+
prepareRequestForDepositAddress(code, params = {}) {
|
|
2727
|
+
if (!(code in this.currencies)) {
|
|
2728
|
+
throw new errors.BadSymbol(this.id + ' fetchDepositAddress(): can not recognize ' + code + ' currency, you might try using unified currency-code and add provide specific "network" parameter, like: fetchDepositAddress("USDT", { "network": "TRC20" })');
|
|
2729
|
+
}
|
|
2730
|
+
const currency = this.currency(code);
|
|
2731
|
+
let networkCode = undefined;
|
|
2732
|
+
[networkCode, params] = this.handleNetworkCodeAndParams(params);
|
|
2733
|
+
if (networkCode === undefined) {
|
|
2734
|
+
// we need to know the network to find out the currency-junction
|
|
2735
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchDepositAddress requires a network parameter for ' + code + '.');
|
|
2736
|
+
}
|
|
2737
|
+
let exchangeNetworkId = undefined;
|
|
2738
|
+
networkCode = this.networkIdToCode(networkCode, code);
|
|
2739
|
+
const networkEntry = this.safeDict(currency['networks'], networkCode);
|
|
2740
|
+
if (networkEntry !== undefined) {
|
|
2741
|
+
exchangeNetworkId = networkEntry['id'];
|
|
2742
|
+
}
|
|
2743
|
+
else {
|
|
2744
|
+
exchangeNetworkId = networkCode;
|
|
2745
|
+
}
|
|
2746
|
+
const request = {
|
|
2747
|
+
'currency': exchangeNetworkId,
|
|
2748
|
+
};
|
|
2749
|
+
return [request, params, currency, networkEntry];
|
|
2750
|
+
}
|
|
2751
|
+
parseDepositAddressSpecial(response, currency, networkEntry) {
|
|
2752
|
+
let address = this.safeString(response, 'address');
|
|
2753
|
+
if (address === undefined) {
|
|
2754
|
+
address = this.safeString(response, networkEntry['id']);
|
|
2755
|
+
}
|
|
2743
2756
|
let tag = undefined;
|
|
2744
2757
|
this.checkAddress(address);
|
|
2745
|
-
if (
|
|
2746
|
-
const depositAddress = this.safeString(
|
|
2758
|
+
if (networkEntry !== undefined) {
|
|
2759
|
+
const depositAddress = this.safeString(networkEntry['info'], 'depositAddress');
|
|
2747
2760
|
if (depositAddress !== undefined) {
|
|
2748
2761
|
tag = address;
|
|
2749
2762
|
address = depositAddress;
|
|
@@ -2751,8 +2764,8 @@ class poloniex extends poloniex$1 {
|
|
|
2751
2764
|
}
|
|
2752
2765
|
return {
|
|
2753
2766
|
'info': response,
|
|
2754
|
-
'currency': code,
|
|
2755
|
-
'network': network,
|
|
2767
|
+
'currency': currency['code'],
|
|
2768
|
+
'network': this.safeString(networkEntry, 'network'),
|
|
2756
2769
|
'address': address,
|
|
2757
2770
|
'tag': tag,
|
|
2758
2771
|
};
|
|
@@ -2822,23 +2835,13 @@ class poloniex extends poloniex$1 {
|
|
|
2822
2835
|
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
2823
2836
|
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
2824
2837
|
this.checkAddress(address);
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
'amount': amount,
|
|
2830
|
-
'address': address,
|
|
2831
|
-
};
|
|
2838
|
+
const [request, extraParams, currency, networkEntry] = this.prepareRequestForDepositAddress(code, params);
|
|
2839
|
+
params = extraParams;
|
|
2840
|
+
request['amount'] = this.currencyToPrecision(code, amount);
|
|
2841
|
+
request['address'] = address;
|
|
2832
2842
|
if (tag !== undefined) {
|
|
2833
2843
|
request['paymentId'] = tag;
|
|
2834
2844
|
}
|
|
2835
|
-
const networks = this.safeValue(this.options, 'networks', {});
|
|
2836
|
-
let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
|
|
2837
|
-
network = this.safeString(networks, network, network); // handle ERC20>ETH alias
|
|
2838
|
-
if (network !== undefined) {
|
|
2839
|
-
request['currency'] = request['currency'] + network; // when network the currency need to be changed to currency+network https://docs.poloniex.com/#withdraw on MultiChain Currencies section
|
|
2840
|
-
params = this.omit(params, 'network');
|
|
2841
|
-
}
|
|
2842
2845
|
const response = await this.privatePostWalletsWithdraw(this.extend(request, params));
|
|
2843
2846
|
//
|
|
2844
2847
|
// {
|
|
@@ -2847,7 +2850,11 @@ class poloniex extends poloniex$1 {
|
|
|
2847
2850
|
// "withdrawalNumber": 13449869
|
|
2848
2851
|
// }
|
|
2849
2852
|
//
|
|
2850
|
-
|
|
2853
|
+
const withdrawResponse = {
|
|
2854
|
+
'response': response,
|
|
2855
|
+
'withdrawNetworkEntry': networkEntry,
|
|
2856
|
+
};
|
|
2857
|
+
return this.parseTransaction(withdrawResponse, currency);
|
|
2851
2858
|
}
|
|
2852
2859
|
async fetchTransactionsHelper(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
2853
2860
|
await this.loadMarkets();
|
|
@@ -3173,6 +3180,10 @@ class poloniex extends poloniex$1 {
|
|
|
3173
3180
|
// "withdrawalRequestsId": 33485231
|
|
3174
3181
|
// }
|
|
3175
3182
|
//
|
|
3183
|
+
// if it's being parsed from "withdraw()" method, get the original response
|
|
3184
|
+
if ('withdrawNetworkEntry' in transaction) {
|
|
3185
|
+
transaction = transaction['response'];
|
|
3186
|
+
}
|
|
3176
3187
|
const timestamp = this.safeTimestamp(transaction, 'timestamp');
|
|
3177
3188
|
const currencyId = this.safeString(transaction, 'currency');
|
|
3178
3189
|
const code = this.safeCurrencyCode(currencyId);
|