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/js/src/poloniex.js
CHANGED
|
@@ -309,6 +309,11 @@ export default class poloniex extends Exchange {
|
|
|
309
309
|
'BEP20': 'BSC',
|
|
310
310
|
'ERC20': 'ETH',
|
|
311
311
|
'TRC20': 'TRON',
|
|
312
|
+
'TRX': 'TRON',
|
|
313
|
+
},
|
|
314
|
+
'networksById': {
|
|
315
|
+
'TRX': 'TRC20',
|
|
316
|
+
'TRON': 'TRC20',
|
|
312
317
|
},
|
|
313
318
|
'limits': {
|
|
314
319
|
'cost': {
|
|
@@ -1151,105 +1156,107 @@ export default class poloniex extends Exchange {
|
|
|
1151
1156
|
const response = await this.publicGetCurrencies(this.extend(params, { 'includeMultiChainCurrencies': true }));
|
|
1152
1157
|
//
|
|
1153
1158
|
// [
|
|
1154
|
-
//
|
|
1155
|
-
//
|
|
1156
|
-
//
|
|
1157
|
-
//
|
|
1158
|
-
//
|
|
1159
|
-
//
|
|
1160
|
-
//
|
|
1161
|
-
//
|
|
1162
|
-
//
|
|
1163
|
-
//
|
|
1164
|
-
//
|
|
1165
|
-
//
|
|
1166
|
-
//
|
|
1167
|
-
//
|
|
1168
|
-
//
|
|
1169
|
-
//
|
|
1170
|
-
//
|
|
1171
|
-
//
|
|
1172
|
-
//
|
|
1173
|
-
//
|
|
1174
|
-
//
|
|
1159
|
+
// {
|
|
1160
|
+
// "USDT": {
|
|
1161
|
+
// "id": 214,
|
|
1162
|
+
// "name": "Tether USD",
|
|
1163
|
+
// "description": "Sweep to Main Account",
|
|
1164
|
+
// "type": "address",
|
|
1165
|
+
// "withdrawalFee": "0.00000000",
|
|
1166
|
+
// "minConf": 2,
|
|
1167
|
+
// "depositAddress": null,
|
|
1168
|
+
// "blockchain": "OMNI",
|
|
1169
|
+
// "delisted": false,
|
|
1170
|
+
// "tradingState": "NORMAL",
|
|
1171
|
+
// "walletState": "DISABLED",
|
|
1172
|
+
// "walletDepositState": "DISABLED",
|
|
1173
|
+
// "walletWithdrawalState": "DISABLED",
|
|
1174
|
+
// "supportCollateral": true,
|
|
1175
|
+
// "supportBorrow": true,
|
|
1176
|
+
// "parentChain": null,
|
|
1177
|
+
// "isMultiChain": true,
|
|
1178
|
+
// "isChildChain": false,
|
|
1179
|
+
// "childChains": [
|
|
1180
|
+
// "USDTBSC",
|
|
1181
|
+
// "USDTETH",
|
|
1182
|
+
// "USDTSOL",
|
|
1183
|
+
// "USDTTRON"
|
|
1184
|
+
// ]
|
|
1185
|
+
// }
|
|
1186
|
+
// },
|
|
1187
|
+
// ...
|
|
1188
|
+
// {
|
|
1189
|
+
// "USDTBSC": {
|
|
1190
|
+
// "id": 582,
|
|
1191
|
+
// "name": "Binance-Peg BSC-USD",
|
|
1192
|
+
// "description": "Sweep to Main Account",
|
|
1193
|
+
// "type": "address",
|
|
1194
|
+
// "withdrawalFee": "0.00000000",
|
|
1195
|
+
// "minConf": 15,
|
|
1196
|
+
// "depositAddress": null,
|
|
1197
|
+
// "blockchain": "BSC",
|
|
1198
|
+
// "delisted": false,
|
|
1199
|
+
// "tradingState": "OFFLINE",
|
|
1200
|
+
// "walletState": "ENABLED",
|
|
1201
|
+
// "walletDepositState": "ENABLED",
|
|
1202
|
+
// "walletWithdrawalState": "DISABLED",
|
|
1203
|
+
// "supportCollateral": false,
|
|
1204
|
+
// "supportBorrow": false,
|
|
1205
|
+
// "parentChain": "USDT",
|
|
1206
|
+
// "isMultiChain": true,
|
|
1207
|
+
// "isChildChain": true,
|
|
1208
|
+
// "childChains": []
|
|
1209
|
+
// }
|
|
1210
|
+
// },
|
|
1211
|
+
// ...
|
|
1175
1212
|
// ]
|
|
1176
1213
|
//
|
|
1177
1214
|
const result = {};
|
|
1215
|
+
// poloniex has a complicated structure of currencies, so we handle them differently
|
|
1216
|
+
// at first, turn the response into a normal dictionary
|
|
1217
|
+
const currenciesDict = {};
|
|
1178
1218
|
for (let i = 0; i < response.length; i++) {
|
|
1179
|
-
const item = this.
|
|
1219
|
+
const item = this.safeDict(response, i);
|
|
1180
1220
|
const ids = Object.keys(item);
|
|
1181
|
-
const id = this.
|
|
1182
|
-
|
|
1221
|
+
const id = this.safeString(ids, 0);
|
|
1222
|
+
currenciesDict[id] = item[id];
|
|
1223
|
+
}
|
|
1224
|
+
const keys = Object.keys(currenciesDict);
|
|
1225
|
+
for (let i = 0; i < keys.length; i++) {
|
|
1226
|
+
const id = keys[i];
|
|
1227
|
+
const entry = currenciesDict[id];
|
|
1183
1228
|
const code = this.safeCurrencyCode(id);
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
if (networkId !== undefined) {
|
|
1188
|
-
networkCode = this.networkIdToCode(networkId, code);
|
|
1189
|
-
}
|
|
1190
|
-
const delisted = this.safeValue(currency, 'delisted');
|
|
1191
|
-
const walletEnabled = this.safeString(currency, 'walletState') === 'ENABLED';
|
|
1192
|
-
const depositEnabled = this.safeString(currency, 'walletDepositState') === 'ENABLED';
|
|
1193
|
-
const withdrawEnabled = this.safeString(currency, 'walletWithdrawalState') === 'ENABLED';
|
|
1194
|
-
const active = !delisted && walletEnabled && depositEnabled && withdrawEnabled;
|
|
1195
|
-
const numericId = this.safeInteger(currency, 'id');
|
|
1196
|
-
const feeString = this.safeString(currency, 'withdrawalFee');
|
|
1197
|
-
const parentChain = this.safeValue(currency, 'parentChain');
|
|
1198
|
-
const noParentChain = parentChain === undefined;
|
|
1199
|
-
if (this.safeValue(result, code) === undefined) {
|
|
1200
|
-
result[code] = {
|
|
1201
|
-
'id': id,
|
|
1202
|
-
'code': code,
|
|
1203
|
-
'info': undefined,
|
|
1204
|
-
'name': name,
|
|
1205
|
-
'active': active,
|
|
1206
|
-
'deposit': depositEnabled,
|
|
1207
|
-
'withdraw': withdrawEnabled,
|
|
1208
|
-
'fee': this.parseNumber(feeString),
|
|
1209
|
-
'precision': undefined,
|
|
1210
|
-
'type': 'crypto',
|
|
1211
|
-
'limits': {
|
|
1212
|
-
'amount': {
|
|
1213
|
-
'min': undefined,
|
|
1214
|
-
'max': undefined,
|
|
1215
|
-
},
|
|
1216
|
-
'deposit': {
|
|
1217
|
-
'min': undefined,
|
|
1218
|
-
'max': undefined,
|
|
1219
|
-
},
|
|
1220
|
-
'withdraw': {
|
|
1221
|
-
'min': undefined,
|
|
1222
|
-
'max': undefined,
|
|
1223
|
-
},
|
|
1224
|
-
},
|
|
1225
|
-
};
|
|
1229
|
+
// skip childChains, as they are collected in parentChain loop
|
|
1230
|
+
if (this.safeBool(entry, 'isChildChain')) {
|
|
1231
|
+
continue;
|
|
1226
1232
|
}
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1233
|
+
const allChainEntries = [];
|
|
1234
|
+
const childChains = this.safeList(entry, 'childChains', []);
|
|
1235
|
+
if (childChains !== undefined) {
|
|
1236
|
+
for (let j = 0; j < childChains.length; j++) {
|
|
1237
|
+
const childChainId = childChains[j];
|
|
1238
|
+
const childNetworkEntry = this.safeDict(currenciesDict, childChainId);
|
|
1239
|
+
allChainEntries.push(childNetworkEntry);
|
|
1240
|
+
}
|
|
1230
1241
|
}
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
let
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1242
|
+
allChainEntries.push(entry);
|
|
1243
|
+
const networks = {};
|
|
1244
|
+
for (let j = 0; j < allChainEntries.length; j++) {
|
|
1245
|
+
const chainEntry = allChainEntries[j];
|
|
1246
|
+
const networkName = this.safeString(chainEntry, 'blockchain');
|
|
1247
|
+
const networkCode = this.networkIdToCode(networkName, code);
|
|
1248
|
+
const specialNetworkId = this.safeString(childChains, j, id); // in case it's primary chain, defeault to ID
|
|
1237
1249
|
networks[networkCode] = {
|
|
1238
|
-
'info':
|
|
1239
|
-
'id':
|
|
1250
|
+
'info': chainEntry,
|
|
1251
|
+
'id': specialNetworkId,
|
|
1252
|
+
'numericId': this.safeInteger(chainEntry, 'id'),
|
|
1240
1253
|
'network': networkCode,
|
|
1241
|
-
'
|
|
1242
|
-
'
|
|
1243
|
-
'
|
|
1244
|
-
'
|
|
1245
|
-
'active': active,
|
|
1246
|
-
'fee': this.parseNumber(feeString),
|
|
1254
|
+
'active': this.safeBool(chainEntry, 'walletState'),
|
|
1255
|
+
'deposit': this.safeString(chainEntry, 'walletDepositState') === 'ENABLED',
|
|
1256
|
+
'withdraw': this.safeString(chainEntry, 'walletWithdrawalState') === 'ENABLED',
|
|
1257
|
+
'fee': this.safeNumber(chainEntry, 'withdrawalFee'),
|
|
1247
1258
|
'precision': undefined,
|
|
1248
1259
|
'limits': {
|
|
1249
|
-
'amount': {
|
|
1250
|
-
'min': undefined,
|
|
1251
|
-
'max': undefined,
|
|
1252
|
-
},
|
|
1253
1260
|
'withdraw': {
|
|
1254
1261
|
'min': undefined,
|
|
1255
1262
|
'max': undefined,
|
|
@@ -1261,20 +1268,34 @@ export default class poloniex extends Exchange {
|
|
|
1261
1268
|
},
|
|
1262
1269
|
};
|
|
1263
1270
|
}
|
|
1264
|
-
result[code]
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1271
|
+
result[code] = this.safeCurrencyStructure({
|
|
1272
|
+
'info': entry,
|
|
1273
|
+
'code': code,
|
|
1274
|
+
'id': id,
|
|
1275
|
+
'numericId': this.safeInteger(entry, 'id'),
|
|
1276
|
+
'type': 'crypto',
|
|
1277
|
+
'name': this.safeString(entry, 'name'),
|
|
1278
|
+
'active': undefined,
|
|
1279
|
+
'deposit': undefined,
|
|
1280
|
+
'withdraw': undefined,
|
|
1281
|
+
'fee': undefined,
|
|
1282
|
+
'precision': undefined,
|
|
1283
|
+
'limits': {
|
|
1284
|
+
'amount': {
|
|
1285
|
+
'min': undefined,
|
|
1286
|
+
'max': undefined,
|
|
1287
|
+
},
|
|
1288
|
+
'withdraw': {
|
|
1289
|
+
'min': undefined,
|
|
1290
|
+
'max': undefined,
|
|
1291
|
+
},
|
|
1292
|
+
'deposit': {
|
|
1293
|
+
'min': undefined,
|
|
1294
|
+
'max': undefined,
|
|
1295
|
+
},
|
|
1296
|
+
},
|
|
1297
|
+
'networks': networks,
|
|
1298
|
+
});
|
|
1278
1299
|
}
|
|
1279
1300
|
return result;
|
|
1280
1301
|
}
|
|
@@ -2669,45 +2690,15 @@ export default class poloniex extends Exchange {
|
|
|
2669
2690
|
*/
|
|
2670
2691
|
async createDepositAddress(code, params = {}) {
|
|
2671
2692
|
await this.loadMarkets();
|
|
2672
|
-
const currency = this.
|
|
2673
|
-
|
|
2674
|
-
'currency': currency['id'],
|
|
2675
|
-
};
|
|
2676
|
-
const networks = this.safeValue(this.options, 'networks', {});
|
|
2677
|
-
let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
|
|
2678
|
-
network = this.safeString(networks, network, network); // handle ERC20>ETH alias
|
|
2679
|
-
if (network !== undefined) {
|
|
2680
|
-
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
|
|
2681
|
-
params = this.omit(params, 'network');
|
|
2682
|
-
}
|
|
2683
|
-
else {
|
|
2684
|
-
if (currency['id'] === 'USDT') {
|
|
2685
|
-
throw new ArgumentsRequired(this.id + ' createDepositAddress requires a network parameter for ' + code + '.');
|
|
2686
|
-
}
|
|
2687
|
-
}
|
|
2693
|
+
const [request, extraParams, currency, networkEntry] = this.prepareRequestForDepositAddress(code, params);
|
|
2694
|
+
params = extraParams;
|
|
2688
2695
|
const response = await this.privatePostWalletsAddress(this.extend(request, params));
|
|
2689
2696
|
//
|
|
2690
2697
|
// {
|
|
2691
2698
|
// "address" : "0xfxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxf"
|
|
2692
2699
|
// }
|
|
2693
2700
|
//
|
|
2694
|
-
|
|
2695
|
-
let tag = undefined;
|
|
2696
|
-
this.checkAddress(address);
|
|
2697
|
-
if (currency !== undefined) {
|
|
2698
|
-
const depositAddress = this.safeString(currency['info'], 'depositAddress');
|
|
2699
|
-
if (depositAddress !== undefined) {
|
|
2700
|
-
tag = address;
|
|
2701
|
-
address = depositAddress;
|
|
2702
|
-
}
|
|
2703
|
-
}
|
|
2704
|
-
return {
|
|
2705
|
-
'currency': code,
|
|
2706
|
-
'address': address,
|
|
2707
|
-
'tag': tag,
|
|
2708
|
-
'network': network,
|
|
2709
|
-
'info': response,
|
|
2710
|
-
};
|
|
2701
|
+
return this.parseDepositAddressSpecial(response, currency, networkEntry);
|
|
2711
2702
|
}
|
|
2712
2703
|
/**
|
|
2713
2704
|
* @method
|
|
@@ -2720,33 +2711,55 @@ export default class poloniex extends Exchange {
|
|
|
2720
2711
|
*/
|
|
2721
2712
|
async fetchDepositAddress(code, params = {}) {
|
|
2722
2713
|
await this.loadMarkets();
|
|
2723
|
-
const currency = this.
|
|
2724
|
-
|
|
2725
|
-
'currency': currency['id'],
|
|
2726
|
-
};
|
|
2727
|
-
const networks = this.safeValue(this.options, 'networks', {});
|
|
2728
|
-
let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
|
|
2729
|
-
network = this.safeString(networks, network, network); // handle ERC20>ETH alias
|
|
2730
|
-
if (network !== undefined) {
|
|
2731
|
-
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
|
|
2732
|
-
params = this.omit(params, 'network');
|
|
2733
|
-
}
|
|
2734
|
-
else {
|
|
2735
|
-
if (currency['id'] === 'USDT') {
|
|
2736
|
-
throw new ArgumentsRequired(this.id + ' fetchDepositAddress requires a network parameter for ' + code + '.');
|
|
2737
|
-
}
|
|
2738
|
-
}
|
|
2714
|
+
const [request, extraParams, currency, networkEntry] = this.prepareRequestForDepositAddress(code, params);
|
|
2715
|
+
params = extraParams;
|
|
2739
2716
|
const response = await this.privateGetWalletsAddresses(this.extend(request, params));
|
|
2740
2717
|
//
|
|
2741
2718
|
// {
|
|
2742
2719
|
// "USDTTRON" : "Txxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxp"
|
|
2743
2720
|
// }
|
|
2744
2721
|
//
|
|
2745
|
-
|
|
2722
|
+
const keys = Object.keys(response);
|
|
2723
|
+
const length = keys.length;
|
|
2724
|
+
if (length < 1) {
|
|
2725
|
+
throw new ExchangeError(this.id + ' fetchDepositAddress() returned an empty response, you might need to try "createDepositAddress" at first and then use "fetchDepositAddress"');
|
|
2726
|
+
}
|
|
2727
|
+
return this.parseDepositAddressSpecial(response, currency, networkEntry);
|
|
2728
|
+
}
|
|
2729
|
+
prepareRequestForDepositAddress(code, params = {}) {
|
|
2730
|
+
if (!(code in this.currencies)) {
|
|
2731
|
+
throw new 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" })');
|
|
2732
|
+
}
|
|
2733
|
+
const currency = this.currency(code);
|
|
2734
|
+
let networkCode = undefined;
|
|
2735
|
+
[networkCode, params] = this.handleNetworkCodeAndParams(params);
|
|
2736
|
+
if (networkCode === undefined) {
|
|
2737
|
+
// we need to know the network to find out the currency-junction
|
|
2738
|
+
throw new ArgumentsRequired(this.id + ' fetchDepositAddress requires a network parameter for ' + code + '.');
|
|
2739
|
+
}
|
|
2740
|
+
let exchangeNetworkId = undefined;
|
|
2741
|
+
networkCode = this.networkIdToCode(networkCode, code);
|
|
2742
|
+
const networkEntry = this.safeDict(currency['networks'], networkCode);
|
|
2743
|
+
if (networkEntry !== undefined) {
|
|
2744
|
+
exchangeNetworkId = networkEntry['id'];
|
|
2745
|
+
}
|
|
2746
|
+
else {
|
|
2747
|
+
exchangeNetworkId = networkCode;
|
|
2748
|
+
}
|
|
2749
|
+
const request = {
|
|
2750
|
+
'currency': exchangeNetworkId,
|
|
2751
|
+
};
|
|
2752
|
+
return [request, params, currency, networkEntry];
|
|
2753
|
+
}
|
|
2754
|
+
parseDepositAddressSpecial(response, currency, networkEntry) {
|
|
2755
|
+
let address = this.safeString(response, 'address');
|
|
2756
|
+
if (address === undefined) {
|
|
2757
|
+
address = this.safeString(response, networkEntry['id']);
|
|
2758
|
+
}
|
|
2746
2759
|
let tag = undefined;
|
|
2747
2760
|
this.checkAddress(address);
|
|
2748
|
-
if (
|
|
2749
|
-
const depositAddress = this.safeString(
|
|
2761
|
+
if (networkEntry !== undefined) {
|
|
2762
|
+
const depositAddress = this.safeString(networkEntry['info'], 'depositAddress');
|
|
2750
2763
|
if (depositAddress !== undefined) {
|
|
2751
2764
|
tag = address;
|
|
2752
2765
|
address = depositAddress;
|
|
@@ -2754,8 +2767,8 @@ export default class poloniex extends Exchange {
|
|
|
2754
2767
|
}
|
|
2755
2768
|
return {
|
|
2756
2769
|
'info': response,
|
|
2757
|
-
'currency': code,
|
|
2758
|
-
'network': network,
|
|
2770
|
+
'currency': currency['code'],
|
|
2771
|
+
'network': this.safeString(networkEntry, 'network'),
|
|
2759
2772
|
'address': address,
|
|
2760
2773
|
'tag': tag,
|
|
2761
2774
|
};
|
|
@@ -2825,23 +2838,13 @@ export default class poloniex extends Exchange {
|
|
|
2825
2838
|
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
2826
2839
|
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
2827
2840
|
this.checkAddress(address);
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
'amount': amount,
|
|
2833
|
-
'address': address,
|
|
2834
|
-
};
|
|
2841
|
+
const [request, extraParams, currency, networkEntry] = this.prepareRequestForDepositAddress(code, params);
|
|
2842
|
+
params = extraParams;
|
|
2843
|
+
request['amount'] = this.currencyToPrecision(code, amount);
|
|
2844
|
+
request['address'] = address;
|
|
2835
2845
|
if (tag !== undefined) {
|
|
2836
2846
|
request['paymentId'] = tag;
|
|
2837
2847
|
}
|
|
2838
|
-
const networks = this.safeValue(this.options, 'networks', {});
|
|
2839
|
-
let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
|
|
2840
|
-
network = this.safeString(networks, network, network); // handle ERC20>ETH alias
|
|
2841
|
-
if (network !== undefined) {
|
|
2842
|
-
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
|
|
2843
|
-
params = this.omit(params, 'network');
|
|
2844
|
-
}
|
|
2845
2848
|
const response = await this.privatePostWalletsWithdraw(this.extend(request, params));
|
|
2846
2849
|
//
|
|
2847
2850
|
// {
|
|
@@ -2850,7 +2853,11 @@ export default class poloniex extends Exchange {
|
|
|
2850
2853
|
// "withdrawalNumber": 13449869
|
|
2851
2854
|
// }
|
|
2852
2855
|
//
|
|
2853
|
-
|
|
2856
|
+
const withdrawResponse = {
|
|
2857
|
+
'response': response,
|
|
2858
|
+
'withdrawNetworkEntry': networkEntry,
|
|
2859
|
+
};
|
|
2860
|
+
return this.parseTransaction(withdrawResponse, currency);
|
|
2854
2861
|
}
|
|
2855
2862
|
async fetchTransactionsHelper(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
2856
2863
|
await this.loadMarkets();
|
|
@@ -3176,6 +3183,10 @@ export default class poloniex extends Exchange {
|
|
|
3176
3183
|
// "withdrawalRequestsId": 33485231
|
|
3177
3184
|
// }
|
|
3178
3185
|
//
|
|
3186
|
+
// if it's being parsed from "withdraw()" method, get the original response
|
|
3187
|
+
if ('withdrawNetworkEntry' in transaction) {
|
|
3188
|
+
transaction = transaction['response'];
|
|
3189
|
+
}
|
|
3179
3190
|
const timestamp = this.safeTimestamp(transaction, 'timestamp');
|
|
3180
3191
|
const currencyId = this.safeString(transaction, 'currency');
|
|
3181
3192
|
const code = this.safeCurrencyCode(currencyId);
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import modetradeRest from '../modetrade.js';
|
|
2
|
+
import type { Int, Str, Strings, OrderBook, Order, Trade, Ticker, Tickers, OHLCV, Balances, Position } from '../base/types.js';
|
|
3
|
+
import Client from '../base/ws/Client.js';
|
|
4
|
+
export default class modetrade extends modetradeRest {
|
|
5
|
+
describe(): any;
|
|
6
|
+
requestId(url: any): any;
|
|
7
|
+
watchPublic(messageHash: any, message: any): Promise<any>;
|
|
8
|
+
/**
|
|
9
|
+
* @method
|
|
10
|
+
* @name modetrade#watchOrderBook
|
|
11
|
+
* @see https://orderly.network/docs/build-on-evm/evm-api/websocket-api/public/orderbook
|
|
12
|
+
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
13
|
+
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
14
|
+
* @param {int} [limit] the maximum amount of order book entries to return.
|
|
15
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
16
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
17
|
+
*/
|
|
18
|
+
watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
19
|
+
handleOrderBook(client: Client, message: any): void;
|
|
20
|
+
/**
|
|
21
|
+
* @method
|
|
22
|
+
* @name modetrade#watchTicker
|
|
23
|
+
* @see https://orderly.network/docs/build-on-evm/evm-api/websocket-api/public/24-hour-ticker
|
|
24
|
+
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
25
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
26
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
27
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
28
|
+
*/
|
|
29
|
+
watchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
30
|
+
parseWsTicker(ticker: any, market?: any): Ticker;
|
|
31
|
+
handleTicker(client: Client, message: any): any;
|
|
32
|
+
/**
|
|
33
|
+
* @method
|
|
34
|
+
* @name modetrade#watchTickers
|
|
35
|
+
* @see https://orderly.network/docs/build-on-evm/evm-api/websocket-api/public/24-hour-tickers
|
|
36
|
+
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
37
|
+
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
38
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
39
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
40
|
+
*/
|
|
41
|
+
watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
42
|
+
handleTickers(client: Client, message: any): void;
|
|
43
|
+
/**
|
|
44
|
+
* @method
|
|
45
|
+
* @name modetrade#watchBidsAsks
|
|
46
|
+
* @see https://orderly.network/docs/build-on-evm/evm-api/websocket-api/public/bbos
|
|
47
|
+
* @description watches best bid & ask for symbols
|
|
48
|
+
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
49
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
50
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
51
|
+
*/
|
|
52
|
+
watchBidsAsks(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
53
|
+
handleBidAsk(client: Client, message: any): void;
|
|
54
|
+
parseWsBidAsk(ticker: any, market?: any): Ticker;
|
|
55
|
+
/**
|
|
56
|
+
* @method
|
|
57
|
+
* @name modetrade#watchOHLCV
|
|
58
|
+
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
59
|
+
* @see https://orderly.network/docs/build-on-evm/evm-api/websocket-api/public/k-line
|
|
60
|
+
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
61
|
+
* @param {string} timeframe the length of time each candle represents
|
|
62
|
+
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
63
|
+
* @param {int} [limit] the maximum amount of candles to fetch
|
|
64
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
65
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
66
|
+
*/
|
|
67
|
+
watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
68
|
+
handleOHLCV(client: Client, message: any): void;
|
|
69
|
+
/**
|
|
70
|
+
* @method
|
|
71
|
+
* @name modetrade#watchTrades
|
|
72
|
+
* @description watches information on multiple trades made in a market
|
|
73
|
+
* @see https://orderly.network/docs/build-on-evm/evm-api/websocket-api/public/trade
|
|
74
|
+
* @param {string} symbol unified market symbol of the market trades were made in
|
|
75
|
+
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
76
|
+
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
77
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
78
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
79
|
+
*/
|
|
80
|
+
watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
81
|
+
handleTrade(client: Client, message: any): void;
|
|
82
|
+
parseWsTrade(trade: any, market?: any): Trade;
|
|
83
|
+
handleAuth(client: Client, message: any): void;
|
|
84
|
+
authenticate(params?: {}): Promise<any>;
|
|
85
|
+
watchPrivate(messageHash: any, message: any, params?: {}): Promise<any>;
|
|
86
|
+
watchPrivateMultiple(messageHashes: any, message: any, params?: {}): Promise<any>;
|
|
87
|
+
/**
|
|
88
|
+
* @method
|
|
89
|
+
* @name modetrade#watchOrders
|
|
90
|
+
* @description watches information on multiple orders made by the user
|
|
91
|
+
* @see https://orderly.network/docs/build-on-evm/evm-api/websocket-api/private/execution-report
|
|
92
|
+
* @see https://orderly.network/docs/build-on-evm/evm-api/websocket-api/private/algo-execution-report
|
|
93
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
94
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
95
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
96
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
97
|
+
* @param {bool} [params.trigger] true if trigger order
|
|
98
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
99
|
+
*/
|
|
100
|
+
watchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
101
|
+
/**
|
|
102
|
+
* @method
|
|
103
|
+
* @name modetrade#watchMyTrades
|
|
104
|
+
* @description watches information on multiple trades made by the user
|
|
105
|
+
* @see https://orderly.network/docs/build-on-evm/evm-api/websocket-api/private/execution-report
|
|
106
|
+
* @see https://orderly.network/docs/build-on-evm/evm-api/websocket-api/private/algo-execution-report
|
|
107
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
108
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
109
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
110
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
111
|
+
* @param {bool} [params.trigger] true if trigger order
|
|
112
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
113
|
+
*/
|
|
114
|
+
watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
115
|
+
parseWsOrder(order: any, market?: any): Order;
|
|
116
|
+
handleOrderUpdate(client: Client, message: any): void;
|
|
117
|
+
handleOrder(client: Client, message: any, topic: any): void;
|
|
118
|
+
handleMyTrade(client: Client, message: any): void;
|
|
119
|
+
/**
|
|
120
|
+
* @method
|
|
121
|
+
* @name modetrade#watchPositions
|
|
122
|
+
* @see https://orderly.network/docs/build-on-evm/evm-api/websocket-api/private/position-push
|
|
123
|
+
* @description watch all open positions
|
|
124
|
+
* @param {string[]} [symbols] list of unified market symbols
|
|
125
|
+
* @param since timestamp in ms of the earliest position to fetch
|
|
126
|
+
* @param limit the maximum number of positions to fetch
|
|
127
|
+
* @param {object} params extra parameters specific to the exchange API endpoint
|
|
128
|
+
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
|
|
129
|
+
*/
|
|
130
|
+
watchPositions(symbols?: Strings, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
|
|
131
|
+
setPositionsCache(client: Client, type: any, symbols?: Strings): void;
|
|
132
|
+
loadPositionsSnapshot(client: any, messageHash: any): Promise<void>;
|
|
133
|
+
handlePositions(client: any, message: any): void;
|
|
134
|
+
parseWsPosition(position: any, market?: any): Position;
|
|
135
|
+
/**
|
|
136
|
+
* @method
|
|
137
|
+
* @name modetrade#watchBalance
|
|
138
|
+
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
139
|
+
* @see https://orderly.network/docs/build-on-evm/evm-api/websocket-api/private/balance
|
|
140
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
141
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
142
|
+
*/
|
|
143
|
+
watchBalance(params?: {}): Promise<Balances>;
|
|
144
|
+
handleBalance(client: any, message: any): void;
|
|
145
|
+
handleErrorMessage(client: Client, message: any): boolean;
|
|
146
|
+
handleMessage(client: Client, message: any): void;
|
|
147
|
+
ping(client: Client): {
|
|
148
|
+
event: string;
|
|
149
|
+
};
|
|
150
|
+
handlePing(client: Client, message: any): {
|
|
151
|
+
event: string;
|
|
152
|
+
};
|
|
153
|
+
handlePong(client: Client, message: any): any;
|
|
154
|
+
handleSubscribe(client: Client, message: any): any;
|
|
155
|
+
}
|