@bancor/carbon-sdk
Advanced tools
Comparing version 0.0.101-DEV to 0.0.102-DEV
@@ -7,5 +7,4 @@ /** | ||
logVerbosityLevel: number; | ||
legacyTradeBySourceRange: boolean; | ||
}; | ||
export declare function getRuntimeConfig(): RuntimeConfig; | ||
//# sourceMappingURL=runtime-config.d.ts.map |
@@ -1,1 +0,1 @@ | ||
const e=(()=>{try{return self}catch(e){try{return window}catch(e){return global}}})();function r(){return{logVerbosityLevel:void 0!==e&&Number(e.CARBON_DEFI_SDK_VERBOSITY)||0,legacyTradeBySourceRange:void 0!==e&&Boolean(e.LEGACY_TRADE_BY_SOURCE_RANGE)}}export{r as getRuntimeConfig}; | ||
const r=(()=>{try{return self}catch(r){try{return window}catch(r){return global}}})();function t(){return{logVerbosityLevel:void 0!==r&&Number(r.CARBON_DEFI_SDK_VERBOSITY)||0}}export{t as getRuntimeConfig}; |
@@ -6,3 +6,3 @@ import { BigNumber, BigNumberish, Decimal } from '../utils/numerics'; | ||
export declare function normalizeInvertedRate(amount: BigNumberish, amountTokenDecimals: number, otherTokenDecimals: number): string; | ||
export declare const encodeStrategy: (strategy: DecodedStrategy) => Omit<EncodedStrategy, 'id'>; | ||
export declare const encodeStrategy: (strategy: DecodedStrategy) => Omit<EncodedStrategy, "id">; | ||
export declare const decodeStrategy: (strategy: EncodedStrategy) => DecodedStrategy & { | ||
@@ -9,0 +9,0 @@ id: BigNumber; |
@@ -1,1 +0,1 @@ | ||
import{ONE as r,BigNumberMax as t}from"../../utils/numerics/index.js";import{decodeFloat as e}from"../../utils/encoders/index.js";import{getRuntimeConfig as n}from"../../runtime-config/index.js";import{BigNumber as o}from"@ethersproject/bignumber";const u=n().legacyTradeBySourceRange,i=o.from(r),s=o.from(2).pow(128).sub(1),c=o.from(2).pow(256).sub(1);function m(r,t){if(r.gte(0)&&r.lte(t))return r;throw null}const d=r=>m(r,s),f=(r,t)=>m(r.add(t),c),a=(r,t)=>m(r.mul(t),c),l=(r,t,e)=>m(r.mul(t).div(e),c),p=(r,t,e)=>m(r.mul(t).add(e).sub(1).div(e),c),b=(r,e,n,o,u)=>{if(o.eq(0))return p(r,a(i,i),a(u,u));const s=a(n,i),d=f(a(e,o),a(n,u)),b=(y=d,g=a(r,o),m(y.sub(g),c));var y,g;const v=p(s,s,c),h=p(d,b,c),j=t(v,h),x=p(s,s,j),w=l(d,b,j);return p(r,x,w)},y=(r,n)=>{const s=r,m=n.y,b=n.z,y=e(n.A),g=e(n.B);try{return d(((r,e,n,o,s,m=!1)=>{const d=m||u;if(o.eq(0))return l(r,a(s,s),a(i,i));const b=a(n,i),y=f(a(e,o),a(n,s)),g=a(y,r),v=p(b,b,c),h=p(g,o,c),j=t(v,h),x=p(b,b,j),w=p(g,o,j);return d||x.add(w).lte(c)?l(y,g.div(j),x.add(w)):y.div(f(o,p(b,b,g)))})(s,m,b,y,g))}catch(r){return o.from(0)}},g=(r,t)=>{const n=r,o=t.y,u=t.z,i=e(t.A),c=e(t.B);try{return d(b(n,o,u,i,c))}catch(r){return s}};export{g as getEncodedTradeSourceAmount,y as getEncodedTradeTargetAmount}; | ||
import{ONE as r,BigNumberMax as t}from"../../utils/numerics/index.js";import{decodeFloat as e}from"../../utils/encoders/index.js";import{BigNumber as n}from"@ethersproject/bignumber";const o=n.from(r),u=n.from(2).pow(128).sub(1),s=n.from(2).pow(256).sub(1);function i(r,t){if(r.gte(0)&&r.lte(t))return r;throw null}const c=r=>i(r,u),d=(r,t)=>i(r.add(t),s),m=(r,t)=>i(r.mul(t),s),f=(r,t,e)=>i(r.mul(t).div(e),s),l=(r,t,e)=>i(r.mul(t).add(e).sub(1).div(e),s),a=(r,e,n,u,c)=>{if(u.eq(0))return l(r,m(o,o),m(c,c));const a=m(n,o),p=d(m(e,u),m(n,c)),b=(v=p,h=m(r,u),i(v.sub(h),s));var v,h;const y=l(a,a,s),j=l(p,b,s),w=t(y,j),x=l(a,a,w),g=f(p,b,w);return l(r,x,g)},p=(r,u)=>{const i=r,a=u.y,p=u.z,b=e(u.A),v=e(u.B);try{return c(((r,e,n,u,i)=>{if(u.eq(0))return f(r,m(i,i),m(o,o));const c=m(n,o),a=d(m(e,u),m(n,i)),p=m(a,r),b=l(c,c,s),v=l(p,u,s),h=t(b,v),y=l(c,c,h),j=l(p,u,h);return y.add(j).lte(s)?f(a,p.div(h),y.add(j)):a.div(d(u,l(c,c,p)))})(i,a,p,b,v))}catch(r){return n.from(0)}},b=(r,t)=>{const n=r,o=t.y,s=t.z,i=e(t.A),d=e(t.B);try{return c(a(n,o,s,i,d))}catch(r){return u}};export{b as getEncodedTradeSourceAmount,p as getEncodedTradeTargetAmount}; |
@@ -7,6 +7,3 @@ import { BigNumber, Decimal } from './numerics'; | ||
export declare const decodeFloat: (value: BigNumber) => BigNumber; | ||
export declare const encodeOrders: ([order0, order1]: [DecodedOrder, DecodedOrder]) => [ | ||
EncodedOrder, | ||
EncodedOrder | ||
]; | ||
export declare const encodeOrders: ([order0, order1]: [DecodedOrder, DecodedOrder]) => [EncodedOrder, EncodedOrder]; | ||
export declare const isOrderEncodable: (order: DecodedOrder) => boolean; | ||
@@ -13,0 +10,0 @@ /** |
@@ -1,1 +0,1 @@ | ||
import{BigNumber as t}from"@ethersproject/bignumber";export{BigNumber}from"@ethersproject/bignumber";import{parseUnits as e,formatUnits as r}from"@ethersproject/units";import o from"decimal.js";export{default as Decimal}from"decimal.js";o.set({precision:100,rounding:o.ROUND_HALF_DOWN,toExpNeg:-30,toExpPos:30});const n=(t,e)=>t.lt(e)?t:e,i=(t,e)=>t.gt(e)?t:e,s=2**48,m=new o(10),c=(t,e)=>{const r=t-e;return m.pow(r)},p=t=>new o(t.toString()),u=e=>t.from(e.toFixed()),f=(t,e,r)=>e.eq(r)?t:t.mul(e).div(r);function a(t,e){return new o(t).toFixed(e,o.ROUND_DOWN).replace(/(\.\d*?[1-9])0+$|\.0*$/,"$1")}function d(t,r){const o=a(t,r);return e(o,r)}function x(t,e){const n=r(t,e);return new o(n).toFixed()}export{i as BigNumberMax,n as BigNumberMin,p as BnToDec,u as DecToBn,s as ONE,m as TEN,x as formatUnits,f as mulDiv,d as parseUnits,c as tenPow,a as trimDecimal}; | ||
import{BigNumber as t}from"@ethersproject/bignumber";export{BigNumber}from"@ethersproject/bignumber";import{parseUnits as e,formatUnits as r}from"@ethersproject/units";import o from"decimal.js";export{default as Decimal}from"decimal.js";o.set({precision:100,rounding:o.ROUND_HALF_DOWN,toExpNeg:-300,toExpPos:300});const n=(t,e)=>t.lt(e)?t:e,i=(t,e)=>t.gt(e)?t:e,s=2**48,m=new o(10),c=(t,e)=>{const r=t-e;return m.pow(r)},p=t=>new o(t.toString()),u=e=>t.from(e.toFixed()),f=(t,e,r)=>e.eq(r)?t:t.mul(e).div(r);function a(t,e){return new o(t).toFixed(e,o.ROUND_DOWN).replace(/(\.\d*?[1-9])0+$|\.0*$/,"$1")}function d(t,r){const o=a(t,r);return e(o,r)}function x(t,e){const n=r(t,e);return new o(n).toFixed()}export{i as BigNumberMax,n as BigNumberMin,p as BnToDec,u as DecToBn,s as ONE,m as TEN,x as formatUnits,f as mulDiv,d as parseUnits,c as tenPow,a as trimDecimal}; |
@@ -1,4 +0,3 @@ | ||
import { BigNumber } from './numerics'; | ||
import { EncodedOrder, EncodedOrderBNStr, EncodedStrategy, EncodedStrategyBNStr, MatchAction, MatchActionBNStr, OrdersMap, OrdersMapBNStr, RetypeBigNumberToString, TradeAction, TradeActionBNStr } from '../common/types'; | ||
export declare const replaceBigNumbersWithStrings: <T>(obj: T) => import("../common/types").RetypeProps<T, BigNumber, string>; | ||
export declare const replaceBigNumbersWithStrings: <T>(obj: T) => RetypeBigNumberToString<T>; | ||
export declare const encodedOrderBNToStr: (order: EncodedOrder) => EncodedOrderBNStr; | ||
@@ -5,0 +4,0 @@ export declare const encodedOrderStrToBN: (order: EncodedOrderBNStr) => EncodedOrder; |
@@ -5,3 +5,3 @@ { | ||
"source": "src/index.ts", | ||
"version": "0.0.101-DEV", | ||
"version": "0.0.102-DEV", | ||
"description": "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 fulfill trades", | ||
@@ -8,0 +8,0 @@ "main": "dist/index.cjs", |
@@ -96,8 +96,2 @@ # Carbon SDK | ||
### 2. For usage with contracts version < 5, without the enhanced range for trade by source: | ||
```js | ||
window.LEGACY_TRADE_BY_SOURCE_RANGE = true; | ||
``` | ||
## Authors | ||
@@ -104,0 +98,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 4 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 4 instances in 1 package
591185
134
6408
112