ccxt 4.4.75 → 4.4.78

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 (114) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +7 -7
  3. package/dist/cjs/ccxt.js +8 -4
  4. package/dist/cjs/src/abstract/apex.js +9 -0
  5. package/dist/cjs/src/apex.js +1949 -0
  6. package/dist/cjs/src/base/Exchange.js +49 -3
  7. package/dist/cjs/src/binance.js +44 -220
  8. package/dist/cjs/src/bitget.js +139 -71
  9. package/dist/cjs/src/bitmex.js +4 -4
  10. package/dist/cjs/src/bitrue.js +48 -0
  11. package/dist/cjs/src/cex.js +1 -1
  12. package/dist/cjs/src/coinbase.js +32 -3
  13. package/dist/cjs/src/coincatch.js +68 -0
  14. package/dist/cjs/src/coinex.js +3 -0
  15. package/dist/cjs/src/coinlist.js +85 -1
  16. package/dist/cjs/src/hitbtc.js +3 -0
  17. package/dist/cjs/src/hyperliquid.js +13 -4
  18. package/dist/cjs/src/mexc.js +50 -57
  19. package/dist/cjs/src/okx.js +23 -8
  20. package/dist/cjs/src/paradex.js +3 -12
  21. package/dist/cjs/src/phemex.js +2 -1
  22. package/dist/cjs/src/poloniex.js +1 -1
  23. package/dist/cjs/src/pro/apex.js +1043 -0
  24. package/dist/cjs/src/pro/coinbase.js +4 -8
  25. package/dist/cjs/src/pro/gate.js +27 -2
  26. package/dist/cjs/src/pro/hollaex.js +2 -2
  27. package/dist/cjs/src/pro/hyperliquid.js +1 -1
  28. package/dist/cjs/src/pro/p2b.js +2 -2
  29. package/dist/cjs/src/pro/tradeogre.js +283 -0
  30. package/dist/cjs/src/probit.js +1 -0
  31. package/dist/cjs/src/static_dependencies/zklink/zklink-sdk-web.js +2645 -0
  32. package/dist/cjs/src/tradeogre.js +2 -1
  33. package/dist/cjs/src/upbit.js +299 -93
  34. package/dist/cjs/src/whitebit.js +1 -0
  35. package/dist/cjs/src/woo.js +3 -1
  36. package/dist/cjs/src/xt.js +131 -4
  37. package/js/ccxt.d.ts +11 -5
  38. package/js/ccxt.js +8 -4
  39. package/js/src/abstract/apex.d.ts +34 -0
  40. package/js/src/abstract/myokx.d.ts +4 -0
  41. package/js/src/abstract/okx.d.ts +4 -0
  42. package/js/src/abstract/upbit.d.ts +15 -1
  43. package/js/src/abstract/xt.d.ts +3 -0
  44. package/js/src/apex.d.ts +333 -0
  45. package/js/src/apex.js +1951 -0
  46. package/js/src/ascendex.d.ts +3 -3
  47. package/js/src/base/Exchange.d.ts +3 -0
  48. package/js/src/base/Exchange.js +49 -2
  49. package/js/src/binance.d.ts +9 -7
  50. package/js/src/binance.js +44 -220
  51. package/js/src/bitfinex.d.ts +3 -3
  52. package/js/src/bitflyer.d.ts +2 -2
  53. package/js/src/bitget.d.ts +2 -0
  54. package/js/src/bitget.js +139 -71
  55. package/js/src/bitmart.d.ts +4 -4
  56. package/js/src/bitmex.d.ts +3 -3
  57. package/js/src/bitmex.js +4 -4
  58. package/js/src/bitrue.js +48 -0
  59. package/js/src/cex.js +1 -1
  60. package/js/src/coinbase.d.ts +6 -4
  61. package/js/src/coinbase.js +32 -3
  62. package/js/src/coinbaseexchange.d.ts +1 -1
  63. package/js/src/coincatch.d.ts +11 -0
  64. package/js/src/coincatch.js +68 -0
  65. package/js/src/coinex.js +3 -0
  66. package/js/src/coinlist.d.ts +12 -1
  67. package/js/src/coinlist.js +85 -1
  68. package/js/src/cryptocom.d.ts +4 -4
  69. package/js/src/deribit.d.ts +4 -4
  70. package/js/src/derive.d.ts +3 -3
  71. package/js/src/digifinex.d.ts +4 -4
  72. package/js/src/hitbtc.js +3 -0
  73. package/js/src/htx.d.ts +4 -4
  74. package/js/src/hyperliquid.d.ts +1 -0
  75. package/js/src/hyperliquid.js +13 -4
  76. package/js/src/kraken.d.ts +3 -3
  77. package/js/src/krakenfutures.d.ts +2 -2
  78. package/js/src/kucoinfutures.d.ts +5 -5
  79. package/js/src/mexc.d.ts +1 -0
  80. package/js/src/mexc.js +50 -57
  81. package/js/src/okx.js +23 -8
  82. package/js/src/oxfun.d.ts +3 -3
  83. package/js/src/paradex.js +3 -12
  84. package/js/src/phemex.d.ts +3 -3
  85. package/js/src/phemex.js +2 -1
  86. package/js/src/poloniex.d.ts +3 -3
  87. package/js/src/poloniex.js +1 -1
  88. package/js/src/pro/apex.d.ts +160 -0
  89. package/js/src/pro/apex.js +1044 -0
  90. package/js/src/pro/coinbase.js +4 -8
  91. package/js/src/pro/gate.js +27 -2
  92. package/js/src/pro/hollaex.js +2 -2
  93. package/js/src/pro/hyperliquid.js +1 -1
  94. package/js/src/pro/p2b.js +2 -2
  95. package/js/src/pro/tradeogre.d.ts +49 -0
  96. package/js/src/pro/tradeogre.js +284 -0
  97. package/js/src/probit.js +1 -0
  98. package/js/src/static_dependencies/zklink/zklink-sdk-web.d.ts +1279 -0
  99. package/js/src/static_dependencies/zklink/zklink-sdk-web.js +4282 -0
  100. package/js/src/tradeogre.js +2 -1
  101. package/js/src/upbit.d.ts +34 -4
  102. package/js/src/upbit.js +299 -93
  103. package/js/src/vertex.d.ts +3 -3
  104. package/js/src/whitebit.js +1 -0
  105. package/js/src/woo.d.ts +4 -4
  106. package/js/src/woo.js +3 -1
  107. package/js/src/woofipro.d.ts +4 -4
  108. package/js/src/xt.d.ts +23 -4
  109. package/js/src/xt.js +131 -4
  110. package/package.json +2 -2
  111. package/js/src/abstract/ace.d.ts +0 -18
  112. package/js/src/ace.d.ts +0 -158
  113. package/js/src/ace.js +0 -1181
  114. /package/js/src/abstract/{ace.js → apex.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/ascendex.js';
2
- import type { TransferEntry, FundingHistory, Int, OHLCV, Order, OrderSide, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Strings, Num, Currency, Market, Leverage, Leverages, Account, MarginModes, MarginMode, MarginModification, Currencies, TradingFees, Dict, LeverageTier, LeverageTiers, int, FundingRate, FundingRates, DepositAddress } from './base/types.js';
2
+ import type { TransferEntry, FundingHistory, Int, OHLCV, Order, OrderSide, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Strings, Num, Currency, Market, Leverage, Leverages, Account, MarginModes, MarginMode, MarginModification, Currencies, TradingFees, Dict, LeverageTier, LeverageTiers, int, FundingRate, FundingRates, DepositAddress, Position } from './base/types.js';
3
3
  /**
4
4
  * @class ascendex
5
5
  * @augments Exchange
@@ -277,8 +277,8 @@ export default class ascendex extends Exchange {
277
277
  * @param {object} [params] extra parameters specific to the exchange API endpoint
278
278
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
279
279
  */
280
- fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
281
- parsePosition(position: Dict, market?: Market): import("./base/types.js").Position;
280
+ fetchPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
281
+ parsePosition(position: Dict, market?: Market): Position;
282
282
  parseFundingRate(contract: any, market?: Market): FundingRate;
283
283
  /**
284
284
  * @method
@@ -377,6 +377,8 @@ export default class Exchange {
377
377
  };
378
378
  starknetEncodeStructuredData(domain: any, messageTypes: any, messageData: any, address: any): string;
379
379
  starknetSign(hash: any, pri: any): string;
380
+ getZKContractSignatureObj(seed: any, params?: {}): Promise<any>;
381
+ getZKTransferSignatureObj(seed: any, params?: {}): Promise<any>;
380
382
  intToBase16(elem: any): string;
381
383
  extendExchangeOptions(newOptions: Dict): void;
382
384
  createSafeDictionary(): {};
@@ -400,6 +402,7 @@ export default class Exchange {
400
402
  getCacheIndex(orderbook: any, deltas: any): number;
401
403
  findTimeframe(timeframe: any, timeframes?: any): string;
402
404
  checkProxyUrlSettings(url?: Str, method?: Str, headers?: any, body?: any): any;
405
+ urlEncoderForProxyUrl(targetUrl: string): string;
403
406
  checkProxySettings(url?: Str, method?: Str, headers?: any, body?: any): any[];
404
407
  checkWsProxySettings(): any[];
405
408
  checkConflictingProxies(proxyAgentSet: any, proxyUrlSet: any): void;
@@ -25,7 +25,9 @@ import ethers from '../static_dependencies/ethers/index.js';
25
25
  import { TypedDataEncoder } from '../static_dependencies/ethers/hash/index.js';
26
26
  import { SecureRandom } from "../static_dependencies/jsencrypt/lib/jsbn/rng.js";
27
27
  import { getStarkKey, ethSigToPrivate, sign as starknetCurveSign } from '../static_dependencies/scure-starknet/index.js';
28
+ import init, * as zklink from '../static_dependencies/zklink/zklink-sdk-web.js';
28
29
  import * as Starknet from '../static_dependencies/starknet/index.js';
30
+ import { sha256 } from '../static_dependencies/noble-hashes/sha256.js';
29
31
  // ----------------------------------------------------------------------------
30
32
  /**
31
33
  * @class Exchange
@@ -553,7 +555,7 @@ export default class Exchange {
553
555
  httpProxyAgent = this.httpAgent;
554
556
  }
555
557
  }
556
- url = proxyUrl + url;
558
+ url = proxyUrl + this.urlEncoderForProxyUrl(url);
557
559
  }
558
560
  // proxy agents
559
561
  const [httpProxy, httpsProxy, socksProxy] = this.checkProxySettings(url, method, headers, body);
@@ -1200,6 +1202,45 @@ export default class Exchange {
1200
1202
  const signature = starknetCurveSign(hash.replace('0x', ''), pri.slice(-64));
1201
1203
  return this.json([signature.r.toString(), signature.s.toString()]);
1202
1204
  }
1205
+ async getZKContractSignatureObj(seed, params = {}) {
1206
+ const formattedSlotId = BigInt('0x' + this.remove0xPrefix(this.hash(this.encode(this.safeString(params, 'slotId')), sha256, 'hex'))).toString();
1207
+ const formattedNonce = BigInt('0x' + this.remove0xPrefix(this.hash(this.encode(this.safeString(params, 'nonce')), sha256, 'hex'))).toString();
1208
+ const formattedUint64 = '18446744073709551615';
1209
+ const formattedUint32 = '4294967295';
1210
+ const accountId = parseInt(Precise.stringMod(this.safeString(params, 'accountId'), formattedUint32), 10);
1211
+ const slotId = parseInt(Precise.stringDiv(Precise.stringMod(formattedSlotId, formattedUint64), formattedUint32), 10);
1212
+ const nonce = parseInt(Precise.stringMod(formattedNonce, formattedUint32), 10);
1213
+ await init();
1214
+ const _signer = zklink.newRpcSignerWithProvider({});
1215
+ await _signer.initZklinkSigner(seed);
1216
+ let tx_builder = new zklink.ContractBuilder(accountId, 0, slotId, nonce, this.safeInteger(params, 'pairId'), Precise.stringMul(this.safeString(params, 'size'), '1e18'), Precise.stringMul(this.safeString(params, 'price'), '1e18'), this.safeString(params, 'direction') === 'BUY', parseInt(Precise.stringMul(this.safeString(params, 'makerFeeRate'), '10000')), parseInt(Precise.stringMul(this.safeString(params, 'takerFeeRate'), '10000')), false);
1217
+ let contractor = zklink.newContract(tx_builder);
1218
+ //const signer = ZkLinkSigner.ethSig(seed);
1219
+ //const signer = new Signer(seed);
1220
+ contractor?.sign(_signer?.getZkLinkSigner());
1221
+ const tx = contractor.jsValue();
1222
+ const zkSign = tx?.signature?.signature;
1223
+ return zkSign;
1224
+ }
1225
+ async getZKTransferSignatureObj(seed, params = {}) {
1226
+ await init();
1227
+ const _signer = zklink.newRpcSignerWithProvider({});
1228
+ await _signer.initZklinkSigner(seed);
1229
+ let nonce = this.safeString(params, 'nonce', '0');
1230
+ if (this.safeBool(params, 'isContract') === true) {
1231
+ const formattedUint32 = '4294967295';
1232
+ const formattedNonce = BigInt('0x' + this.remove0xPrefix(this.hash(this.encode(nonce), sha256, 'hex'))).toString();
1233
+ nonce = Precise.stringMod(formattedNonce, formattedUint32);
1234
+ }
1235
+ let tx_builder = new zklink.TransferBuilder(this.safeNumber(params, 'zkAccountId', 0), this.safeString(params, 'receiverAddress'), this.safeNumber(params, 'subAccountId', 0), this.safeNumber(params, 'receiverSubAccountId', 0), this.safeNumber(params, 'tokenId', 0), this.safeString(params, 'fee', '0'), this.safeString(params, 'amount', '0'), this.parseToInt(nonce), this.safeNumber(params, 'timestampSeconds', 0));
1236
+ let contractor = zklink.newTransfer(tx_builder);
1237
+ //const signer = ZkLinkSigner.ethSig(seed);
1238
+ //const signer = new Signer(seed);
1239
+ contractor?.sign(_signer?.getZkLinkSigner());
1240
+ const tx = contractor.jsValue();
1241
+ const zkSign = tx?.signature?.signature;
1242
+ return zkSign;
1243
+ }
1203
1244
  intToBase16(elem) {
1204
1245
  return elem.toString(16);
1205
1246
  }
@@ -1757,6 +1798,12 @@ export default class Exchange {
1757
1798
  }
1758
1799
  return proxyUrl;
1759
1800
  }
1801
+ urlEncoderForProxyUrl(targetUrl) {
1802
+ // to be overriden
1803
+ const includesQuery = targetUrl.indexOf('?') >= 0;
1804
+ const finalUrl = includesQuery ? this.encodeURIComponent(targetUrl) : targetUrl;
1805
+ return finalUrl;
1806
+ }
1760
1807
  checkProxySettings(url = undefined, method = undefined, headers = undefined, body = undefined) {
1761
1808
  const usedProxies = [];
1762
1809
  let httpProxy = undefined;
@@ -2546,7 +2593,7 @@ export default class Exchange {
2546
2593
  // find lowest precision (which is more desired)
2547
2594
  const precision = this.safeString(network, 'precision');
2548
2595
  const precisionMain = this.safeString(currency, 'precision');
2549
- if (precisionMain === undefined || Precise.stringLt(precision, precisionMain)) {
2596
+ if (precisionMain === undefined || Precise.stringGt(precision, precisionMain)) {
2550
2597
  currency['precision'] = this.parseNumber(precision);
2551
2598
  }
2552
2599
  // limits
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/binance.js';
2
- import type { TransferEntry, Int, OrderSide, Balances, OrderType, Trade, OHLCV, Order, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, Str, Transaction, Ticker, OrderBook, Tickers, Market, Greeks, Strings, Currency, MarketInterface, MarginMode, MarginModes, Leverage, Leverages, Num, Option, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion, CrossBorrowRate, IsolatedBorrowRates, IsolatedBorrowRate, Dict, LeverageTier, LeverageTiers, int, LedgerEntry, FundingRate, FundingRates, DepositAddress, LongShortRatio, BorrowInterest } from './base/types.js';
2
+ import type { TransferEntry, Int, OrderSide, Balances, OrderType, Trade, OHLCV, Order, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, Str, Transaction, Ticker, OrderBook, Tickers, Market, Greeks, Strings, Currency, MarketInterface, MarginMode, MarginModes, Leverage, Leverages, Num, Option, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion, CrossBorrowRate, IsolatedBorrowRates, IsolatedBorrowRate, Dict, LeverageTier, LeverageTiers, int, LedgerEntry, FundingRate, FundingRates, DepositAddress, LongShortRatio, BorrowInterest, Position } from './base/types.js';
3
3
  /**
4
4
  * @class binance
5
5
  * @augments Exchange
@@ -985,7 +985,7 @@ export default class binance extends Exchange {
985
985
  * @param {object} [params] extra parameters specific to the exchange API endpoint
986
986
  * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
987
987
  */
988
- fetchPosition(symbol: string, params?: {}): Promise<import("./base/types.js").Position>;
988
+ fetchPosition(symbol: string, params?: {}): Promise<Position>;
989
989
  /**
990
990
  * @method
991
991
  * @name binance#fetchOptionPositions
@@ -995,8 +995,8 @@ export default class binance extends Exchange {
995
995
  * @param {object} [params] extra parameters specific to the exchange API endpoint
996
996
  * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
997
997
  */
998
- fetchOptionPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
999
- parsePosition(position: Dict, market?: Market): import("./base/types.js").Position;
998
+ fetchOptionPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
999
+ parsePosition(position: Dict, market?: Market): Position;
1000
1000
  /**
1001
1001
  * @method
1002
1002
  * @name binance#fetchPositions
@@ -1013,7 +1013,7 @@ export default class binance extends Exchange {
1013
1013
  * @param {bool} [params.useV2] set to true if you want to use the obsolete endpoint, where some more additional fields were provided
1014
1014
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
1015
1015
  */
1016
- fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
1016
+ fetchPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
1017
1017
  /**
1018
1018
  * @method
1019
1019
  * @name binance#fetchAccountPositions
@@ -1032,7 +1032,7 @@ export default class binance extends Exchange {
1032
1032
  * @param {boolean} [params.useV2] set to true if you want to use obsolete endpoint, where some more additional fields were provided
1033
1033
  * @returns {object} data on account positions
1034
1034
  */
1035
- fetchAccountPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
1035
+ fetchAccountPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
1036
1036
  /**
1037
1037
  * @method
1038
1038
  * @name binance#fetchPositionsRisk
@@ -1050,7 +1050,7 @@ export default class binance extends Exchange {
1050
1050
  * @param {bool} [params.useV2] set to true if you want to use the obsolete endpoint, where some more additional fields were provided
1051
1051
  * @returns {object} data on the positions risk
1052
1052
  */
1053
- fetchPositionsRisk(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
1053
+ fetchPositionsRisk(symbols?: Strings, params?: {}): Promise<Position[]>;
1054
1054
  /**
1055
1055
  * @method
1056
1056
  * @name binance#fetchFundingHistory
@@ -1193,6 +1193,8 @@ export default class binance extends Exchange {
1193
1193
  fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
1194
1194
  parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
1195
1195
  parseLedgerEntryType(type: any): string;
1196
+ getNetworkCodeByNetworkUrl(currencyCode: string, depositUrl?: Str): Str;
1197
+ getBaseDomainFromUrl(url: Str): Str;
1196
1198
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
1197
1199
  url: any;
1198
1200
  method: string;
package/js/src/binance.js CHANGED
@@ -23,7 +23,7 @@ export default class binance extends Exchange {
23
23
  return this.deepExtend(super.describe(), {
24
24
  'id': 'binance',
25
25
  'name': 'Binance',
26
- 'countries': ['JP', 'MT'],
26
+ 'countries': [],
27
27
  'rateLimit': 50,
28
28
  'certified': true,
29
29
  'pro': true,
@@ -1336,195 +1336,8 @@ export default class binance extends Exchange {
1336
1336
  'SPL': 'SOL',
1337
1337
  'SOL': 'SOL', // we shouldn't rename SOL
1338
1338
  },
1339
- // keeping this object for backward-compatibility
1340
- 'reverseNetworks': {
1341
- 'tronscan.org': 'TRC20',
1342
- 'etherscan.io': 'ERC20',
1343
- 'bscscan.com': 'BSC',
1344
- 'explorer.binance.org': 'BEP2',
1345
- 'bithomp.com': 'XRP',
1346
- 'bloks.io': 'EOS',
1347
- 'stellar.expert': 'XLM',
1348
- 'blockchair.com/bitcoin': 'BTC',
1349
- 'blockchair.com/bitcoin-cash': 'BCH',
1350
- 'blockchair.com/ecash': 'XEC',
1351
- 'explorer.litecoin.net': 'LTC',
1352
- 'explorer.avax.network': 'AVAX',
1353
- 'solscan.io': 'SOL',
1354
- 'polkadot.subscan.io': 'DOT',
1355
- 'dashboard.internetcomputer.org': 'ICP',
1356
- 'explorer.chiliz.com': 'CHZ',
1357
- 'cardanoscan.io': 'ADA',
1358
- 'mainnet.theoan.com': 'AION',
1359
- 'algoexplorer.io': 'ALGO',
1360
- 'explorer.ambrosus.com': 'AMB',
1361
- 'viewblock.io/zilliqa': 'ZIL',
1362
- 'viewblock.io/arweave': 'AR',
1363
- 'explorer.ark.io': 'ARK',
1364
- 'atomscan.com': 'ATOM',
1365
- 'www.mintscan.io': 'CTK',
1366
- 'explorer.bitcoindiamond.org': 'BCD',
1367
- 'btgexplorer.com': 'BTG',
1368
- 'bts.ai': 'BTS',
1369
- 'explorer.celo.org': 'CELO',
1370
- 'explorer.nervos.org': 'CKB',
1371
- 'cerebro.cortexlabs.ai': 'CTXC',
1372
- 'chainz.cryptoid.info': 'VIA',
1373
- 'explorer.dcrdata.org': 'DCR',
1374
- 'digiexplorer.info': 'DGB',
1375
- 'dock.subscan.io': 'DOCK',
1376
- 'dogechain.info': 'DOGE',
1377
- 'explorer.elrond.com': 'EGLD',
1378
- 'blockscout.com': 'ETC',
1379
- 'explore-fetchhub.fetch.ai': 'FET',
1380
- 'filfox.info': 'FIL',
1381
- 'fio.bloks.io': 'FIO',
1382
- 'explorer.firo.org': 'FIRO',
1383
- 'neoscan.io': 'NEO',
1384
- 'ftmscan.com': 'FTM',
1385
- 'explorer.gochain.io': 'GO',
1386
- 'block.gxb.io': 'GXS',
1387
- 'hash-hash.info': 'HBAR',
1388
- 'www.hiveblockexplorer.com': 'HIVE',
1389
- 'explorer.helium.com': 'HNT',
1390
- 'tracker.icon.foundation': 'ICX',
1391
- 'www.iostabc.com': 'IOST',
1392
- 'explorer.iota.org': 'IOTA',
1393
- 'iotexscan.io': 'IOTX',
1394
- 'irishub.iobscan.io': 'IRIS',
1395
- 'kava.mintscan.io': 'KAVA',
1396
- 'scope.klaytn.com': 'KLAY',
1397
- 'kmdexplorer.io': 'KMD',
1398
- 'kusama.subscan.io': 'KSM',
1399
- 'explorer.lto.network': 'LTO',
1400
- 'polygonscan.com': 'POLYGON',
1401
- 'explorer.ont.io': 'ONT',
1402
- 'minaexplorer.com': 'MINA',
1403
- 'nanolooker.com': 'NANO',
1404
- 'explorer.nebulas.io': 'NAS',
1405
- 'explorer.nbs.plus': 'NBS',
1406
- 'explorer.nebl.io': 'NEBL',
1407
- 'nulscan.io': 'NULS',
1408
- 'nxscan.com': 'NXS',
1409
- 'explorer.harmony.one': 'ONE',
1410
- 'explorer.poa.network': 'POA',
1411
- 'qtum.info': 'QTUM',
1412
- 'explorer.rsk.co': 'RSK',
1413
- 'www.oasisscan.com': 'ROSE',
1414
- 'ravencoin.network': 'RVN',
1415
- 'sc.tokenview.com': 'SC',
1416
- 'secretnodes.com': 'SCRT',
1417
- 'explorer.skycoin.com': 'SKY',
1418
- 'steemscan.com': 'STEEM',
1419
- 'explorer.stacks.co': 'STX',
1420
- 'www.thetascan.io': 'THETA',
1421
- 'scan.tomochain.com': 'TOMO',
1422
- 'explore.vechain.org': 'VET',
1423
- 'explorer.vite.net': 'VITE',
1424
- 'www.wanscan.org': 'WAN',
1425
- 'wavesexplorer.com': 'WAVES',
1426
- 'wax.eosx.io': 'WAXP',
1427
- 'waltonchain.pro': 'WTC',
1428
- 'chain.nem.ninja': 'XEM',
1429
- 'verge-blockchain.info': 'XVG',
1430
- 'explorer.yoyow.org': 'YOYOW',
1431
- 'explorer.zcha.in': 'ZEC',
1432
- 'explorer.zensystem.io': 'ZEN',
1433
- },
1434
1339
  'networksById': {
1435
- 'SOL': 'SOL',
1436
- 'tronscan.org': 'TRC20',
1437
- 'etherscan.io': 'ERC20',
1438
- 'bscscan.com': 'BSC',
1439
- 'explorer.binance.org': 'BEP2',
1440
- 'bithomp.com': 'XRP',
1441
- 'bloks.io': 'EOS',
1442
- 'stellar.expert': 'XLM',
1443
- 'blockchair.com/bitcoin': 'BTC',
1444
- 'blockchair.com/bitcoin-cash': 'BCH',
1445
- 'blockchair.com/ecash': 'XEC',
1446
- 'explorer.litecoin.net': 'LTC',
1447
- 'explorer.avax.network': 'AVAX',
1448
- 'solscan.io': 'SOL',
1449
- 'polkadot.subscan.io': 'DOT',
1450
- 'dashboard.internetcomputer.org': 'ICP',
1451
- 'explorer.chiliz.com': 'CHZ',
1452
- 'cardanoscan.io': 'ADA',
1453
- 'mainnet.theoan.com': 'AION',
1454
- 'algoexplorer.io': 'ALGO',
1455
- 'explorer.ambrosus.com': 'AMB',
1456
- 'viewblock.io/zilliqa': 'ZIL',
1457
- 'viewblock.io/arweave': 'AR',
1458
- 'explorer.ark.io': 'ARK',
1459
- 'atomscan.com': 'ATOM',
1460
- 'www.mintscan.io': 'CTK',
1461
- 'explorer.bitcoindiamond.org': 'BCD',
1462
- 'btgexplorer.com': 'BTG',
1463
- 'bts.ai': 'BTS',
1464
- 'explorer.celo.org': 'CELO',
1465
- 'explorer.nervos.org': 'CKB',
1466
- 'cerebro.cortexlabs.ai': 'CTXC',
1467
- 'chainz.cryptoid.info': 'VIA',
1468
- 'explorer.dcrdata.org': 'DCR',
1469
- 'digiexplorer.info': 'DGB',
1470
- 'dock.subscan.io': 'DOCK',
1471
- 'dogechain.info': 'DOGE',
1472
- 'explorer.elrond.com': 'EGLD',
1473
- 'blockscout.com': 'ETC',
1474
- 'explore-fetchhub.fetch.ai': 'FET',
1475
- 'filfox.info': 'FIL',
1476
- 'fio.bloks.io': 'FIO',
1477
- 'explorer.firo.org': 'FIRO',
1478
- 'neoscan.io': 'NEO',
1479
- 'ftmscan.com': 'FTM',
1480
- 'explorer.gochain.io': 'GO',
1481
- 'block.gxb.io': 'GXS',
1482
- 'hash-hash.info': 'HBAR',
1483
- 'www.hiveblockexplorer.com': 'HIVE',
1484
- 'explorer.helium.com': 'HNT',
1485
- 'tracker.icon.foundation': 'ICX',
1486
- 'www.iostabc.com': 'IOST',
1487
- 'explorer.iota.org': 'IOTA',
1488
- 'iotexscan.io': 'IOTX',
1489
- 'irishub.iobscan.io': 'IRIS',
1490
- 'kava.mintscan.io': 'KAVA',
1491
- 'scope.klaytn.com': 'KLAY',
1492
- 'kmdexplorer.io': 'KMD',
1493
- 'kusama.subscan.io': 'KSM',
1494
- 'explorer.lto.network': 'LTO',
1495
- 'polygonscan.com': 'POLYGON',
1496
- 'explorer.ont.io': 'ONT',
1497
- 'minaexplorer.com': 'MINA',
1498
- 'nanolooker.com': 'NANO',
1499
- 'explorer.nebulas.io': 'NAS',
1500
- 'explorer.nbs.plus': 'NBS',
1501
- 'explorer.nebl.io': 'NEBL',
1502
- 'nulscan.io': 'NULS',
1503
- 'nxscan.com': 'NXS',
1504
- 'explorer.harmony.one': 'ONE',
1505
- 'explorer.poa.network': 'POA',
1506
- 'qtum.info': 'QTUM',
1507
- 'explorer.rsk.co': 'RSK',
1508
- 'www.oasisscan.com': 'ROSE',
1509
- 'ravencoin.network': 'RVN',
1510
- 'sc.tokenview.com': 'SC',
1511
- 'secretnodes.com': 'SCRT',
1512
- 'explorer.skycoin.com': 'SKY',
1513
- 'steemscan.com': 'STEEM',
1514
- 'explorer.stacks.co': 'STX',
1515
- 'www.thetascan.io': 'THETA',
1516
- 'scan.tomochain.com': 'TOMO',
1517
- 'explore.vechain.org': 'VET',
1518
- 'explorer.vite.net': 'VITE',
1519
- 'www.wanscan.org': 'WAN',
1520
- 'wavesexplorer.com': 'WAVES',
1521
- 'wax.eosx.io': 'WAXP',
1522
- 'waltonchain.pro': 'WTC',
1523
- 'chain.nem.ninja': 'XEM',
1524
- 'verge-blockchain.info': 'XVG',
1525
- 'explorer.yoyow.org': 'YOYOW',
1526
- 'explorer.zcha.in': 'ZEC',
1527
- 'explorer.zensystem.io': 'ZEN',
1340
+ 'SOL': 'SOL', // temporary fix for SPL definition
1528
1341
  },
1529
1342
  'impliedNetworks': {
1530
1343
  'ETH': { 'ERC20': 'ETH' },
@@ -9264,43 +9077,19 @@ export default class binance extends Exchange {
9264
9077
  parseDepositAddress(response, currency = undefined) {
9265
9078
  //
9266
9079
  // {
9267
- // "currency": "XRP",
9080
+ // "coin": "XRP",
9268
9081
  // "address": "rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh",
9269
9082
  // "tag": "108618262",
9270
- // "info": {
9271
- // "coin": "XRP",
9272
- // "address": "rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh",
9273
- // "tag": "108618262",
9274
- // "url": "https://bithomp.com/explorer/rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh"
9275
- // }
9083
+ // "url": "https://bithomp.com/explorer/rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh"
9276
9084
  // }
9277
9085
  //
9278
- const info = this.safeDict(response, 'info', {});
9279
- const url = this.safeString(info, 'url');
9086
+ const url = this.safeString(response, 'url');
9280
9087
  const address = this.safeString(response, 'address');
9281
9088
  const currencyId = this.safeString(response, 'currency');
9282
9089
  const code = this.safeCurrencyCode(currencyId, currency);
9283
- let impliedNetwork = undefined;
9284
- if (url !== undefined) {
9285
- const reverseNetworks = this.safeDict(this.options, 'reverseNetworks', {});
9286
- const parts = url.split('/');
9287
- let topLevel = this.safeString(parts, 2);
9288
- if ((topLevel === 'blockchair.com') || (topLevel === 'viewblock.io')) {
9289
- const subLevel = this.safeString(parts, 3);
9290
- if (subLevel !== undefined) {
9291
- topLevel = topLevel + '/' + subLevel;
9292
- }
9293
- }
9294
- impliedNetwork = this.safeString(reverseNetworks, topLevel);
9295
- const impliedNetworks = this.safeDict(this.options, 'impliedNetworks', {
9296
- 'ETH': { 'ERC20': 'ETH' },
9297
- 'TRX': { 'TRC20': 'TRX' },
9298
- });
9299
- if (code in impliedNetworks) {
9300
- const conversion = this.safeDict(impliedNetworks, code, {});
9301
- impliedNetwork = this.safeString(conversion, impliedNetwork, impliedNetwork);
9302
- }
9303
- }
9090
+ // deposit-address endpoint provides only network url (not network ID/CODE)
9091
+ // so we should map the url to network (their data is inside currencies)
9092
+ const networkCode = this.getNetworkCodeByNetworkUrl(code, url);
9304
9093
  let tag = this.safeString(response, 'tag', '');
9305
9094
  if (tag.length === 0) {
9306
9095
  tag = undefined;
@@ -9309,7 +9098,7 @@ export default class binance extends Exchange {
9309
9098
  return {
9310
9099
  'info': response,
9311
9100
  'currency': code,
9312
- 'network': impliedNetwork,
9101
+ 'network': networkCode,
9313
9102
  'address': address,
9314
9103
  'tag': tag,
9315
9104
  };
@@ -12079,6 +11868,41 @@ export default class binance extends Exchange {
12079
11868
  };
12080
11869
  return this.safeString(ledgerType, type, type);
12081
11870
  }
11871
+ getNetworkCodeByNetworkUrl(currencyCode, depositUrl = undefined) {
11872
+ // depositUrl is like : https://bscscan.com/address/0xEF238AB229342849..
11873
+ if (depositUrl === undefined) {
11874
+ return undefined;
11875
+ }
11876
+ let networkCode = undefined;
11877
+ const currency = this.currency(currencyCode);
11878
+ const networks = this.safeDict(currency, 'networks', {});
11879
+ const networkCodes = Object.keys(networks);
11880
+ for (let i = 0; i < networkCodes.length; i++) {
11881
+ const currentNetworkCode = networkCodes[i];
11882
+ const info = this.safeDict(networks[currentNetworkCode], 'info', {});
11883
+ const siteUrl = this.safeString(info, 'contractAddressUrl');
11884
+ // check if url matches the field's value
11885
+ if (siteUrl !== undefined && depositUrl.startsWith(this.getBaseDomainFromUrl(siteUrl))) {
11886
+ networkCode = currentNetworkCode;
11887
+ }
11888
+ }
11889
+ return networkCode;
11890
+ }
11891
+ getBaseDomainFromUrl(url) {
11892
+ if (url === undefined) {
11893
+ return undefined;
11894
+ }
11895
+ const urlParts = url.split('/');
11896
+ const scheme = this.safeString(urlParts, 0);
11897
+ if (scheme === undefined) {
11898
+ return undefined;
11899
+ }
11900
+ const domain = this.safeString(urlParts, 2);
11901
+ if (domain === undefined) {
11902
+ return undefined;
11903
+ }
11904
+ return scheme + '//' + domain + '/';
11905
+ }
12082
11906
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
12083
11907
  const urls = this.urls;
12084
11908
  if (!(api in urls['api'])) {
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bitfinex.js';
2
- import type { TransferEntry, Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderBook, Str, Transaction, Ticker, Balances, Tickers, Strings, Currency, Market, OpenInterest, Liquidation, OrderRequest, Num, MarginModification, Currencies, TradingFees, Dict, LedgerEntry, FundingRate, FundingRates, DepositAddress, OpenInterests } from './base/types.js';
2
+ import type { TransferEntry, Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderBook, Str, Transaction, Ticker, Balances, Tickers, Strings, Currency, Market, OpenInterest, Liquidation, OrderRequest, Num, MarginModification, Currencies, TradingFees, Dict, LedgerEntry, FundingRate, FundingRates, DepositAddress, OpenInterests, Position } from './base/types.js';
3
3
  /**
4
4
  * @class bitfinex
5
5
  * @augments Exchange
@@ -346,8 +346,8 @@ export default class bitfinex extends Exchange {
346
346
  * @param {object} [params] extra parameters specific to the exchange API endpoint
347
347
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
348
348
  */
349
- fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
350
- parsePosition(position: Dict, market?: Market): import("./base/types.js").Position;
349
+ fetchPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
350
+ parsePosition(position: Dict, market?: Market): Position;
351
351
  nonce(): number;
352
352
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
353
353
  url: string;
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bitflyer.js';
2
- import type { Balances, Currency, Dict, FundingRate, Int, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Trade, TradingFeeInterface, Transaction, int } from './base/types.js';
2
+ import type { Balances, Currency, Dict, FundingRate, Int, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Trade, TradingFeeInterface, Transaction, Position, int } from './base/types.js';
3
3
  /**
4
4
  * @class bitflyer
5
5
  * @augments Exchange
@@ -167,7 +167,7 @@ export default class bitflyer extends Exchange {
167
167
  * @param {object} [params] extra parameters specific to the exchange API endpoint
168
168
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
169
169
  */
170
- fetchPositions(symbols?: Strings, params?: {}): Promise<any>;
170
+ fetchPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
171
171
  /**
172
172
  * @method
173
173
  * @name bitflyer#withdraw
@@ -588,8 +588,10 @@ export default class bitget extends Exchange {
588
588
  * @name bitget#fetchFundingRate
589
589
  * @description fetch the current funding rate
590
590
  * @see https://www.bitget.com/api-doc/contract/market/Get-Current-Funding-Rate
591
+ * @see https://www.bitget.com/api-doc/contract/market/Get-Symbol-Next-Funding-Time
591
592
  * @param {string} symbol unified market symbol
592
593
  * @param {object} [params] extra parameters specific to the exchange API endpoint
594
+ * @param {string} [params.method] either (default) 'publicMixGetV2MixMarketCurrentFundRate' or 'publicMixGetV2MixMarketFundingTime'
593
595
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
594
596
  */
595
597
  fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;