- Bypass CORS even when used locally.
- Connecting directly to the CRP.is API.
- If you want to build a web application that works with the API of the anonymous exchange CRP.is
- If you want to improve your API skills.
- When you create your own trading bot or trading terminal.
- If you are building a WEB3 application that requires stock exchange data.
- When you create your own service that accepts payments in Crypton or UUSD.
- When you create your own crypto exchange.
URL: https://cdn.jsdelivr.net/gh/Sagleft/uexchange-js@v1.1.0/crypton-api.js
<script src="https://cdn.jsdelivr.net/gh/Sagleft/uexchange-js@v1.1.0/crypton-api.js"></script>
const API = new CryptonAPI(transport, saveToken);
const response = await API.pairs();
console.log(response);or
// Wrap all the code in an async function
async function getRate() {
const API = new CryptonAPI(transport, saveToken);
try {
const response = await API.pairs(); // Waiting for response from API
const pairs = response.pairs;
const crpUsdtPair = pairs.find(pair => pair.pair.pair === 'crp_usdt');
if (crpUsdtPair) {
const closePrice = crpUsdtPair.data_market.close;
console.log('CRP/USDT rate is', closePrice);
} else {
console.log('Pair crp_usdt not found.');
}
} catch (error) {
console.error('Error while getting pairs:', error);
}
}
// Run the main function
getRate();result:
CRP/USDT rate is 0.598
