@vutien/sdk-core
Advanced tools
Comparing version 0.0.3 to 0.0.4
export { CurrencyAmount } from './currencyAmount'; | ||
export { TokenAmount } from './tokenAmount'; | ||
export { Fraction } from './fraction'; | ||
export { Percent } from './percent'; | ||
export { Price } from './price'; |
@@ -309,2 +309,12 @@ 'use strict'; | ||
var TokenAmount = /*#__PURE__*/function (_CurrencyAmount) { | ||
_inheritsLoose(TokenAmount, _CurrencyAmount); | ||
function TokenAmount() { | ||
return _CurrencyAmount.apply(this, arguments) || this; | ||
} | ||
return TokenAmount; | ||
}(CurrencyAmount); | ||
var ONE_HUNDRED = /*#__PURE__*/new Fraction( /*#__PURE__*/JSBI.BigInt(100)); | ||
@@ -728,2 +738,3 @@ /** | ||
exports.Token = Token; | ||
exports.TokenAmount = TokenAmount; | ||
exports.WETH = WETH; | ||
@@ -730,0 +741,0 @@ exports.computePriceImpact = computePriceImpact; |
@@ -1,2 +0,2 @@ | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var r,e,n=t(require("jsbi")),i=t(require("tiny-invariant")),o=t(require("decimal.js-light")),a=t(require("big.js")),u=t(require("toformat")),s=require("@ethersproject/address");(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,c,p=n.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function f(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function h(t,r,e){return r&&f(t.prototype,r),e&&f(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(t,r){t.prototype=Object.create(r.prototype),t.prototype.constructor=t,(Object.setPrototypeOf||function(t,r){return t.__proto__=r,t})(t,r)}var m=u(o),y=u(a),A=((d={})[exports.Rounding.ROUND_DOWN]=m.ROUND_DOWN,d[exports.Rounding.ROUND_HALF_UP]=m.ROUND_HALF_UP,d[exports.Rounding.ROUND_UP]=m.ROUND_UP,d),N=((c={})[exports.Rounding.ROUND_DOWN]=0,c[exports.Rounding.ROUND_HALF_UP]=1,c[exports.Rounding.ROUND_UP]=3,c),T=function(){function t(t,r){void 0===r&&(r=n.BigInt(1)),this.numerator=n.BigInt(t),this.denominator=n.BigInt(r)}t.tryParseFraction=function(r){if(r instanceof n||"number"==typeof r||"string"==typeof r)return new t(r);if("numerator"in r&&"denominator"in r)return r;throw new Error("Could not parse fraction")};var r=t.prototype;return r.invert=function(){return new t(this.denominator,this.numerator)},r.add=function(r){var e=t.tryParseFraction(r);return n.equal(this.denominator,e.denominator)?new t(n.add(this.numerator,e.numerator),this.denominator):new t(n.add(n.multiply(this.numerator,e.denominator),n.multiply(e.numerator,this.denominator)),n.multiply(this.denominator,e.denominator))},r.subtract=function(r){var e=t.tryParseFraction(r);return n.equal(this.denominator,e.denominator)?new t(n.subtract(this.numerator,e.numerator),this.denominator):new t(n.subtract(n.multiply(this.numerator,e.denominator),n.multiply(e.numerator,this.denominator)),n.multiply(this.denominator,e.denominator))},r.lessThan=function(r){var e=t.tryParseFraction(r);return n.lessThan(n.multiply(this.numerator,e.denominator),n.multiply(e.numerator,this.denominator))},r.equalTo=function(r){var e=t.tryParseFraction(r);return n.equal(n.multiply(this.numerator,e.denominator),n.multiply(e.numerator,this.denominator))},r.greaterThan=function(r){var e=t.tryParseFraction(r);return n.greaterThan(n.multiply(this.numerator,e.denominator),n.multiply(e.numerator,this.denominator))},r.multiply=function(r){var e=t.tryParseFraction(r);return new t(n.multiply(this.numerator,e.numerator),n.multiply(this.denominator,e.denominator))},r.divide=function(r){var e=t.tryParseFraction(r);return new t(n.multiply(this.numerator,e.denominator),n.multiply(this.denominator,e.numerator))},r.toSignificant=function(t,r,e){void 0===r&&(r={groupSeparator:""}),void 0===e&&(e=exports.Rounding.ROUND_HALF_UP),Number.isInteger(t)||i(!1),t>0||i(!1),m.set({precision:t+1,rounding:A[e]});var n=new m(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(t);return n.toFormat(n.decimalPlaces(),r)},r.toFixed=function(t,r,e){return void 0===r&&(r={groupSeparator:""}),void 0===e&&(e=exports.Rounding.ROUND_HALF_UP),Number.isInteger(t)||i(!1),t>=0||i(!1),y.DP=t,y.RM=N[e],new y(this.numerator.toString()).div(this.denominator.toString()).toFormat(t,r)},h(t,[{key:"quotient",get:function(){return n.divide(this.numerator,this.denominator)}},{key:"remainder",get:function(){return new t(n.remainder(this.numerator,this.denominator),this.denominator)}},{key:"asFraction",get:function(){return new t(this.numerator,this.denominator)}}]),t}(),C=u(a),I=function(t){function r(r,e,o){var a;return a=t.call(this,e,o)||this,n.lessThanOrEqual(a.quotient,p)||i(!1),a.currency=r,a.decimalScale=n.exponentiate(n.BigInt(10),n.BigInt(r.decimals)),a}l(r,t),r.fromRawAmount=function(t,e){return new r(t,e)},r.fromFractionalAmount=function(t,e,n){return new r(t,e,n)};var e=r.prototype;return e.add=function(e){this.currency.equals(e.currency)||i(!1);var n=t.prototype.add.call(this,e);return r.fromFractionalAmount(this.currency,n.numerator,n.denominator)},e.subtract=function(e){this.currency.equals(e.currency)||i(!1);var n=t.prototype.subtract.call(this,e);return r.fromFractionalAmount(this.currency,n.numerator,n.denominator)},e.multiply=function(e){var n=t.prototype.multiply.call(this,e);return r.fromFractionalAmount(this.currency,n.numerator,n.denominator)},e.divide=function(e){var n=t.prototype.divide.call(this,e);return r.fromFractionalAmount(this.currency,n.numerator,n.denominator)},e.toSignificant=function(r,e,n){return void 0===r&&(r=6),void 0===n&&(n=exports.Rounding.ROUND_DOWN),t.prototype.divide.call(this,this.decimalScale).toSignificant(r,e,n)},e.toFixed=function(r,e,n){return void 0===r&&(r=this.currency.decimals),void 0===n&&(n=exports.Rounding.ROUND_DOWN),r<=this.currency.decimals||i(!1),t.prototype.divide.call(this,this.decimalScale).toFixed(r,e,n)},e.toExact=function(t){return void 0===t&&(t={groupSeparator:""}),C.DP=this.currency.decimals,new C(this.quotient.toString()).div(this.decimalScale.toString()).toFormat(t)},h(r,[{key:"wrapped",get:function(){return this.currency.isToken?this:r.fromFractionalAmount(this.currency.wrapped,this.numerator,this.denominator)}}]),r}(T),E=new T(n.BigInt(100));function x(t){return new v(t.numerator,t.denominator)}var v=function(t){function r(){var r;return(r=t.apply(this,arguments)||this).isPercent=!0,r}l(r,t);var e=r.prototype;return e.add=function(r){return x(t.prototype.add.call(this,r))},e.subtract=function(r){return x(t.prototype.subtract.call(this,r))},e.multiply=function(r){return x(t.prototype.multiply.call(this,r))},e.divide=function(r){return x(t.prototype.divide.call(this,r))},e.toSignificant=function(r,e,n){return void 0===r&&(r=5),t.prototype.multiply.call(this,E).toSignificant(r,e,n)},e.toFixed=function(r,e,n){return void 0===r&&(r=2),t.prototype.multiply.call(this,E).toFixed(r,e,n)},r}(T),g=function(t){function r(){for(var r,e,i,o,a,u=arguments.length,s=new Array(u),d=0;d<u;d++)s[d]=arguments[d];if(4===s.length)e=s[0],i=s[1],o=s[2],a=s[3];else{var c=s[0].quoteAmount.divide(s[0].baseAmount),p=[s[0].baseAmount.currency,s[0].quoteAmount.currency,c.denominator,c.numerator];e=p[0],i=p[1],o=p[2],a=p[3]}return(r=t.call(this,a,o)||this).baseCurrency=e,r.quoteCurrency=i,r.scalar=new T(n.exponentiate(n.BigInt(10),n.BigInt(e.decimals)),n.exponentiate(n.BigInt(10),n.BigInt(i.decimals))),r}l(r,t);var e=r.prototype;return e.invert=function(){return new r(this.quoteCurrency,this.baseCurrency,this.numerator,this.denominator)},e.multiply=function(e){this.quoteCurrency.equals(e.baseCurrency)||i(!1);var n=t.prototype.multiply.call(this,e);return new r(this.baseCurrency,e.quoteCurrency,n.denominator,n.numerator)},e.quote=function(r){r.currency.equals(this.baseCurrency)||i(!1);var e=t.prototype.multiply.call(this,r);return I.fromFractionalAmount(this.quoteCurrency,e.numerator,e.denominator)},e.toSignificant=function(t,r,e){return void 0===t&&(t=6),this.adjustedForDecimals.toSignificant(t,r,e)},e.toFixed=function(t,r,e){return void 0===t&&(t=4),this.adjustedForDecimals.toFixed(t,r,e)},h(r,[{key:"adjustedForDecimals",get:function(){return t.prototype.multiply.call(this,this.scalar)}}]),r}(T),O=function(t,r,e,n){Number.isSafeInteger(t)||i(!1),r>=0&&r<255&&Number.isInteger(r)||i(!1),this.chainId=t,this.decimals=r,this.symbol=e,this.name=n},R=function(t){function r(){var r;return(r=t.apply(this,arguments)||this).isNative=!0,r.isToken=!1,r}return l(r,t),r}(O);function b(t){try{return s.getAddress(t)}catch(r){throw new Error(t+" is not a valid address.")}}var F,S,w=function(t){function r(r,e,n,i,o){var a;return(a=t.call(this,r,n,i,o)||this).isNative=!1,a.isToken=!0,a.address=b(e),a}l(r,t);var e=r.prototype;return e.equals=function(t){return t.isToken&&this.chainId===t.chainId&&this.address===t.address},e.sortsBefore=function(t){return this.chainId!==t.chainId&&i(!1),this.address===t.address&&i(!1),this.address.toLowerCase()<t.address.toLowerCase()},h(r,[{key:"wrapped",get:function(){return this}}]),r}(O);(S=exports.ChainId||(exports.ChainId={}))[S.MAINNET=1]="MAINNET",S[S.ROPSTEN=3]="ROPSTEN",S[S.RINKEBY=4]="RINKEBY",S[S["GÖRLI"]=5]="GÖRLI",S[S.KOVAN=42]="KOVAN",S[S.MATIC=137]="MATIC",S[S.MUMBAI=80001]="MUMBAI",S[S.BSCTESTNET=97]="BSCTESTNET",S[S.BSCMAINNET=56]="BSCMAINNET",S[S.AVAXTESTNET=43113]="AVAXTESTNET",S[S.AVAXMAINNET=43114]="AVAXMAINNET",S[S.FANTOM=250]="FANTOM",S[S.CRONOSTESTNET=338]="CRONOSTESTNET",S[S.CRONOS=25]="CRONOS",S[S.AURORA=1313161554]="AURORA";var B=((F={})[exports.ChainId.MAINNET]=new w(exports.ChainId.MAINNET,"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",18,"WETH","Wrapped Ether"),F[exports.ChainId.ROPSTEN]=new w(exports.ChainId.ROPSTEN,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),F[exports.ChainId.RINKEBY]=new w(exports.ChainId.RINKEBY,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),F[exports.ChainId.GÖRLI]=new w(exports.ChainId.GÖRLI,"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",18,"WETH","Wrapped Ether"),F[exports.ChainId.KOVAN]=new w(exports.ChainId.KOVAN,"0xd0A1E359811322d97991E03f863a0C30C2cF029C",18,"WETH","Wrapped Ether"),F[exports.ChainId.MATIC]=new w(exports.ChainId.MATIC,"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",18,"WMATIC","Wrapped Matic"),F[exports.ChainId.MUMBAI]=new w(exports.ChainId.MUMBAI,"0x19395624C030A11f58e820C3AeFb1f5960d9742a",18,"WMATIC","Wrapped Matic"),F[exports.ChainId.BSCTESTNET]=new w(exports.ChainId.BSCTESTNET,"0xae13d989dac2f0debff460ac112a837c89baa7cd",18,"WBNB","Wrapped BNB"),F[exports.ChainId.BSCMAINNET]=new w(exports.ChainId.BSCMAINNET,"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",18,"WBNB","Wrapped BNB"),F[exports.ChainId.AVAXTESTNET]=new w(exports.ChainId.AVAXTESTNET,"0xd00ae08403B9bbb9124bB305C09058E32C39A48c",18,"WAVAX","Wrapped AVAX"),F[exports.ChainId.AVAXMAINNET]=new w(exports.ChainId.AVAXMAINNET,"0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7",18,"WAVAX","Wrapped AVAX"),F[exports.ChainId.FANTOM]=new w(exports.ChainId.FANTOM,"0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83",18,"WFTM","Wrapped Fantom"),F[exports.ChainId.CRONOSTESTNET]=new w(exports.ChainId.CRONOSTESTNET,"0x1A46dCaC1d91F1731574BEfAEDaC4E0392726e35",18,"WCRO","Wrapped CRO"),F[exports.ChainId.CRONOS]=new w(exports.ChainId.CRONOS,"0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23",18,"WCRO","Wrapped CRO"),F[exports.ChainId.AURORA]=new w(exports.ChainId.AURORA,"0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB",18,"WETH","Wrapped ETH"),F),U=function(t){function r(r){return t.call(this,r,18,"ETH","Ether")||this}return l(r,t),r.onChain=function(t){var e;return null!==(e=this._etherCache[t])&&void 0!==e?e:this._etherCache[t]=new r(t)},r.prototype.equals=function(t){return t.isNative&&t.chainId===this.chainId},h(r,[{key:"wrapped",get:function(){var t=B[this.chainId];return t||i(!1),t}}]),r}(R);U._etherCache={};var D=n.BigInt(Number.MAX_SAFE_INTEGER),P=n.BigInt(0),_=n.BigInt(1),M=n.BigInt(2);exports.CurrencyAmount=I,exports.Ether=U,exports.Fraction=T,exports.MaxUint256=p,exports.NativeCurrency=R,exports.Percent=v,exports.Price=g,exports.Token=w,exports.WETH=B,exports.computePriceImpact=function(t,r,e){var n=t.quote(r),i=n.subtract(e).divide(n);return new v(i.numerator,i.denominator)},exports.sortedInsert=function(t,r,e,n){if(e>0||i(!1),t.length<=e||i(!1),0===t.length)return t.push(r),null;var o=t.length===e;if(o&&n(t[t.length-1],r)<=0)return r;for(var a=0,u=t.length;a<u;){var s=a+u>>>1;n(t[s],r)<=0?a=s+1:u=s}return t.splice(a,0,r),o?t.pop():null},exports.sqrt=function(t){if(n.greaterThanOrEqual(t,P)||i(!1),n.lessThan(t,D))return n.BigInt(Math.floor(Math.sqrt(n.toNumber(t))));var r,e;for(r=t,e=n.add(n.divide(t,M),_);n.lessThan(e,r);)r=e,e=n.divide(n.add(n.divide(t,e),e),M);return r},exports.validateAndParseAddress=b; | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var r,e,n=t(require("jsbi")),i=t(require("tiny-invariant")),o=t(require("decimal.js-light")),a=t(require("big.js")),u=t(require("toformat")),s=require("@ethersproject/address");(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,c,p=n.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function f(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function h(t,r,e){return r&&f(t.prototype,r),e&&f(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(t,r){t.prototype=Object.create(r.prototype),t.prototype.constructor=t,(Object.setPrototypeOf||function(t,r){return t.__proto__=r,t})(t,r)}var m=u(o),y=u(a),A=((d={})[exports.Rounding.ROUND_DOWN]=m.ROUND_DOWN,d[exports.Rounding.ROUND_HALF_UP]=m.ROUND_HALF_UP,d[exports.Rounding.ROUND_UP]=m.ROUND_UP,d),N=((c={})[exports.Rounding.ROUND_DOWN]=0,c[exports.Rounding.ROUND_HALF_UP]=1,c[exports.Rounding.ROUND_UP]=3,c),T=function(){function t(t,r){void 0===r&&(r=n.BigInt(1)),this.numerator=n.BigInt(t),this.denominator=n.BigInt(r)}t.tryParseFraction=function(r){if(r instanceof n||"number"==typeof r||"string"==typeof r)return new t(r);if("numerator"in r&&"denominator"in r)return r;throw new Error("Could not parse fraction")};var r=t.prototype;return r.invert=function(){return new t(this.denominator,this.numerator)},r.add=function(r){var e=t.tryParseFraction(r);return n.equal(this.denominator,e.denominator)?new t(n.add(this.numerator,e.numerator),this.denominator):new t(n.add(n.multiply(this.numerator,e.denominator),n.multiply(e.numerator,this.denominator)),n.multiply(this.denominator,e.denominator))},r.subtract=function(r){var e=t.tryParseFraction(r);return n.equal(this.denominator,e.denominator)?new t(n.subtract(this.numerator,e.numerator),this.denominator):new t(n.subtract(n.multiply(this.numerator,e.denominator),n.multiply(e.numerator,this.denominator)),n.multiply(this.denominator,e.denominator))},r.lessThan=function(r){var e=t.tryParseFraction(r);return n.lessThan(n.multiply(this.numerator,e.denominator),n.multiply(e.numerator,this.denominator))},r.equalTo=function(r){var e=t.tryParseFraction(r);return n.equal(n.multiply(this.numerator,e.denominator),n.multiply(e.numerator,this.denominator))},r.greaterThan=function(r){var e=t.tryParseFraction(r);return n.greaterThan(n.multiply(this.numerator,e.denominator),n.multiply(e.numerator,this.denominator))},r.multiply=function(r){var e=t.tryParseFraction(r);return new t(n.multiply(this.numerator,e.numerator),n.multiply(this.denominator,e.denominator))},r.divide=function(r){var e=t.tryParseFraction(r);return new t(n.multiply(this.numerator,e.denominator),n.multiply(this.denominator,e.numerator))},r.toSignificant=function(t,r,e){void 0===r&&(r={groupSeparator:""}),void 0===e&&(e=exports.Rounding.ROUND_HALF_UP),Number.isInteger(t)||i(!1),t>0||i(!1),m.set({precision:t+1,rounding:A[e]});var n=new m(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(t);return n.toFormat(n.decimalPlaces(),r)},r.toFixed=function(t,r,e){return void 0===r&&(r={groupSeparator:""}),void 0===e&&(e=exports.Rounding.ROUND_HALF_UP),Number.isInteger(t)||i(!1),t>=0||i(!1),y.DP=t,y.RM=N[e],new y(this.numerator.toString()).div(this.denominator.toString()).toFormat(t,r)},h(t,[{key:"quotient",get:function(){return n.divide(this.numerator,this.denominator)}},{key:"remainder",get:function(){return new t(n.remainder(this.numerator,this.denominator),this.denominator)}},{key:"asFraction",get:function(){return new t(this.numerator,this.denominator)}}]),t}(),C=u(a),I=function(t){function r(r,e,o){var a;return a=t.call(this,e,o)||this,n.lessThanOrEqual(a.quotient,p)||i(!1),a.currency=r,a.decimalScale=n.exponentiate(n.BigInt(10),n.BigInt(r.decimals)),a}l(r,t),r.fromRawAmount=function(t,e){return new r(t,e)},r.fromFractionalAmount=function(t,e,n){return new r(t,e,n)};var e=r.prototype;return e.add=function(e){this.currency.equals(e.currency)||i(!1);var n=t.prototype.add.call(this,e);return r.fromFractionalAmount(this.currency,n.numerator,n.denominator)},e.subtract=function(e){this.currency.equals(e.currency)||i(!1);var n=t.prototype.subtract.call(this,e);return r.fromFractionalAmount(this.currency,n.numerator,n.denominator)},e.multiply=function(e){var n=t.prototype.multiply.call(this,e);return r.fromFractionalAmount(this.currency,n.numerator,n.denominator)},e.divide=function(e){var n=t.prototype.divide.call(this,e);return r.fromFractionalAmount(this.currency,n.numerator,n.denominator)},e.toSignificant=function(r,e,n){return void 0===r&&(r=6),void 0===n&&(n=exports.Rounding.ROUND_DOWN),t.prototype.divide.call(this,this.decimalScale).toSignificant(r,e,n)},e.toFixed=function(r,e,n){return void 0===r&&(r=this.currency.decimals),void 0===n&&(n=exports.Rounding.ROUND_DOWN),r<=this.currency.decimals||i(!1),t.prototype.divide.call(this,this.decimalScale).toFixed(r,e,n)},e.toExact=function(t){return void 0===t&&(t={groupSeparator:""}),C.DP=this.currency.decimals,new C(this.quotient.toString()).div(this.decimalScale.toString()).toFormat(t)},h(r,[{key:"wrapped",get:function(){return this.currency.isToken?this:r.fromFractionalAmount(this.currency.wrapped,this.numerator,this.denominator)}}]),r}(T),E=function(t){function r(){return t.apply(this,arguments)||this}return l(r,t),r}(I),x=new T(n.BigInt(100));function v(t){return new g(t.numerator,t.denominator)}var g=function(t){function r(){var r;return(r=t.apply(this,arguments)||this).isPercent=!0,r}l(r,t);var e=r.prototype;return e.add=function(r){return v(t.prototype.add.call(this,r))},e.subtract=function(r){return v(t.prototype.subtract.call(this,r))},e.multiply=function(r){return v(t.prototype.multiply.call(this,r))},e.divide=function(r){return v(t.prototype.divide.call(this,r))},e.toSignificant=function(r,e,n){return void 0===r&&(r=5),t.prototype.multiply.call(this,x).toSignificant(r,e,n)},e.toFixed=function(r,e,n){return void 0===r&&(r=2),t.prototype.multiply.call(this,x).toFixed(r,e,n)},r}(T),O=function(t){function r(){for(var r,e,i,o,a,u=arguments.length,s=new Array(u),d=0;d<u;d++)s[d]=arguments[d];if(4===s.length)e=s[0],i=s[1],o=s[2],a=s[3];else{var c=s[0].quoteAmount.divide(s[0].baseAmount),p=[s[0].baseAmount.currency,s[0].quoteAmount.currency,c.denominator,c.numerator];e=p[0],i=p[1],o=p[2],a=p[3]}return(r=t.call(this,a,o)||this).baseCurrency=e,r.quoteCurrency=i,r.scalar=new T(n.exponentiate(n.BigInt(10),n.BigInt(e.decimals)),n.exponentiate(n.BigInt(10),n.BigInt(i.decimals))),r}l(r,t);var e=r.prototype;return e.invert=function(){return new r(this.quoteCurrency,this.baseCurrency,this.numerator,this.denominator)},e.multiply=function(e){this.quoteCurrency.equals(e.baseCurrency)||i(!1);var n=t.prototype.multiply.call(this,e);return new r(this.baseCurrency,e.quoteCurrency,n.denominator,n.numerator)},e.quote=function(r){r.currency.equals(this.baseCurrency)||i(!1);var e=t.prototype.multiply.call(this,r);return I.fromFractionalAmount(this.quoteCurrency,e.numerator,e.denominator)},e.toSignificant=function(t,r,e){return void 0===t&&(t=6),this.adjustedForDecimals.toSignificant(t,r,e)},e.toFixed=function(t,r,e){return void 0===t&&(t=4),this.adjustedForDecimals.toFixed(t,r,e)},h(r,[{key:"adjustedForDecimals",get:function(){return t.prototype.multiply.call(this,this.scalar)}}]),r}(T),R=function(t,r,e,n){Number.isSafeInteger(t)||i(!1),r>=0&&r<255&&Number.isInteger(r)||i(!1),this.chainId=t,this.decimals=r,this.symbol=e,this.name=n},b=function(t){function r(){var r;return(r=t.apply(this,arguments)||this).isNative=!0,r.isToken=!1,r}return l(r,t),r}(R);function F(t){try{return s.getAddress(t)}catch(r){throw new Error(t+" is not a valid address.")}}var S,w,B=function(t){function r(r,e,n,i,o){var a;return(a=t.call(this,r,n,i,o)||this).isNative=!1,a.isToken=!0,a.address=F(e),a}l(r,t);var e=r.prototype;return e.equals=function(t){return t.isToken&&this.chainId===t.chainId&&this.address===t.address},e.sortsBefore=function(t){return this.chainId!==t.chainId&&i(!1),this.address===t.address&&i(!1),this.address.toLowerCase()<t.address.toLowerCase()},h(r,[{key:"wrapped",get:function(){return this}}]),r}(R);(w=exports.ChainId||(exports.ChainId={}))[w.MAINNET=1]="MAINNET",w[w.ROPSTEN=3]="ROPSTEN",w[w.RINKEBY=4]="RINKEBY",w[w["GÖRLI"]=5]="GÖRLI",w[w.KOVAN=42]="KOVAN",w[w.MATIC=137]="MATIC",w[w.MUMBAI=80001]="MUMBAI",w[w.BSCTESTNET=97]="BSCTESTNET",w[w.BSCMAINNET=56]="BSCMAINNET",w[w.AVAXTESTNET=43113]="AVAXTESTNET",w[w.AVAXMAINNET=43114]="AVAXMAINNET",w[w.FANTOM=250]="FANTOM",w[w.CRONOSTESTNET=338]="CRONOSTESTNET",w[w.CRONOS=25]="CRONOS",w[w.AURORA=1313161554]="AURORA";var U=((S={})[exports.ChainId.MAINNET]=new B(exports.ChainId.MAINNET,"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",18,"WETH","Wrapped Ether"),S[exports.ChainId.ROPSTEN]=new B(exports.ChainId.ROPSTEN,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),S[exports.ChainId.RINKEBY]=new B(exports.ChainId.RINKEBY,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),S[exports.ChainId.GÖRLI]=new B(exports.ChainId.GÖRLI,"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",18,"WETH","Wrapped Ether"),S[exports.ChainId.KOVAN]=new B(exports.ChainId.KOVAN,"0xd0A1E359811322d97991E03f863a0C30C2cF029C",18,"WETH","Wrapped Ether"),S[exports.ChainId.MATIC]=new B(exports.ChainId.MATIC,"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",18,"WMATIC","Wrapped Matic"),S[exports.ChainId.MUMBAI]=new B(exports.ChainId.MUMBAI,"0x19395624C030A11f58e820C3AeFb1f5960d9742a",18,"WMATIC","Wrapped Matic"),S[exports.ChainId.BSCTESTNET]=new B(exports.ChainId.BSCTESTNET,"0xae13d989dac2f0debff460ac112a837c89baa7cd",18,"WBNB","Wrapped BNB"),S[exports.ChainId.BSCMAINNET]=new B(exports.ChainId.BSCMAINNET,"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",18,"WBNB","Wrapped BNB"),S[exports.ChainId.AVAXTESTNET]=new B(exports.ChainId.AVAXTESTNET,"0xd00ae08403B9bbb9124bB305C09058E32C39A48c",18,"WAVAX","Wrapped AVAX"),S[exports.ChainId.AVAXMAINNET]=new B(exports.ChainId.AVAXMAINNET,"0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7",18,"WAVAX","Wrapped AVAX"),S[exports.ChainId.FANTOM]=new B(exports.ChainId.FANTOM,"0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83",18,"WFTM","Wrapped Fantom"),S[exports.ChainId.CRONOSTESTNET]=new B(exports.ChainId.CRONOSTESTNET,"0x1A46dCaC1d91F1731574BEfAEDaC4E0392726e35",18,"WCRO","Wrapped CRO"),S[exports.ChainId.CRONOS]=new B(exports.ChainId.CRONOS,"0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23",18,"WCRO","Wrapped CRO"),S[exports.ChainId.AURORA]=new B(exports.ChainId.AURORA,"0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB",18,"WETH","Wrapped ETH"),S),D=function(t){function r(r){return t.call(this,r,18,"ETH","Ether")||this}return l(r,t),r.onChain=function(t){var e;return null!==(e=this._etherCache[t])&&void 0!==e?e:this._etherCache[t]=new r(t)},r.prototype.equals=function(t){return t.isNative&&t.chainId===this.chainId},h(r,[{key:"wrapped",get:function(){var t=U[this.chainId];return t||i(!1),t}}]),r}(b);D._etherCache={};var P=n.BigInt(Number.MAX_SAFE_INTEGER),_=n.BigInt(0),M=n.BigInt(1),W=n.BigInt(2);exports.CurrencyAmount=I,exports.Ether=D,exports.Fraction=T,exports.MaxUint256=p,exports.NativeCurrency=b,exports.Percent=g,exports.Price=O,exports.Token=B,exports.TokenAmount=E,exports.WETH=U,exports.computePriceImpact=function(t,r,e){var n=t.quote(r),i=n.subtract(e).divide(n);return new g(i.numerator,i.denominator)},exports.sortedInsert=function(t,r,e,n){if(e>0||i(!1),t.length<=e||i(!1),0===t.length)return t.push(r),null;var o=t.length===e;if(o&&n(t[t.length-1],r)<=0)return r;for(var a=0,u=t.length;a<u;){var s=a+u>>>1;n(t[s],r)<=0?a=s+1:u=s}return t.splice(a,0,r),o?t.pop():null},exports.sqrt=function(t){if(n.greaterThanOrEqual(t,_)||i(!1),n.lessThan(t,P))return n.BigInt(Math.floor(Math.sqrt(n.toNumber(t))));var r,e;for(r=t,e=n.add(n.divide(t,W),M);n.lessThan(e,r);)r=e,e=n.divide(n.add(n.divide(t,e),e),W);return r},exports.validateAndParseAddress=F; | ||
//# sourceMappingURL=sdk-core.cjs.production.min.js.map |
@@ -309,2 +309,12 @@ import JSBI from 'jsbi'; | ||
var TokenAmount = /*#__PURE__*/function (_CurrencyAmount) { | ||
_inheritsLoose(TokenAmount, _CurrencyAmount); | ||
function TokenAmount() { | ||
return _CurrencyAmount.apply(this, arguments) || this; | ||
} | ||
return TokenAmount; | ||
}(CurrencyAmount); | ||
var ONE_HUNDRED = /*#__PURE__*/new Fraction( /*#__PURE__*/JSBI.BigInt(100)); | ||
@@ -721,3 +731,3 @@ /** | ||
export { ChainId, CurrencyAmount, Ether, Fraction, MaxUint256, NativeCurrency, Percent, Price, Rounding, Token, TradeType, WETH, computePriceImpact, sortedInsert, sqrt, validateAndParseAddress }; | ||
export { ChainId, CurrencyAmount, Ether, Fraction, MaxUint256, NativeCurrency, Percent, Price, Rounding, Token, TokenAmount, TradeType, WETH, computePriceImpact, sortedInsert, sqrt, validateAndParseAddress }; | ||
//# sourceMappingURL=sdk-core.esm.js.map |
{ | ||
"name": "@vutien/sdk-core", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "description": "🛠 An CORE SDK for building DMM SDK ver 1 + 2", |
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
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
208019
1539