@bancor/carbon-sdk
Version:
The SDK is a READ-ONLY tool, intended to facilitate working with Carbon contracts. It's a convenient wrapper around our matching algorithm, allowing programs and users get a ready to use transaction data that will allow them to manage strategies and fulfi
2 lines (1 loc) • 449 B
JavaScript
const n=(n,e)=>n.localeCompare(e),e=n=>{if(2!==n.length)throw new Error(`Invalid number of tokens: expected 2, got ${n.length}`);if(n[0]===n[1])throw new Error(`Cannot create key for identical tokens: ${n[0]}`);return n.join("_")},r=(r,t)=>e([r,t].sort(n)),t=n=>{const e=n.split("_");return[e[0],e[1]]},o=(n,r)=>e([n,r]);function i(n){return n.y>0n&&(n.A>0n||n.B>0n)}export{t as fromPairKey,i as isOrderTradable,o as toDirectionKey,r as toPairKey};