Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uniswap/sdk-core

Package Overview
Dependencies
Maintainers
7
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uniswap/sdk-core - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

dist/utils/babylonianSqrt.d.ts

3

dist/constants.d.ts

@@ -18,5 +18,8 @@ export declare type BigintIsh = bigint | string;

}
export declare const ZERO: bigint;
export declare const ONE: bigint;
export declare const TWO: bigint;
export declare const THREE: bigint;
export declare const TEN: bigint;
export declare const ONE_HUNDRED: bigint;
export declare const MaxUint256: bigint;

4

dist/index.d.ts

@@ -1,5 +0,3 @@

import sortedInsert from './utils/sortedInsert';
import validateAndParseAddress from './utils/validateAndParseAddress';
export { BigintIsh, ChainId, TradeType, Rounding } from './constants';
export * from './entities';
export { sortedInsert, validateAndParseAddress };
export * from './utils';

@@ -14,47 +14,2 @@ 'use strict';

// `maxSize` by removing the last item
function sortedInsert(items, add, maxSize, comparator) {
!(maxSize > 0) ? invariant(false, 'MAX_SIZE_ZERO') : void 0; // this is an invariant because the interface cannot return multiple removed items if items.length exceeds maxSize
!(items.length <= maxSize) ? invariant(false, 'ITEMS_SIZE') : void 0; // short circuit first item add
if (items.length === 0) {
items.push(add);
return null;
} else {
var isFull = items.length === maxSize; // short circuit if full and the additional item does not come before the last item
if (isFull && comparator(items[items.length - 1], add) <= 0) {
return add;
}
var lo = 0,
hi = items.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (comparator(items[mid], add) <= 0) {
lo = mid + 1;
} else {
hi = mid;
}
}
items.splice(lo, 0, add);
return isFull ? items.pop() : null;
}
}
function validateAndParseAddress(address$1) {
try {
var checksummedAddress = address.getAddress(address$1);
"development" !== "production" ? warning(address$1 === checksummedAddress, address$1 + " is not checksummed.") : void 0;
return checksummedAddress;
} catch (error) {
invariant(false, address$1 + " is not a valid address.") ;
}
}
(function (ChainId) {

@@ -80,6 +35,9 @@ ChainId[ChainId["MAINNET"] = 1] = "MAINNET";

var ZERO = /*#__PURE__*/BigInt(0);
var ONE = /*#__PURE__*/BigInt(1);
var TWO = /*#__PURE__*/BigInt(2);
var THREE = /*#__PURE__*/BigInt(3);
var TEN = /*#__PURE__*/BigInt(10);
var ONE_HUNDRED = /*#__PURE__*/BigInt(100);
var MaxUint256 = /*#__PURE__*/Math.pow( /*#__PURE__*/BigInt(2), /*#__PURE__*/BigInt(256)) - /*#__PURE__*/BigInt(1);
var MaxUint256 = /*#__PURE__*/BigInt('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');

@@ -108,2 +66,12 @@ function _defineProperties(target, props) {

function validateAndParseAddress(address$1) {
try {
var checksummedAddress = address.getAddress(address$1);
"development" !== "production" ? warning(address$1 === checksummedAddress, address$1 + " is not checksummed.") : void 0;
return checksummedAddress;
} catch (error) {
invariant(false, address$1 + " is not a valid address.") ;
}
}
/**

@@ -532,2 +500,56 @@ * A currency is any fungible financial instrument on Ethereum, including Ether and all ERC20 tokens.

// `maxSize` by removing the last item
function sortedInsert(items, add, maxSize, comparator) {
!(maxSize > 0) ? invariant(false, 'MAX_SIZE_ZERO') : void 0; // this is an invariant because the interface cannot return multiple removed items if items.length exceeds maxSize
!(items.length <= maxSize) ? invariant(false, 'ITEMS_SIZE') : void 0; // short circuit first item add
if (items.length === 0) {
items.push(add);
return null;
} else {
var isFull = items.length === maxSize; // short circuit if full and the additional item does not come before the last item
if (isFull && comparator(items[items.length - 1], add) <= 0) {
return add;
}
var lo = 0,
hi = items.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (comparator(items[mid], add) <= 0) {
lo = mid + 1;
} else {
hi = mid;
}
}
items.splice(lo, 0, add);
return isFull ? items.pop() : null;
}
}
function babylonianSqrt(y) {
var z = ZERO;
var x;
if (y > THREE) {
z = y;
x = y / TWO + ONE;
while (x < z) {
z = x;
x = (y / x + x) / TWO;
}
} else if (y !== ZERO) {
z = ONE;
}
return z;
}
exports.Currency = Currency;

@@ -541,2 +563,3 @@ exports.CurrencyAmount = CurrencyAmount;

exports.WETH = WETH;
exports.babylonianSqrt = babylonianSqrt;
exports.currencyEquals = currencyEquals;

@@ -543,0 +566,0 @@ exports.sortedInsert = sortedInsert;

@@ -1,2 +0,2 @@

"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var n,r,e,i=t(require("tiny-invariant")),o=require("@ethersproject/address"),a=(t(require("tiny-warning")),t(require("decimal.js-light"))),u=t(require("big.js")),s=t(require("toformat"));function c(t){try{return o.getAddress(t)}catch(t){i(!1)}}(n=exports.ChainId||(exports.ChainId={}))[n.MAINNET=1]="MAINNET",n[n.ROPSTEN=3]="ROPSTEN",n[n.RINKEBY=4]="RINKEBY",n[n["GÖRLI"]=5]="GÖRLI",n[n.KOVAN=42]="KOVAN",(r=exports.TradeType||(exports.TradeType={}))[r.EXACT_INPUT=0]="EXACT_INPUT",r[r.EXACT_OUTPUT=1]="EXACT_OUTPUT",(e=exports.Rounding||(exports.Rounding={}))[e.ROUND_DOWN=0]="ROUND_DOWN",e[e.ROUND_HALF_UP=1]="ROUND_HALF_UP",e[e.ROUND_UP=2]="ROUND_UP";var d=BigInt(1),h=BigInt(10),p=BigInt(100),m=Math.pow(BigInt(2),BigInt(256))-BigInt(1);function f(t,n){for(var r=0;r<n.length;r++){var e=n[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function l(t,n,r){return n&&f(t.prototype,n),r&&f(t,r),t}function g(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}var y,w=function(t,n,r){t<255||i(!1),this.decimals=t,this.symbol=n,this.name=r},I=w.ETHER=new w(18,"ETH","Ether"),v=function(t){function n(n,r,e,i,o){var a;return(a=t.call(this,e,i,o)||this).chainId=n,a.address=c(r),a}g(n,t);var r=n.prototype;return r.equals=function(t){return this===t||this.chainId===t.chainId&&this.address===t.address},r.sortsBefore=function(t){return this.chainId!==t.chainId&&i(!1),this.address===t.address&&i(!1),this.address.toLowerCase()<t.address.toLowerCase()},n}(w);function x(t,n){return t instanceof v&&n instanceof v?t.equals(n):!(t instanceof v||n instanceof v||t!==n)}var N,R,E=((y={})[exports.ChainId.MAINNET]=new v(exports.ChainId.MAINNET,"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",18,"WETH","Wrapped Ether"),y[exports.ChainId.ROPSTEN]=new v(exports.ChainId.ROPSTEN,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),y[exports.ChainId.RINKEBY]=new v(exports.ChainId.RINKEBY,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),y[exports.ChainId.GÖRLI]=new v(exports.ChainId.GÖRLI,"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",18,"WETH","Wrapped Ether"),y[exports.ChainId.KOVAN]=new v(exports.ChainId.KOVAN,"0xd0A1E359811322d97991E03f863a0C30C2cF029C",18,"WETH","Wrapped Ether"),y),O=s(a),C=s(u),U=((N={})[exports.Rounding.ROUND_DOWN]=O.ROUND_DOWN,N[exports.Rounding.ROUND_HALF_UP]=O.ROUND_HALF_UP,N[exports.Rounding.ROUND_UP]=O.ROUND_UP,N),T=((R={})[exports.Rounding.ROUND_DOWN]=0,R[exports.Rounding.ROUND_HALF_UP]=1,R[exports.Rounding.ROUND_UP]=3,R),_=function(){function t(t,n){void 0===n&&(n=d),this.numerator=BigInt(t),this.denominator=BigInt(n)}var n=t.prototype;return n.invert=function(){return new t(this.denominator,this.numerator)},n.add=function(n){var r=n instanceof t?n:new t(BigInt(n));return this.denominator===r.denominator?new t(this.numerator+r.numerator,this.denominator):new t(this.numerator*r.denominator+r.numerator*this.denominator,this.denominator*r.denominator)},n.subtract=function(n){var r=n instanceof t?n:new t(BigInt(n));return this.denominator===r.denominator?new t(this.numerator-r.numerator,this.denominator):new t(this.numerator*r.denominator-r.numerator*this.denominator,this.denominator*r.denominator)},n.lessThan=function(n){var r=n instanceof t?n:new t(BigInt(n));return this.numerator*r.denominator<r.numerator*this.denominator},n.equalTo=function(n){var r=n instanceof t?n:new t(BigInt(n));return this.numerator*r.denominator==r.numerator*this.denominator},n.greaterThan=function(n){var r=n instanceof t?n:new t(BigInt(n));return this.numerator*r.denominator>r.numerator*this.denominator},n.multiply=function(n){var r=n instanceof t?n:new t(BigInt(n));return new t(this.numerator*r.numerator,this.denominator*r.denominator)},n.divide=function(n){var r=n instanceof t?n:new t(BigInt(n));return new t(this.numerator*r.denominator,this.denominator*r.numerator)},n.toSignificant=function(t,n,r){void 0===n&&(n={groupSeparator:""}),void 0===r&&(r=exports.Rounding.ROUND_HALF_UP),Number.isInteger(t)||i(!1),t>0||i(!1),O.set({precision:t+1,rounding:U[r]});var e=new O(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(t);return e.toFormat(e.decimalPlaces(),n)},n.toFixed=function(t,n,r){return void 0===n&&(n={groupSeparator:""}),void 0===r&&(r=exports.Rounding.ROUND_HALF_UP),Number.isInteger(t)||i(!1),t>=0||i(!1),C.DP=t,C.RM=T[r],new C(this.numerator.toString()).div(this.denominator.toString()).toFormat(t,n)},l(t,[{key:"quotient",get:function(){return this.numerator/this.denominator}},{key:"remainder",get:function(){return new t(this.numerator%this.denominator,this.denominator)}}]),t}(),A=new _(p),D=function(t){function n(){return t.apply(this,arguments)||this}g(n,t);var r=n.prototype;return r.toSignificant=function(t,n,r){return void 0===t&&(t=5),this.multiply(A).toSignificant(t,n,r)},r.toFixed=function(t,n,r){return void 0===t&&(t=2),this.multiply(A).toFixed(t,n,r)},n}(_),B=s(u),P=function(t){function n(n,r){var e,o=BigInt(r);return o<m||i(!1),(e=t.call(this,o,Math.pow(h,BigInt(n.decimals)))||this).currency=n,e}g(n,t),n.ether=function(t){return new n(I,t)};var r=n.prototype;return r.add=function(t){return x(this.currency,t.currency)||i(!1),new n(this.currency,this.raw+t.raw)},r.subtract=function(t){return x(this.currency,t.currency)||i(!1),new n(this.currency,this.raw-t.raw)},r.toSignificant=function(n,r,e){return void 0===n&&(n=6),void 0===e&&(e=exports.Rounding.ROUND_DOWN),t.prototype.toSignificant.call(this,n,r,e)},r.toFixed=function(n,r,e){return void 0===n&&(n=this.currency.decimals),void 0===e&&(e=exports.Rounding.ROUND_DOWN),n<=this.currency.decimals||i(!1),t.prototype.toFixed.call(this,n,r,e)},r.toExact=function(t){return void 0===t&&(t={groupSeparator:""}),B.DP=this.currency.decimals,new B(this.numerator.toString()).div(this.denominator.toString()).toFormat(t)},l(n,[{key:"raw",get:function(){return this.numerator}}]),n}(_),F=function(t){function n(n,r){var e;return(e=t.call(this,n,r)||this).token=n,e}g(n,t);var r=n.prototype;return r.add=function(t){return this.token.equals(t.token)||i(!1),new n(this.token,this.raw+t.raw)},r.subtract=function(t){return this.token.equals(t.token)||i(!1),new n(this.token,this.raw-t.raw)},n}(P),b=function(t){function n(n,r,e,i){var o;return(o=t.call(this,i,e)||this).baseCurrency=n,o.quoteCurrency=r,o.scalar=new _(Math.pow(h,BigInt(n.decimals)),Math.pow(h,BigInt(r.decimals))),o}g(n,t);var r=n.prototype;return r.invert=function(){return new n(this.quoteCurrency,this.baseCurrency,this.numerator,this.denominator)},r.multiply=function(r){x(this.quoteCurrency,r.baseCurrency)||i(!1);var e=t.prototype.multiply.call(this,r);return new n(this.baseCurrency,r.quoteCurrency,e.denominator,e.numerator)},r.quote=function(n){return x(n.currency,this.baseCurrency)||i(!1),this.quoteCurrency instanceof v?new F(this.quoteCurrency,t.prototype.multiply.call(this,n.raw).quotient):P.ether(t.prototype.multiply.call(this,n.raw).quotient)},r.toSignificant=function(t,n,r){return void 0===t&&(t=6),this.adjusted.toSignificant(t,n,r)},r.toFixed=function(t,n,r){return void 0===t&&(t=4),this.adjusted.toFixed(t,n,r)},l(n,[{key:"raw",get:function(){return new _(this.numerator,this.denominator)}},{key:"adjusted",get:function(){return t.prototype.multiply.call(this,this.scalar)}}]),n}(_);exports.Currency=w,exports.CurrencyAmount=P,exports.ETHER=I,exports.Percent=D,exports.Price=b,exports.Token=v,exports.TokenAmount=F,exports.WETH=E,exports.currencyEquals=x,exports.sortedInsert=function(t,n,r,e){if(r>0||i(!1),t.length<=r||i(!1),0===t.length)return t.push(n),null;var o=t.length===r;if(o&&e(t[t.length-1],n)<=0)return n;for(var a=0,u=t.length;a<u;){var s=a+u>>>1;e(t[s],n)<=0?a=s+1:u=s}return t.splice(a,0,n),o?t.pop():null},exports.validateAndParseAddress=c;
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var n,r,e,i=t(require("tiny-invariant")),o=require("@ethersproject/address"),a=(t(require("tiny-warning")),t(require("decimal.js-light"))),u=t(require("big.js")),s=t(require("toformat"));(n=exports.ChainId||(exports.ChainId={}))[n.MAINNET=1]="MAINNET",n[n.ROPSTEN=3]="ROPSTEN",n[n.RINKEBY=4]="RINKEBY",n[n["GÖRLI"]=5]="GÖRLI",n[n.KOVAN=42]="KOVAN",(r=exports.TradeType||(exports.TradeType={}))[r.EXACT_INPUT=0]="EXACT_INPUT",r[r.EXACT_OUTPUT=1]="EXACT_OUTPUT",(e=exports.Rounding||(exports.Rounding={}))[e.ROUND_DOWN=0]="ROUND_DOWN",e[e.ROUND_HALF_UP=1]="ROUND_HALF_UP",e[e.ROUND_UP=2]="ROUND_UP";var c=BigInt(0),d=BigInt(1),f=BigInt(2),h=BigInt(3),p=BigInt(10),m=BigInt(100),l=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function g(t,n){for(var r=0;r<n.length;r++){var e=n[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function y(t,n,r){return n&&g(t.prototype,n),r&&g(t,r),t}function w(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}function I(t){try{return o.getAddress(t)}catch(t){i(!1)}}var v,x=function(t,n,r){t<255||i(!1),this.decimals=t,this.symbol=n,this.name=r},N=x.ETHER=new x(18,"ETH","Ether"),R=function(t){function n(n,r,e,i,o){var a;return(a=t.call(this,e,i,o)||this).chainId=n,a.address=I(r),a}w(n,t);var r=n.prototype;return r.equals=function(t){return this===t||this.chainId===t.chainId&&this.address===t.address},r.sortsBefore=function(t){return this.chainId!==t.chainId&&i(!1),this.address===t.address&&i(!1),this.address.toLowerCase()<t.address.toLowerCase()},n}(x);function E(t,n){return t instanceof R&&n instanceof R?t.equals(n):!(t instanceof R||n instanceof R||t!==n)}var O,C,U=((v={})[exports.ChainId.MAINNET]=new R(exports.ChainId.MAINNET,"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",18,"WETH","Wrapped Ether"),v[exports.ChainId.ROPSTEN]=new R(exports.ChainId.ROPSTEN,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),v[exports.ChainId.RINKEBY]=new R(exports.ChainId.RINKEBY,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),v[exports.ChainId.GÖRLI]=new R(exports.ChainId.GÖRLI,"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",18,"WETH","Wrapped Ether"),v[exports.ChainId.KOVAN]=new R(exports.ChainId.KOVAN,"0xd0A1E359811322d97991E03f863a0C30C2cF029C",18,"WETH","Wrapped Ether"),v),T=s(a),_=s(u),A=((O={})[exports.Rounding.ROUND_DOWN]=T.ROUND_DOWN,O[exports.Rounding.ROUND_HALF_UP]=T.ROUND_HALF_UP,O[exports.Rounding.ROUND_UP]=T.ROUND_UP,O),D=((C={})[exports.Rounding.ROUND_DOWN]=0,C[exports.Rounding.ROUND_HALF_UP]=1,C[exports.Rounding.ROUND_UP]=3,C),B=function(){function t(t,n){void 0===n&&(n=d),this.numerator=BigInt(t),this.denominator=BigInt(n)}var n=t.prototype;return n.invert=function(){return new t(this.denominator,this.numerator)},n.add=function(n){var r=n instanceof t?n:new t(BigInt(n));return this.denominator===r.denominator?new t(this.numerator+r.numerator,this.denominator):new t(this.numerator*r.denominator+r.numerator*this.denominator,this.denominator*r.denominator)},n.subtract=function(n){var r=n instanceof t?n:new t(BigInt(n));return this.denominator===r.denominator?new t(this.numerator-r.numerator,this.denominator):new t(this.numerator*r.denominator-r.numerator*this.denominator,this.denominator*r.denominator)},n.lessThan=function(n){var r=n instanceof t?n:new t(BigInt(n));return this.numerator*r.denominator<r.numerator*this.denominator},n.equalTo=function(n){var r=n instanceof t?n:new t(BigInt(n));return this.numerator*r.denominator==r.numerator*this.denominator},n.greaterThan=function(n){var r=n instanceof t?n:new t(BigInt(n));return this.numerator*r.denominator>r.numerator*this.denominator},n.multiply=function(n){var r=n instanceof t?n:new t(BigInt(n));return new t(this.numerator*r.numerator,this.denominator*r.denominator)},n.divide=function(n){var r=n instanceof t?n:new t(BigInt(n));return new t(this.numerator*r.denominator,this.denominator*r.numerator)},n.toSignificant=function(t,n,r){void 0===n&&(n={groupSeparator:""}),void 0===r&&(r=exports.Rounding.ROUND_HALF_UP),Number.isInteger(t)||i(!1),t>0||i(!1),T.set({precision:t+1,rounding:A[r]});var e=new T(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(t);return e.toFormat(e.decimalPlaces(),n)},n.toFixed=function(t,n,r){return void 0===n&&(n={groupSeparator:""}),void 0===r&&(r=exports.Rounding.ROUND_HALF_UP),Number.isInteger(t)||i(!1),t>=0||i(!1),_.DP=t,_.RM=D[r],new _(this.numerator.toString()).div(this.denominator.toString()).toFormat(t,n)},y(t,[{key:"quotient",get:function(){return this.numerator/this.denominator}},{key:"remainder",get:function(){return new t(this.numerator%this.denominator,this.denominator)}}]),t}(),P=new B(m),b=function(t){function n(){return t.apply(this,arguments)||this}w(n,t);var r=n.prototype;return r.toSignificant=function(t,n,r){return void 0===t&&(t=5),this.multiply(P).toSignificant(t,n,r)},r.toFixed=function(t,n,r){return void 0===t&&(t=2),this.multiply(P).toFixed(t,n,r)},n}(B),F=s(u),q=function(t){function n(n,r){var e,o=BigInt(r);return o<l||i(!1),(e=t.call(this,o,Math.pow(p,BigInt(n.decimals)))||this).currency=n,e}w(n,t),n.ether=function(t){return new n(N,t)};var r=n.prototype;return r.add=function(t){return E(this.currency,t.currency)||i(!1),new n(this.currency,this.raw+t.raw)},r.subtract=function(t){return E(this.currency,t.currency)||i(!1),new n(this.currency,this.raw-t.raw)},r.toSignificant=function(n,r,e){return void 0===n&&(n=6),void 0===e&&(e=exports.Rounding.ROUND_DOWN),t.prototype.toSignificant.call(this,n,r,e)},r.toFixed=function(n,r,e){return void 0===n&&(n=this.currency.decimals),void 0===e&&(e=exports.Rounding.ROUND_DOWN),n<=this.currency.decimals||i(!1),t.prototype.toFixed.call(this,n,r,e)},r.toExact=function(t){return void 0===t&&(t={groupSeparator:""}),F.DP=this.currency.decimals,new F(this.numerator.toString()).div(this.denominator.toString()).toFormat(t)},y(n,[{key:"raw",get:function(){return this.numerator}}]),n}(B),S=function(t){function n(n,r){var e;return(e=t.call(this,n,r)||this).token=n,e}w(n,t);var r=n.prototype;return r.add=function(t){return this.token.equals(t.token)||i(!1),new n(this.token,this.raw+t.raw)},r.subtract=function(t){return this.token.equals(t.token)||i(!1),new n(this.token,this.raw-t.raw)},n}(q),W=function(t){function n(n,r,e,i){var o;return(o=t.call(this,i,e)||this).baseCurrency=n,o.quoteCurrency=r,o.scalar=new B(Math.pow(p,BigInt(n.decimals)),Math.pow(p,BigInt(r.decimals))),o}w(n,t);var r=n.prototype;return r.invert=function(){return new n(this.quoteCurrency,this.baseCurrency,this.numerator,this.denominator)},r.multiply=function(r){E(this.quoteCurrency,r.baseCurrency)||i(!1);var e=t.prototype.multiply.call(this,r);return new n(this.baseCurrency,r.quoteCurrency,e.denominator,e.numerator)},r.quote=function(n){return E(n.currency,this.baseCurrency)||i(!1),this.quoteCurrency instanceof R?new S(this.quoteCurrency,t.prototype.multiply.call(this,n.raw).quotient):q.ether(t.prototype.multiply.call(this,n.raw).quotient)},r.toSignificant=function(t,n,r){return void 0===t&&(t=6),this.adjusted.toSignificant(t,n,r)},r.toFixed=function(t,n,r){return void 0===t&&(t=4),this.adjusted.toFixed(t,n,r)},y(n,[{key:"raw",get:function(){return new B(this.numerator,this.denominator)}},{key:"adjusted",get:function(){return t.prototype.multiply.call(this,this.scalar)}}]),n}(B);exports.Currency=x,exports.CurrencyAmount=q,exports.ETHER=N,exports.Percent=b,exports.Price=W,exports.Token=R,exports.TokenAmount=S,exports.WETH=U,exports.babylonianSqrt=function(t){var n,r=c;if(t>h)for(r=t,n=t/f+d;n<r;)r=n,n=(t/n+n)/f;else t!==c&&(r=d);return r},exports.currencyEquals=E,exports.sortedInsert=function(t,n,r,e){if(r>0||i(!1),t.length<=r||i(!1),0===t.length)return t.push(n),null;var o=t.length===r;if(o&&e(t[t.length-1],n)<=0)return n;for(var a=0,u=t.length;a<u;){var s=a+u>>>1;e(t[s],n)<=0?a=s+1:u=s}return t.splice(a,0,n),o?t.pop():null},exports.validateAndParseAddress=I;
//# sourceMappingURL=sdk-core.cjs.production.min.js.map

@@ -8,47 +8,2 @@ import invariant from 'tiny-invariant';

// `maxSize` by removing the last item
function sortedInsert(items, add, maxSize, comparator) {
!(maxSize > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, 'MAX_SIZE_ZERO') : invariant(false) : void 0; // this is an invariant because the interface cannot return multiple removed items if items.length exceeds maxSize
!(items.length <= maxSize) ? process.env.NODE_ENV !== "production" ? invariant(false, 'ITEMS_SIZE') : invariant(false) : void 0; // short circuit first item add
if (items.length === 0) {
items.push(add);
return null;
} else {
var isFull = items.length === maxSize; // short circuit if full and the additional item does not come before the last item
if (isFull && comparator(items[items.length - 1], add) <= 0) {
return add;
}
var lo = 0,
hi = items.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (comparator(items[mid], add) <= 0) {
lo = mid + 1;
} else {
hi = mid;
}
}
items.splice(lo, 0, add);
return isFull ? items.pop() : null;
}
}
function validateAndParseAddress(address) {
try {
var checksummedAddress = getAddress(address);
process.env.NODE_ENV !== "production" ? warning(address === checksummedAddress, address + " is not checksummed.") : void 0;
return checksummedAddress;
} catch (error) {
process.env.NODE_ENV !== "production" ? invariant(false, address + " is not a valid address.") : invariant(false) ;
}
}
var ChainId;

@@ -80,6 +35,9 @@

var ZERO = /*#__PURE__*/BigInt(0);
var ONE = /*#__PURE__*/BigInt(1);
var TWO = /*#__PURE__*/BigInt(2);
var THREE = /*#__PURE__*/BigInt(3);
var TEN = /*#__PURE__*/BigInt(10);
var ONE_HUNDRED = /*#__PURE__*/BigInt(100);
var MaxUint256 = /*#__PURE__*/Math.pow( /*#__PURE__*/BigInt(2), /*#__PURE__*/BigInt(256)) - /*#__PURE__*/BigInt(1);
var MaxUint256 = /*#__PURE__*/BigInt('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');

@@ -108,2 +66,12 @@ function _defineProperties(target, props) {

function validateAndParseAddress(address) {
try {
var checksummedAddress = getAddress(address);
process.env.NODE_ENV !== "production" ? warning(address === checksummedAddress, address + " is not checksummed.") : void 0;
return checksummedAddress;
} catch (error) {
process.env.NODE_ENV !== "production" ? invariant(false, address + " is not a valid address.") : invariant(false) ;
}
}
/**

@@ -532,3 +500,57 @@ * A currency is any fungible financial instrument on Ethereum, including Ether and all ERC20 tokens.

export { ChainId, Currency, CurrencyAmount, ETHER, Percent, Price, Rounding, Token, TokenAmount, TradeType, WETH, currencyEquals, sortedInsert, validateAndParseAddress };
// `maxSize` by removing the last item
function sortedInsert(items, add, maxSize, comparator) {
!(maxSize > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, 'MAX_SIZE_ZERO') : invariant(false) : void 0; // this is an invariant because the interface cannot return multiple removed items if items.length exceeds maxSize
!(items.length <= maxSize) ? process.env.NODE_ENV !== "production" ? invariant(false, 'ITEMS_SIZE') : invariant(false) : void 0; // short circuit first item add
if (items.length === 0) {
items.push(add);
return null;
} else {
var isFull = items.length === maxSize; // short circuit if full and the additional item does not come before the last item
if (isFull && comparator(items[items.length - 1], add) <= 0) {
return add;
}
var lo = 0,
hi = items.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (comparator(items[mid], add) <= 0) {
lo = mid + 1;
} else {
hi = mid;
}
}
items.splice(lo, 0, add);
return isFull ? items.pop() : null;
}
}
function babylonianSqrt(y) {
var z = ZERO;
var x;
if (y > THREE) {
z = y;
x = y / TWO + ONE;
while (x < z) {
z = x;
x = (y / x + x) / TWO;
}
} else if (y !== ZERO) {
z = ONE;
}
return z;
}
export { ChainId, Currency, CurrencyAmount, ETHER, Percent, Price, Rounding, Token, TokenAmount, TradeType, WETH, babylonianSqrt, currencyEquals, sortedInsert, validateAndParseAddress };
//# sourceMappingURL=sdk-core.esm.js.map
{
"name": "@uniswap/sdk-core",
"license": "MIT",
"version": "1.0.0",
"version": "1.0.1",
"description": "⚒️ An SDK for building applications on top of Uniswap V3",

@@ -6,0 +6,0 @@ "main": "dist/index.js",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc