Skip to content

Sagleft/uexchange-js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

Features

  • Bypass CORS even when used locally.
  • Connecting directly to the CRP.is API.

Who is this solution for:

  • 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.

Use from CDN

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>

JavaScript

Usage example

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

About

Crypton Exchange API wrapper written in Javascript

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • JavaScript 100.0%