Carbon allows you to swap coins using two different methods.

1: Atomics Swaps

2: OTC Swap

Atomic Swaps are covered below and is the recommended method for consumer facing applications to swap tokens quickly. This can thought of as similar to ShapeShift.

OTC Swaps involves more steps but allows for deposits, withdrawals, trades and more. This is more similar to an exchange API.

How Does It Work?

Simply request a quote with the required information, and then deposit funds into a temporary custody address. Within moments, the swapped funds are sent to the user's preferred address.

After requesting a quote for ETH or TRX, send the appropriate amount of funds to the address supplied in the 'depositAddr' field of the quote response. After requesting a quote for EOS or CUSD, send the appropriate amount of funds to the account 'carbonteswal' with the memo specified in the quote response. Please make sure to send the same amount of funds as specified in the 'quantity' parameter of your quote request.

Getting a Quote

GET

Super JWT Required

Parameters

Parameters Access Description
contactId required your contactId
recvAddr required address to receive swapped funds
input required the asset symbol you own and would like to trade
ex. 'cusd', 'eos', 'trx', 'eth'
output required the asset symbol you would like to receive
ex. 'cusd', 'eos', 'trx', 'eth'
quantity required the amount of input you would like to exchange
NOTE: quantities with more precision than the chain allows will be rounded
let jwtToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJlMzE3YjdlNy0yMzQ1LTQ0MWMtODA0Ni1kYjgxNTkyYmEyN2YiLCJzdXBlclVzZXIiOnRydWUsImNvbnRhY3QiOmZhbHNlLCJlbWFpbCI6ImRhbmllbEBjYXJib24ubW9uZXkiLCJpYXQiOjE1NTczMjc5MTR9.WZnSR5N1FebmT9nMu97PJvku49NY0jk4aKVPKm_1MlM';
let headers = {
  headers: {
    Authoriziation: `Bearer ${jwtToken}`
  }
};
let url = `${ROOT}/v1/otc/atomicQuote`;
const contactId = '?contactId=6b77dd4c-c70e-40c8-8ec1-d9050f8bba74';
const recvAddr = '&recvAddr=0x16d35D396fb1762359d3F04CF472aE1c7566168d';
const input = '&input=EOS';
const output = '&output=ETH';
const quantity = '&quantity=10';
axios.get(url + contactId + recvAddr + input + output + quantity, headers).then(result => console.log(result)).catch(err => console.log(err));

Thank you for your feedback