ccxt 4.1.65 → 4.1.66

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
@@ -173,7 +173,7 @@ var woo$1 = require('./src/pro/woo.js');
173
173
 
174
174
  //-----------------------------------------------------------------------------
175
175
  // this is updated by vss.js when building
176
- const version = '4.1.65';
176
+ const version = '4.1.66';
177
177
  Exchange["default"].ccxtVersion = version;
178
178
  const exchanges = {
179
179
  'ace': ace,
@@ -52,6 +52,9 @@ class Exchange {
52
52
  this.origin = '*'; // CORS origin
53
53
  //
54
54
  this.agent = undefined; // maintained for backwards compatibility
55
+ this.nodeHttpModuleLoaded = false;
56
+ this.httpAgent = undefined;
57
+ this.httpsAgent = undefined;
55
58
  this.minFundingAddressLength = 1; // used in checkAddress
56
59
  this.substituteCommonCurrencyCodes = true; // reserved
57
60
  this.quoteJsonNumbers = true; // treat numbers in json as quoted precise strings
@@ -213,6 +216,12 @@ class Exchange {
213
216
  this.ymd = ymd;
214
217
  this.base64ToString = base64ToString;
215
218
  this.crc32 = crc32;
219
+ this.httpProxyAgentModule = undefined;
220
+ this.httpsProxyAgentModule = undefined;
221
+ this.socksProxyAgentModule = undefined;
222
+ this.socksProxyAgentModuleChecked = false;
223
+ this.proxyDictionaries = {};
224
+ this.proxyModulesLoaded = false;
216
225
  Object.assign(this, functions);
217
226
  //
218
227
  // if (isNode) {
@@ -645,39 +654,89 @@ class Exchange {
645
654
  log(...args) {
646
655
  console.log(...args);
647
656
  }
657
+ async loadProxyModules() {
658
+ this.proxyModulesLoaded = true;
659
+ // todo: possible sync alternatives: https://stackoverflow.com/questions/51069002/convert-import-to-synchronous
660
+ this.httpProxyAgentModule = await Promise.resolve().then(function () { return require(/* webpackIgnore: true */ '../static_dependencies/proxies/http-proxy-agent/index.js'); });
661
+ this.httpsProxyAgentModule = await Promise.resolve().then(function () { return require(/* webpackIgnore: true */ '../static_dependencies/proxies/https-proxy-agent/index.js'); });
662
+ if (this.socksProxyAgentModuleChecked === false) {
663
+ this.socksProxyAgentModuleChecked = true;
664
+ try {
665
+ // @ts-ignore
666
+ this.socksProxyAgentModule = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(/* webpackIgnore: true */ 'socks-proxy-agent')); });
667
+ }
668
+ catch (e) { }
669
+ }
670
+ }
671
+ setProxyAgents(httpProxy, httpsProxy, socksProxy) {
672
+ let chosenAgent = undefined;
673
+ if (httpProxy) {
674
+ if (this.httpProxyAgentModule === undefined) {
675
+ throw new errors.NotSupported(this.id + ' you need to load JS proxy modules with `.loadProxyModules()` method at first to use proxies');
676
+ }
677
+ if (!(httpProxy in this.proxyDictionaries)) {
678
+ this.proxyDictionaries[httpProxy] = new this.httpProxyAgentModule.HttpProxyAgent(httpProxy);
679
+ }
680
+ chosenAgent = this.proxyDictionaries[httpProxy];
681
+ }
682
+ else if (httpsProxy) {
683
+ if (this.httpsProxyAgentModule === undefined) {
684
+ throw new errors.NotSupported(this.id + ' you need to load JS proxy modules with `.loadProxyModules()` method at first to use proxies');
685
+ }
686
+ if (!(httpsProxy in this.proxyDictionaries)) {
687
+ this.proxyDictionaries[httpsProxy] = new this.httpsProxyAgentModule.HttpsProxyAgent(httpsProxy);
688
+ }
689
+ chosenAgent = this.proxyDictionaries[httpsProxy];
690
+ chosenAgent.keepAlive = true;
691
+ }
692
+ else if (socksProxy) {
693
+ if (this.socksProxyAgentModule === undefined) {
694
+ throw new errors.NotSupported(this.id + ' - to use SOCKS proxy with ccxt, at first you need install module "npm i socks-proxy-agent" and then initialize proxies with `.loadProxyModules()` method');
695
+ }
696
+ if (!(socksProxy in this.proxyDictionaries)) {
697
+ this.proxyDictionaries[socksProxy] = new this.socksProxyAgentModule.SocksProxyAgent(socksProxy);
698
+ }
699
+ chosenAgent = this.proxyDictionaries[socksProxy];
700
+ }
701
+ return chosenAgent;
702
+ }
648
703
  async fetch(url, method = 'GET', headers = undefined, body = undefined) {
704
+ // load node-http(s) modules only on first call
705
+ if (isNode) {
706
+ if (!this.nodeHttpModuleLoaded) {
707
+ this.nodeHttpModuleLoaded = true;
708
+ const httpsModule = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(/* webpackIgnore: true */ 'node:https')); });
709
+ this.httpsAgent = new httpsModule.Agent({ keepAlive: true });
710
+ }
711
+ }
649
712
  // ##### PROXY & HEADERS #####
650
713
  headers = this.extend(this.headers, headers);
651
- const [proxyUrl, httpProxy, httpsProxy, socksProxy] = this.checkProxySettings(url, method, headers, body);
714
+ // proxy-url
715
+ const proxyUrl = this.checkProxyUrlSettings(url, method, headers, body);
716
+ let isHttpAgentNeeded = false;
652
717
  if (proxyUrl !== undefined) {
653
718
  // in node we need to set header to *
654
719
  if (isNode) {
655
720
  headers = this.extend({ 'Origin': this.origin }, headers);
721
+ if (proxyUrl.substring(0, 5) !== 'https') {
722
+ // for `http://` protocol proxy-urls, we need to load `http` module only on first call
723
+ if (!this.httpAgent) {
724
+ const httpModule = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(/* webpackIgnore: true */ 'node:http')); });
725
+ this.httpAgent = new httpModule.Agent();
726
+ }
727
+ isHttpAgentNeeded = true;
728
+ }
656
729
  }
657
730
  url = proxyUrl + url;
658
731
  }
659
- else if (httpProxy !== undefined) {
660
- const module = await Promise.resolve().then(function () { return require(/* webpackIgnore: true */ '../static_dependencies/proxies/http-proxy-agent/index.js'); });
661
- const proxyAgent = new module.HttpProxyAgent(httpProxy);
662
- this.agent = proxyAgent;
663
- }
664
- else if (httpsProxy !== undefined) {
665
- const module = await Promise.resolve().then(function () { return require(/* webpackIgnore: true */ '../static_dependencies/proxies/https-proxy-agent/index.js'); });
666
- const proxyAgent = new module.HttpsProxyAgent(httpsProxy);
667
- proxyAgent.keepAlive = true;
668
- this.agent = proxyAgent;
669
- }
670
- else if (socksProxy !== undefined) {
671
- let module = undefined;
672
- try {
673
- // @ts-ignore
674
- module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(/* webpackIgnore: true */ 'socks-proxy-agent')); });
675
- }
676
- catch (e) {
677
- throw new errors.NotSupported(this.id + ' - to use SOCKS proxy with ccxt, at first you need install module "npm i socks-proxy-agent" ');
678
- }
679
- this.agent = new module.SocksProxyAgent(socksProxy);
732
+ // proxy agents
733
+ const [httpProxy, httpsProxy, socksProxy] = this.checkProxySettings(url, method, headers, body);
734
+ this.checkConflictingProxies(httpProxy || httpsProxy || socksProxy, proxyUrl);
735
+ if (!this.proxyModulesLoaded) {
736
+ await this.loadProxyModules(); // this is needed in JS, independently whether proxy properties were set or not, we have to load them because of necessity in WS, which would happen beyond 'fetch' method (WS/etc)
680
737
  }
738
+ const chosenAgent = this.setProxyAgents(httpProxy, httpsProxy, socksProxy);
739
+ // user-agent
681
740
  const userAgent = (this.userAgent !== undefined) ? this.userAgent : this.user_agent;
682
741
  if (userAgent && isNode) {
683
742
  if (typeof userAgent === 'string') {
@@ -687,17 +746,18 @@ class Exchange {
687
746
  headers = this.extend(userAgent, headers);
688
747
  }
689
748
  }
749
+ // set final headers
690
750
  headers = this.setHeaders(headers);
691
- // ######## end of proxies ########
751
+ // log
692
752
  if (this.verbose) {
693
753
  this.log("fetch Request:\n", this.id, method, url, "\nRequestHeaders:\n", headers, "\nRequestBody:\n", body, "\n");
694
754
  }
755
+ // end of proxies & headers
695
756
  if (this.fetchImplementation === undefined) {
696
757
  if (isNode) {
697
758
  const module = await Promise.resolve().then(function () { return require(/* webpackIgnore: true */ '../static_dependencies/node-fetch/index.js'); });
698
759
  if (this.agent === undefined) {
699
- const { Agent } = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(/* webpackIgnore: true */ 'node:https')); });
700
- this.agent = new Agent({ keepAlive: true });
760
+ this.agent = this.httpsAgent;
701
761
  }
702
762
  this.AbortError = module.AbortError;
703
763
  this.fetchImplementation = module.default;
@@ -716,6 +776,15 @@ class Exchange {
716
776
  if (this.agent) {
717
777
  params['agent'] = this.agent;
718
778
  }
779
+ // override agent, if needed
780
+ if (isHttpAgentNeeded) {
781
+ // if proxyUrl is being used, so we don't overwrite `this.agent` itself
782
+ params['agent'] = this.httpAgent;
783
+ }
784
+ else if (chosenAgent) {
785
+ // if http(s)Proxy is being used
786
+ params['agent'] = chosenAgent;
787
+ }
719
788
  const controller = new AbortController();
720
789
  params['signal'] = controller.signal;
721
790
  const timeout = setTimeout(() => {
@@ -916,6 +985,11 @@ class Exchange {
916
985
  const onConnected = this.onConnected.bind(this);
917
986
  // decide client type here: ws / signalr / socketio
918
987
  const wsOptions = this.safeValue(this.options, 'ws', {});
988
+ // proxy agents
989
+ const [httpProxy, httpsProxy, socksProxy] = this.checkWsProxySettings();
990
+ const chosenAgent = this.setProxyAgents(httpProxy, httpsProxy, socksProxy);
991
+ const finalAgent = chosenAgent ? chosenAgent : this.agent;
992
+ //
919
993
  const options = this.deepExtend(this.streaming, {
920
994
  'log': this.log ? this.log.bind(this) : this.log,
921
995
  'ping': this.ping ? this.ping.bind(this) : this.ping,
@@ -923,7 +997,7 @@ class Exchange {
923
997
  'throttler': new Throttler(this.tokenBucket),
924
998
  // add support for proxies
925
999
  'options': {
926
- 'agent': this.agent,
1000
+ 'agent': finalAgent,
927
1001
  }
928
1002
  }, wsOptions);
929
1003
  this.clients[url] = new WsClient(url, onMessage, onError, onClose, onConnected, options);
@@ -1087,6 +1161,9 @@ class Exchange {
1087
1161
  getProperty(obj, property, defaultValue = undefined) {
1088
1162
  return (property in obj ? obj[property] : defaultValue);
1089
1163
  }
1164
+ setProperty(obj, property, defaultValue = undefined) {
1165
+ obj[property] = defaultValue;
1166
+ }
1090
1167
  axolotl(payload, hexKey, ed25519) {
1091
1168
  return crypto.axolotl(payload, hexKey, ed25519);
1092
1169
  }
@@ -1155,14 +1232,28 @@ class Exchange {
1155
1232
  }
1156
1233
  return undefined;
1157
1234
  }
1158
- checkProxySettings(url, method, headers, body) {
1159
- let proxyUrl = (this.proxyUrl !== undefined) ? this.proxyUrl : this.proxy_url;
1160
- const proxyUrlCallback = (this.proxyUrlCallback !== undefined) ? this.proxyUrlCallback : this.proxy_url_callback;
1161
- if (proxyUrlCallback !== undefined) {
1162
- proxyUrl = proxyUrlCallback(url, method, headers, body);
1235
+ checkProxyUrlSettings(url = undefined, method = undefined, headers = undefined, body = undefined) {
1236
+ const usedProxies = [];
1237
+ let proxyUrl = undefined;
1238
+ if (this.proxyUrl !== undefined) {
1239
+ usedProxies.push('proxyUrl');
1240
+ proxyUrl = this.proxyUrl;
1241
+ }
1242
+ if (this.proxy_url !== undefined) {
1243
+ usedProxies.push('proxy_url');
1244
+ proxyUrl = this.proxy_url;
1245
+ }
1246
+ if (this.proxyUrlCallback !== undefined) {
1247
+ usedProxies.push('proxyUrlCallback');
1248
+ proxyUrl = this.proxyUrlCallback(url, method, headers, body);
1249
+ }
1250
+ if (this.proxy_url_callback !== undefined) {
1251
+ usedProxies.push('proxy_url_callback');
1252
+ proxyUrl = this.proxy_url_callback(url, method, headers, body);
1163
1253
  }
1164
1254
  // backwards-compatibility
1165
1255
  if (this.proxy !== undefined) {
1256
+ usedProxies.push('proxy');
1166
1257
  if (typeof this.proxy === 'function') {
1167
1258
  proxyUrl = this.proxy(url, method, headers, body);
1168
1259
  }
@@ -1170,50 +1261,111 @@ class Exchange {
1170
1261
  proxyUrl = this.proxy;
1171
1262
  }
1172
1263
  }
1173
- let httpProxy = (this.httpProxy !== undefined) ? this.httpProxy : this.http_proxy;
1174
- const httpProxyCallback = (this.httpProxyCallback !== undefined) ? this.httpProxyCallback : this.http_proxy_callback;
1175
- if (httpProxyCallback !== undefined) {
1176
- httpProxy = httpProxyCallback(url, method, headers, body);
1177
- }
1178
- let httpsProxy = (this.httpsProxy !== undefined) ? this.httpsProxy : this.https_proxy;
1179
- const httpsProxyCallback = (this.httpsProxyCallback !== undefined) ? this.httpsProxyCallback : this.https_proxy_callback;
1180
- if (httpsProxyCallback !== undefined) {
1181
- httpsProxy = httpsProxyCallback(url, method, headers, body);
1182
- }
1183
- let socksProxy = (this.socksProxy !== undefined) ? this.socksProxy : this.socks_proxy;
1184
- const socksProxyCallback = (this.socksProxyCallback !== undefined) ? this.socksProxyCallback : this.socks_proxy_callback;
1185
- if (socksProxyCallback !== undefined) {
1186
- socksProxy = socksProxyCallback(url, method, headers, body);
1187
- }
1188
- let val = 0;
1189
- if (proxyUrl !== undefined) {
1190
- val = val + 1;
1191
- }
1192
- if (proxyUrlCallback !== undefined) {
1193
- val = val + 1;
1194
- }
1195
- if (httpProxy !== undefined) {
1196
- val = val + 1;
1197
- }
1198
- if (httpProxyCallback !== undefined) {
1199
- val = val + 1;
1200
- }
1201
- if (httpsProxy !== undefined) {
1202
- val = val + 1;
1203
- }
1204
- if (httpsProxyCallback !== undefined) {
1205
- val = val + 1;
1206
- }
1207
- if (socksProxy !== undefined) {
1208
- val = val + 1;
1209
- }
1210
- if (socksProxyCallback !== undefined) {
1211
- val = val + 1;
1212
- }
1213
- if (val > 1) {
1214
- throw new errors.ExchangeError(this.id + ' you have multiple conflicting proxy settings, please use only one from : proxyUrl, httpProxy, httpsProxy, socksProxy, userAgent');
1264
+ const length = usedProxies.length;
1265
+ if (length > 1) {
1266
+ const joinedProxyNames = usedProxies.join(',');
1267
+ throw new errors.ExchangeError(this.id + ' you have multiple conflicting proxy_url settings (' + joinedProxyNames + '), please use only one from : proxyUrl, proxy_url, proxyUrlCallback, proxy_url_callback');
1268
+ }
1269
+ return proxyUrl;
1270
+ }
1271
+ checkProxySettings(url = undefined, method = undefined, headers = undefined, body = undefined) {
1272
+ const usedProxies = [];
1273
+ let httpProxy = undefined;
1274
+ let httpsProxy = undefined;
1275
+ let socksProxy = undefined;
1276
+ // httpProxy
1277
+ if (this.httpProxy !== undefined) {
1278
+ usedProxies.push('httpProxy');
1279
+ httpProxy = this.httpProxy;
1280
+ }
1281
+ if (this.http_proxy !== undefined) {
1282
+ usedProxies.push('http_proxy');
1283
+ httpProxy = this.http_proxy;
1284
+ }
1285
+ if (this.httpProxyCallback !== undefined) {
1286
+ usedProxies.push('httpProxyCallback');
1287
+ httpProxy = this.httpProxyCallback(url, method, headers, body);
1288
+ }
1289
+ if (this.http_proxy_callback !== undefined) {
1290
+ usedProxies.push('http_proxy_callback');
1291
+ httpProxy = this.http_proxy_callback(url, method, headers, body);
1292
+ }
1293
+ // httpsProxy
1294
+ if (this.httpsProxy !== undefined) {
1295
+ usedProxies.push('httpsProxy');
1296
+ httpsProxy = this.httpsProxy;
1297
+ }
1298
+ if (this.https_proxy !== undefined) {
1299
+ usedProxies.push('https_proxy');
1300
+ httpsProxy = this.https_proxy;
1301
+ }
1302
+ if (this.httpsProxyCallback !== undefined) {
1303
+ usedProxies.push('httpsProxyCallback');
1304
+ httpsProxy = this.httpsProxyCallback(url, method, headers, body);
1305
+ }
1306
+ if (this.https_proxy_callback !== undefined) {
1307
+ usedProxies.push('https_proxy_callback');
1308
+ httpsProxy = this.https_proxy_callback(url, method, headers, body);
1309
+ }
1310
+ // socksProxy
1311
+ if (this.socksProxy !== undefined) {
1312
+ usedProxies.push('socksProxy');
1313
+ socksProxy = this.socksProxy;
1314
+ }
1315
+ if (this.socks_proxy !== undefined) {
1316
+ usedProxies.push('socks_proxy');
1317
+ socksProxy = this.socks_proxy;
1318
+ }
1319
+ if (this.socksProxyCallback !== undefined) {
1320
+ usedProxies.push('socksProxyCallback');
1321
+ socksProxy = this.socksProxyCallback(url, method, headers, body);
1322
+ }
1323
+ if (this.socks_proxy_callback !== undefined) {
1324
+ usedProxies.push('socks_proxy_callback');
1325
+ socksProxy = this.socks_proxy_callback(url, method, headers, body);
1326
+ }
1327
+ // check
1328
+ const length = usedProxies.length;
1329
+ if (length > 1) {
1330
+ const joinedProxyNames = usedProxies.join(',');
1331
+ throw new errors.ExchangeError(this.id + ' you have multiple conflicting settings (' + joinedProxyNames + '), please use only one from: httpProxy, httpsProxy, httpProxyCallback, httpsProxyCallback, socksProxy, socksProxyCallback');
1332
+ }
1333
+ return [httpProxy, httpsProxy, socksProxy];
1334
+ }
1335
+ checkWsProxySettings() {
1336
+ const usedProxies = [];
1337
+ let wsProxy = undefined;
1338
+ let wssProxy = undefined;
1339
+ // wsProxy
1340
+ if (this.wsProxy !== undefined) {
1341
+ usedProxies.push('wsProxy');
1342
+ wsProxy = this.wsProxy;
1343
+ }
1344
+ if (this.ws_proxy !== undefined) {
1345
+ usedProxies.push('ws_proxy');
1346
+ wsProxy = this.ws_proxy;
1347
+ }
1348
+ // wsProxy
1349
+ if (this.wssProxy !== undefined) {
1350
+ usedProxies.push('wssProxy');
1351
+ wssProxy = this.wssProxy;
1352
+ }
1353
+ if (this.wss_proxy !== undefined) {
1354
+ usedProxies.push('wss_proxy');
1355
+ wssProxy = this.wss_proxy;
1356
+ }
1357
+ // check
1358
+ const length = usedProxies.length;
1359
+ if (length > 1) {
1360
+ const joinedProxyNames = usedProxies.join(',');
1361
+ throw new errors.ExchangeError(this.id + ' you have multiple conflicting settings (' + joinedProxyNames + '), please use only one from: wsProxy, wssProxy');
1362
+ }
1363
+ return [wsProxy, wssProxy];
1364
+ }
1365
+ checkConflictingProxies(proxyAgentSet, proxyUrlSet) {
1366
+ if (proxyAgentSet && proxyUrlSet) {
1367
+ throw new errors.ExchangeError(this.id + ' you have multiple conflicting proxy settings, please use only one from : proxyUrl, httpProxy, httpsProxy, socksProxy');
1215
1368
  }
1216
- return [proxyUrl, httpProxy, httpsProxy, socksProxy];
1217
1369
  }
1218
1370
  findMessageHashes(client, element) {
1219
1371
  const result = [];
@@ -942,6 +942,13 @@ class gate extends gate$1 {
942
942
  }
943
943
  else if (symbol in this.markets_by_id) {
944
944
  const markets = this.markets_by_id[symbol];
945
+ const defaultType = this.safeString2(this.options, 'defaultType', 'defaultSubType', 'spot');
946
+ for (let i = 0; i < markets.length; i++) {
947
+ const market = markets[i];
948
+ if (market[defaultType]) {
949
+ return market;
950
+ }
951
+ }
945
952
  return markets[0];
946
953
  }
947
954
  else if ((symbol.indexOf('-C') > -1) || (symbol.indexOf('-P') > -1)) {
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
7
- declare const version = "4.1.64";
7
+ declare const version = "4.1.65";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.1.65';
41
+ const version = '4.1.66';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -37,10 +37,17 @@ export default class Exchange {
37
37
  user_agent: {
38
38
  'User-Agent': string;
39
39
  } | false;
40
+ wsProxy: string;
41
+ ws_proxy: string;
42
+ wssProxy: string;
43
+ wss_proxy: string;
40
44
  userAgents: any;
41
45
  headers: any;
42
46
  origin: string;
43
47
  agent: any;
48
+ nodeHttpModuleLoaded: boolean;
49
+ httpAgent: any;
50
+ httpsAgent: any;
44
51
  minFundingAddressLength: number;
45
52
  substituteCommonCurrencyCodes: boolean;
46
53
  quoteJsonNumbers: boolean;
@@ -493,6 +500,14 @@ export default class Exchange {
493
500
  defineRestApiEndpoint(methodName: any, uppercaseMethod: any, lowercaseMethod: any, camelcaseMethod: any, path: any, paths: any, config?: {}): void;
494
501
  defineRestApi(api: any, methodName: any, paths?: any[]): void;
495
502
  log(...args: any[]): void;
503
+ httpProxyAgentModule: any;
504
+ httpsProxyAgentModule: any;
505
+ socksProxyAgentModule: any;
506
+ socksProxyAgentModuleChecked: boolean;
507
+ proxyDictionaries: any;
508
+ proxyModulesLoaded: boolean;
509
+ loadProxyModules(): Promise<void>;
510
+ setProxyAgents(httpProxy: any, httpsProxy: any, socksProxy: any): any;
496
511
  fetch(url: any, method?: string, headers?: any, body?: any): Promise<any>;
497
512
  parseJson(jsonString: any): any;
498
513
  getResponseHeaders(response: any): {};
@@ -526,12 +541,16 @@ export default class Exchange {
526
541
  valueIsDefined(value: any): boolean;
527
542
  arraySlice(array: any, first: any, second?: any): any;
528
543
  getProperty(obj: any, property: any, defaultValue?: any): any;
544
+ setProperty(obj: any, property: any, defaultValue?: any): void;
529
545
  axolotl(payload: any, hexKey: any, ed25519: any): string;
530
546
  handleDeltas(orderbook: any, deltas: any): void;
531
547
  handleDelta(bookside: any, delta: any): void;
532
548
  getCacheIndex(orderbook: any, deltas: any): number;
533
549
  findTimeframe(timeframe: any, timeframes?: any): string;
534
- checkProxySettings(url: any, method: any, headers: any, body: any): string[];
550
+ checkProxyUrlSettings(url?: any, method?: any, headers?: any, body?: any): any;
551
+ checkProxySettings(url?: any, method?: any, headers?: any, body?: any): any[];
552
+ checkWsProxySettings(): any[];
553
+ checkConflictingProxies(proxyAgentSet: any, proxyUrlSet: any): void;
535
554
  findMessageHashes(client: any, element: string): string[];
536
555
  filterByLimit(array: object[], limit?: Int, key?: IndexType): any;
537
556
  filterBySinceLimit(array: object[], since?: Int, limit?: Int, key?: IndexType, tail?: boolean): any;