Simple FixedFloat API wrapper (unofficial)
Docs | Website | FAQ
With NPM
npm i fixedfloat-api
With Yarn
yarn add fixedfloat-api
const FixedFloat = require("fixedfloat-api");
const fixed = new FixedFloat('API_KEY', 'API_SECRET');
- constructor(settings)
- .getCurrencies()
- .getPrice(from, to, type)
- .getOrder(id, token)
- .setEmergency(id, token, choice, address)
- .createOrder(from, to, toAddress, type, extra)
- ._request(req_method, api_method, body)
Create instance.
const fixed = new FixedFloat('API_KEY', 'API_SECRET');
Getting a list of all currencies that are available. Official docs
const response = await fixed.getCurrencies();
Information about a currency pair with a set amount of funds. Official docs
// Simple float
const response = await fixed.getPrice('0.1 ETH', 'BTC');
// Reversive fixed
const response = await fixed.getPrice('ETH', '0.1 BTC', 'fixed');
Receiving information about the order. Official docs
Modified original response: added a
response.statusText
(see Order states section)
const response = await fixed.getOrder('ORDER_ID', 'ORDER_TOKEN');
Emergency Action Choice. Official docs
await fixed.setEmergency('ORDER_ID', 'ORDER_TOKEN', 'EXCHANGE or REFUND', 'ADDRESS for refund');
Creating exchange order. Official docs
Modified original response: added a
response.statusText
(see Order states section)
const response = await fixed.createOrder('0.1 ETH', 'BTC', 'BTC address');
Call method manually.
Attention: this is a utility method
// GET query or POST body
const body = new URLSearchParams({
someParam: 'someValue',
...
});
const response = await fixed._request('GET or POST', 'methodName', body);
All order states (statuses) are listed here
const STATES = [
/* 0 */ 'Transaction expected',
/* 1 */ 'The transaction is waiting for the required number of confirmations',
/* 2 */ 'Currency exchange',
/* 3 */ 'Sending funds',
/* 4 */ 'Completed',
/* 5 */ 'Expired',
/* 6 */ 'Not currently in use',
/* 7 */ 'A decision must be made to proceed with the order'
];
fixedfloat-api is Licensed under the MIT License. Simple and clear about MIT License is written here