Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,13 @@ console.log (ccxt.exchanges) // print all available exchanges

All-in-one browser bundle (dependencies included), served from a CDN of your choice:

* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@1.58.92/dist/ccxt.browser.js
* unpkg: https://unpkg.com/ccxt@1.58.92/dist/ccxt.browser.js
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@1.58.95/dist/ccxt.browser.js
* unpkg: https://unpkg.com/ccxt@1.58.95/dist/ccxt.browser.js

CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.

```HTML
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@1.58.92/dist/ccxt.browser.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@1.58.95/dist/ccxt.browser.js"></script>
```

Creates a global `ccxt` object:
Expand Down
2 changes: 1 addition & 1 deletion ccxt.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const Exchange = require ('./js/base/Exchange')
//-----------------------------------------------------------------------------
// this is updated by vss.js when building

const version = '1.58.92'
const version = '1.58.95'

Exchange.ccxtVersion = version

Expand Down
133 changes: 113 additions & 20 deletions dist/ccxt.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const Exchange = require ('./js/base/Exchange')
//-----------------------------------------------------------------------------
// this is updated by vss.js when building

const version = '1.58.92'
const version = '1.58.95'

Exchange.ccxtVersion = version

Expand Down Expand Up @@ -14794,6 +14794,11 @@ module.exports = class binance extends Exchange {
}
}
impliedNetwork = this.safeString (reverseNetworks, topLevel);
if ((code === 'ETH') && (impliedNetwork === 'ERC20')) {
impliedNetwork = 'ETH';
} else if ((code === 'TRX') && (impliedNetwork === 'TRC20')) {
impliedNetwork = 'TRX';
}
}
let tag = this.safeString (response, 'tag', '');
if (tag.length === 0) {
Expand Down Expand Up @@ -90685,7 +90690,8 @@ module.exports = class mexc extends Exchange {
networkId = parts.join ('');
networkId = networkId.replace ('-20', '20');
const networksById = {
'ETH': 'ERC20',
'ETH': 'ETH',
'ERC20': 'ERC20',
'BEP20(BSC)': 'BEP20',
'TRX': 'TRC20',
};
Expand Down Expand Up @@ -138020,7 +138026,9 @@ module.exports = class wavesexchange extends Exchange {
},
'private': {
'get': [
'deposit/addresses/{code}',
'deposit/addresses/{currency}',
'deposit/addresses/{currency}/{platform}',
'platforms',
'deposit/currencies',
'withdraw/currencies',
'withdraw/addresses/{currency}/{address}',
Expand Down Expand Up @@ -138055,6 +138063,14 @@ module.exports = class wavesexchange extends Exchange {
'withdrawFeeWAVES': 100000,
'wavesPrecision': 8,
'messagePrefix': 'W', // W for production, T for testnet
'networks': {
'ERC20': 'ETH',
'BEP20': 'BSC',
},
'reverseNetworks': {
'ETH': 'ERC20',
'BSC': 'BEP20',
},
},
'requiresEddsa': true,
'exceptions': {
Expand Down Expand Up @@ -138314,10 +138330,6 @@ module.exports = class wavesexchange extends Exchange {
}

async signIn (params = {}) {
return await this.getAccessToken (params);
}

async getAccessToken (params = {}) {
if (!this.safeString (this.options, 'accessToken')) {
const prefix = 'ffffff01';
const expiresDelta = 60 * 60 * 24 * 7;
Expand Down Expand Up @@ -138545,29 +138557,105 @@ module.exports = class wavesexchange extends Exchange {
}

async fetchDepositAddress (code, params = {}) {
await this.getAccessToken ();
const supportedCurrencies = await this.privateGetDepositCurrencies ();
await this.signIn ();
const networks = this.safeValue (this.options, 'networks', {});
const rawNetwork = this.safeStringUpper (params, 'network');
const network = this.safeString (networks, rawNetwork, rawNetwork);
params = this.omit (params, [ 'network' ]);
const supportedCurrencies = await this.privateGetPlatforms ();
//
// {
// "type": "list",
// "page_info": {
// "has_next_page": false,
// "last_cursor": null
// },
// "items": [
// {
// "type": "platform",
// "id": "ETH",
// "name": "Ethereum",
// "currencies": [
// "BAG",
// "BNT",
// "CRV",
// "EGG",
// "ETH",
// "EURN",
// "FL",
// "NSBT",
// "USDAP",
// "USDC",
// "USDFL",
// "USDN",
// "USDT",
// "WAVES"
// ]
// }
// ]
// }
//
const currencies = {};
const networksByCurrency = {};
const items = this.safeValue (supportedCurrencies, 'items', []);
for (let i = 0; i < items.length; i++) {
const entry = items[i];
const currencyCode = this.safeString (entry, 'id');
currencies[currencyCode] = true;
const currencyId = this.safeString (entry, 'id');
const innerCurrencies = this.safeValue (entry, 'currencies', []);
for (let j = 0; j < innerCurrencies.length; j++) {
const currencyCode = this.safeString (innerCurrencies, j);
currencies[currencyCode] = true;
if (!(currencyCode in networksByCurrency)) {
networksByCurrency[currencyCode] = {};
}
networksByCurrency[currencyCode][currencyId] = true;
}
}
if (!(code in currencies)) {
const codes = Object.keys (currencies);
throw new ExchangeError (this.id + ' fetch ' + code + ' deposit address not supported. Currency code must be one of ' + codes.toString ());
throw new ExchangeError (this.id + ' fetch ' + code + ' deposit address not supported. Currency code must be one of ' + codes.join (', '));
}
const request = this.extend ({
'code': code,
}, params);
const response = await this.privateGetDepositAddressesCode (request);
let response = undefined;
if (network === undefined) {
const request = {
'currency': code,
};
response = await this.privateGetDepositAddressesCurrency (this.extend (request, params));
} else {
const supportedNetworks = networksByCurrency[code];
if (!(network in supportedNetworks)) {
const supportedNetworkKeys = Object.keys (supportedNetworks);
throw new ExchangeError (this.id + ' ' + network + ' network ' + code + ' deposit address not supported. Network must be one of ' + supportedNetworkKeys.join (', '));
}
if (network === 'WAVES') {
const request = {
'publicKey': this.apiKey,
};
const response = await this.nodeGetAddressesPublicKeyPublicKey (this.extend (request, request));
const address = this.safeString (response, 'address');
return {
'address': address,
'code': code,
'network': network,
'tag': undefined,
'info': response,
};
} else {
const request = {
'currency': code,
'platform': network,
};
response = await this.privateGetDepositAddressesCurrencyPlatform (this.extend (request, params));
}
}
//
// {
// "type": "deposit_addresses",
// "currency": {
// "type": "deposit_currency",
// "id": "ERGO",
// "waves_asset_id": "5dJj4Hn9t2Ve3tRpNGirUHy4yBK6qdJRAJYV21yPPuGz",
// "platform_id": "BSC",
// "decimals": 9,
// "status": "active",
// "allowed_amount": {
Expand All @@ -138583,12 +138671,17 @@ module.exports = class wavesexchange extends Exchange {
// "9fRAAQjF8Yqg7qicQCL884zjimsRnuwsSavsM1rUdDaoG8mThku"
// ]
// }
const currency = this.safeValue (response, 'currency');
const networkId = this.safeString (currency, 'platform_id');
const reverseNetworks = this.safeValue (this.options, 'reverseNetworks', {});
const unifiedNetwork = this.safeString (reverseNetworks, networkId, networkId);
const addresses = this.safeValue (response, 'deposit_addresses');
const address = this.safeString (addresses, 0);
return {
'address': address,
'code': code,
'tag': undefined,
'network': unifiedNetwork,
'info': response,
};
}
Expand Down Expand Up @@ -138839,7 +138932,7 @@ module.exports = class wavesexchange extends Exchange {
async cancelOrder (id, symbol = undefined, params = {}) {
this.checkRequiredDependencies ();
this.checkRequiredKeys ();
await this.getAccessToken ();
await this.signIn ();
const wavesAddress = await this.getWavesAddress ();
const response = await this.forwardPostMatcherOrdersWavesAddressCancel ({
'wavesAddress': wavesAddress,
Expand Down Expand Up @@ -138921,7 +139014,7 @@ module.exports = class wavesexchange extends Exchange {

async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
await this.getAccessToken ();
await this.signIn ();
let market = undefined;
if (symbol !== undefined) {
market = this.market (symbol);
Expand All @@ -138937,7 +139030,7 @@ module.exports = class wavesexchange extends Exchange {

async fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
await this.getAccessToken ();
await this.signIn ();
let market = undefined;
if (symbol !== undefined) {
market = this.market (symbol);
Expand Down Expand Up @@ -139430,7 +139523,7 @@ module.exports = class wavesexchange extends Exchange {
break;
}
}
await this.getAccessToken ();
await this.signIn ();
let proxyAddress = undefined;
if (code === 'WAVES' && !isErc20) {
proxyAddress = address;
Expand Down
6 changes: 3 additions & 3 deletions doc/readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1899,14 +1899,14 @@ JavaScript (for use with the ``<script>`` tag):
All-in-one browser bundle (dependencies included), served from a CDN of your choice:


* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@1.58.92/dist/ccxt.browser.js
* unpkg: https://unpkg.com/ccxt@1.58.92/dist/ccxt.browser.js
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@1.58.95/dist/ccxt.browser.js
* unpkg: https://unpkg.com/ccxt@1.58.95/dist/ccxt.browser.js

CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.

.. code-block:: HTML

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@1.58.92/dist/ccxt.browser.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@1.58.95/dist/ccxt.browser.js"></script>

Creates a global ``ccxt`` object:

Expand Down
5 changes: 5 additions & 0 deletions js/binance.js
Original file line number Diff line number Diff line change
Expand Up @@ -3462,6 +3462,11 @@ module.exports = class binance extends Exchange {
}
}
impliedNetwork = this.safeString (reverseNetworks, topLevel);
if ((code === 'ETH') && (impliedNetwork === 'ERC20')) {
impliedNetwork = 'ETH';
} else if ((code === 'TRX') && (impliedNetwork === 'TRC20')) {
impliedNetwork = 'TRX';
}
}
let tag = this.safeString (response, 'tag', '');
if (tag.length === 0) {
Expand Down
3 changes: 2 additions & 1 deletion js/mexc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,8 @@ module.exports = class mexc extends Exchange {
networkId = parts.join ('');
networkId = networkId.replace ('-20', '20');
const networksById = {
'ETH': 'ERC20',
'ETH': 'ETH',
'ERC20': 'ERC20',
'BEP20(BSC)': 'BEP20',
'TRX': 'TRC20',
};
Expand Down
Loading