UNPKG

@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) 841 B
import"../numerics/index.js";import{BigNumber as r}from"@ethersproject/bignumber";const o=o=>function o(t){if(r.isBigNumber(t))return t.toString();if("object"==typeof t&&null!==t){const r=Array.isArray(t)?[]:{};for(const e in t)r[e]=o(t[e]);return r}return t}(o),t=r=>o(r),e=o=>({y:r.from(o.y),z:r.from(o.z),A:r.from(o.A),B:r.from(o.B)}),n=r=>o(r),i=o=>({id:r.from(o.id),token0:o.token0,token1:o.token1,order0:e(o.order0),order1:e(o.order1)}),f=r=>o(r),m=r=>{const o={};for(const[t,n]of Object.entries(r))o[t]=e(n);return o},s=r=>o(r),u=o=>({strategyId:r.from(o.strategyId),amount:r.from(o.amount)});export{t as encodedOrderBNToStr,e as encodedOrderStrToBN,n as encodedStrategyBNToStr,i as encodedStrategyStrToBN,s as matchActionBNToStr,f as ordersMapBNToStr,m as ordersMapStrToBN,o as replaceBigNumbersWithStrings,u as tradeActionStrToBN};