Install
npm i @elevenyellow.com/switchain-api-client
Initialize
const { init } = require("switchain-api-client");
const SwitchainApi = init({ apiKey: "xxx" });
API
getMarketInfo
Returns
{
info: [ { signature, expiryTs, pair, quote, maxLimit, minLimit }, ... ]
}
Example
const { info } = SwitchainApi.getMarketInfo();
getOffer
Params
Returns
{
offer: {
signature, expiryTs, pair, quote, maxLimit, minLimit;
}
}
Example
const { offer } = SwitchainApi.getOffer({
pair: "ETH-DAI"
});
postOrder
Params
- pair:
string
- toAddress:
string
- refundAddress:
string
- fromAmount:
string
- signature:
string
Returns
{
order: {
orderId, fromAmount, rate, exchangeAddress, toAddress, refundAddress;
}
}
Example
const { offer } = SwitchainApi.postOrder({
toAddress,
refundAddress,
pair,
fromAmount,
signature
});
getOrderStatus
Params
Returns
{
status: {
status, fromAmount, rate, exchangeAddress, toAddress, refundAddress, toTx;
}
}
Example
const { status } = SwitchainApi.getOrderStatus({ orderId });