@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) • 464 B
JavaScript
const t=(t,e)=>t.localeCompare(e),e="->-<-",r=t=>{if(2!==t.length)throw new Error(`Invalid number of tokens: expected 2, got ${t.length}`);if(t[0]===t[1])throw new Error(`Cannot create key for identical tokens: ${t[0]}`);return t.join(e)},n=(e,n)=>r([e,n].sort(t)),o=t=>{const r=t.split(e);return[r[0],r[1]]},i=(t,e)=>r([t,e]);function c(t){return t.y.gt(0)&&(t.A.gt(0)||t.B.gt(0))}export{o as fromPairKey,c as isOrderTradable,i as toDirectionKey,n as toPairKey};