New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@saberhq/spl-token

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@saberhq/spl-token - npm Package Compare versions

Comparing version 0.1.0-beta.5 to 0.1.0-beta.6

22

dist/spl-token.cjs.development.js

@@ -205,2 +205,24 @@ 'use strict';

return new splToken.u64(this.raw.toString());
}
/**
* Multiplies this token amount by a percent.
* WARNING: this loses precision
* @param percent
* @returns
*/
;
_proto.multiplyBy = function multiplyBy(percent) {
return new TokenAmount(this.token, percent.asFraction.multiply(this.raw).toFixed(0));
}
/**
* Reduces this token amount by a percent.
* WARNING: this loses precision
* @param percent
* @returns
*/
;
_proto.reduceBy = function reduceBy(percent) {
return this.multiplyBy(new tokenMath.Percent(1, 1).subtract(percent));
};

@@ -207,0 +229,0 @@

2

dist/spl-token.cjs.production.min.js

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

"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var e=t(require("jsbi")),n=require("@ubeswap/token-math"),r=t(require("tiny-invariant")),o=require("@solana/spl-token"),i=require("@solana/web3.js"),a=t(require("bn.js")),u=e.BigInt("0xffffffffffffffff"),s=e.BigInt(0),c=e.BigInt(1),l=e.BigInt(10);function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function d(t,e,n){return e&&f(t.prototype,e),n&&f(t,n),t}function p(){return(p=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function h(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,(Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var y=function(t,e){return void 0!==t&&void 0!==e&&t.mintAccount.equals(e.mintAccount)&&t.cluster===e.cluster},m={tokenSymbol:"SOL",tokenName:"Solana",icon:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/solana/info/logo.png",mintAccount:o.NATIVE_MINT,decimals:Math.log10(i.LAMPORTS_PER_SOL)},v={"mainnet-beta":p({},m,{cluster:"mainnet-beta"}),devnet:p({},m,{cluster:"devnet"}),testnet:p({},m,{cluster:"testnet"})};function g(t){return t instanceof e?t:e.BigInt("bigint"==typeof t||t instanceof o.u64||t instanceof a?t.toString():t)}var b=function(t){return e.exponentiate(l,e.BigInt(t))};function k(t){e.greaterThanOrEqual(t,s)||r(!1),e.lessThanOrEqual(t,u)||r(!1)}var w=function(t){function i(e,n){var r,o=g(n);return k(o),(r=t.call(this,o,b(e.decimals))||this).token=void 0,r.token=e,r}h(i,t);var a=i.prototype;return a.toSignificant=function(e,r,o){return void 0===e&&(e=6),void 0===o&&(o=n.Rounding.ROUND_DOWN),t.prototype.toSignificant.call(this,e,r,o)},a.toFixed=function(e,o,i){return void 0===e&&(e=this.token.decimals),void 0===i&&(i=n.Rounding.ROUND_DOWN),e<=this.token.decimals||r(!1),t.prototype.toFixed.call(this,e,o,i)},a.toExact=function(t){return void 0===t&&(t={groupSeparator:""}),n.Big.DP=this.token.decimals,new n.Big(this.numerator).div(this.denominator.toString()).toFormat(t)},a.add=function(t){return y(this.token,t.token)||r(!1),new i(this.token,e.add(this.raw,t.raw))},a.subtract=function(t){return y(this.token,t.token)||r(!1),new i(this.token,e.subtract(this.raw,t.raw))},a.divideByAmount=function(t){y(this.token,t.token)||r(!1);var e=this.divide(t);return new n.Percent(e.numerator,e.denominator)},a.divideBy=function(t){var e=this.divide(t);return new n.Percent(e.numerator,e.denominator)},a.toU64=function(){return new o.u64(this.raw.toString())},d(i,[{key:"raw",get:function(){return this.numerator}}]),i}(n.Fraction),O=function(t){function e(e,r,o,i){var a;return(a=t.call(this,g(i),g(o))||this).baseCurrency=void 0,a.quoteCurrency=void 0,a.scalar=void 0,a.baseCurrency=e,a.quoteCurrency=r,a.scalar=new n.Fraction(b(e.decimals),b(r.decimals)),a}h(e,t);var o=e.prototype;return o.invert=function(){return new e(this.quoteCurrency,this.baseCurrency,this.numerator,this.denominator)},o.multiply=function(n){y(this.quoteCurrency,n.baseCurrency)||r(!1);var o=t.prototype.multiply.call(this,n);return new e(this.baseCurrency,n.quoteCurrency,o.denominator,o.numerator)},o.quote=function(e){return y(e.token,this.baseCurrency)||r(!1),new w(this.quoteCurrency,t.prototype.multiply.call(this,e.raw).quotient)},o.toSignificant=function(t,e,n){return void 0===t&&(t=6),this.adjusted.toSignificant(t,e,n)},o.toFixed=function(t,e,n){return void 0===t&&(t=4),this.adjusted.toFixed(t,e,n)},d(e,[{key:"raw",get:function(){return new n.Fraction(this.numerator,this.denominator)}},{key:"adjusted",get:function(){return t.prototype.multiply.call(this,this.scalar)}}]),e}(n.Fraction);exports.MAX_U64=u,exports.ONE=c,exports.Price=O,exports.SOL=v,exports.TEN=l,exports.TokenAmount=w,exports.ZERO=s,exports.makeDecimalMultiplier=b,exports.parseBigintIsh=g,exports.tokensEqual=y,exports.validateU64=k;
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var n=t(require("jsbi")),e=require("@ubeswap/token-math"),r=t(require("tiny-invariant")),i=require("@solana/spl-token"),o=require("@solana/web3.js"),u=t(require("bn.js")),a=n.BigInt("0xffffffffffffffff"),s=n.BigInt(0),c=n.BigInt(1),l=n.BigInt(10);function f(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function d(t,n,e){return n&&f(t.prototype,n),e&&f(t,e),t}function p(){return(p=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t}).apply(this,arguments)}function h(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,(Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var y=function(t,n){return void 0!==t&&void 0!==n&&t.mintAccount.equals(n.mintAccount)&&t.cluster===n.cluster},m={tokenSymbol:"SOL",tokenName:"Solana",icon:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/solana/info/logo.png",mintAccount:i.NATIVE_MINT,decimals:Math.log10(o.LAMPORTS_PER_SOL)},v={"mainnet-beta":p({},m,{cluster:"mainnet-beta"}),devnet:p({},m,{cluster:"devnet"}),testnet:p({},m,{cluster:"testnet"})};function g(t){return t instanceof n?t:n.BigInt("bigint"==typeof t||t instanceof i.u64||t instanceof u?t.toString():t)}var b=function(t){return n.exponentiate(l,n.BigInt(t))};function w(t){n.greaterThanOrEqual(t,s)||r(!1),n.lessThanOrEqual(t,a)||r(!1)}var k=function(t){function o(n,e){var r,i=g(e);return w(i),(r=t.call(this,i,b(n.decimals))||this).token=void 0,r.token=n,r}h(o,t);var u=o.prototype;return u.toSignificant=function(n,r,i){return void 0===n&&(n=6),void 0===i&&(i=e.Rounding.ROUND_DOWN),t.prototype.toSignificant.call(this,n,r,i)},u.toFixed=function(n,i,o){return void 0===n&&(n=this.token.decimals),void 0===o&&(o=e.Rounding.ROUND_DOWN),n<=this.token.decimals||r(!1),t.prototype.toFixed.call(this,n,i,o)},u.toExact=function(t){return void 0===t&&(t={groupSeparator:""}),e.Big.DP=this.token.decimals,new e.Big(this.numerator).div(this.denominator.toString()).toFormat(t)},u.add=function(t){return y(this.token,t.token)||r(!1),new o(this.token,n.add(this.raw,t.raw))},u.subtract=function(t){return y(this.token,t.token)||r(!1),new o(this.token,n.subtract(this.raw,t.raw))},u.divideByAmount=function(t){y(this.token,t.token)||r(!1);var n=this.divide(t);return new e.Percent(n.numerator,n.denominator)},u.divideBy=function(t){var n=this.divide(t);return new e.Percent(n.numerator,n.denominator)},u.toU64=function(){return new i.u64(this.raw.toString())},u.multiplyBy=function(t){return new o(this.token,t.asFraction.multiply(this.raw).toFixed(0))},u.reduceBy=function(t){return this.multiplyBy(new e.Percent(1,1).subtract(t))},d(o,[{key:"raw",get:function(){return this.numerator}}]),o}(e.Fraction),x=function(t){function n(n,r,i,o){var u;return(u=t.call(this,g(o),g(i))||this).baseCurrency=void 0,u.quoteCurrency=void 0,u.scalar=void 0,u.baseCurrency=n,u.quoteCurrency=r,u.scalar=new e.Fraction(b(n.decimals),b(r.decimals)),u}h(n,t);var i=n.prototype;return i.invert=function(){return new n(this.quoteCurrency,this.baseCurrency,this.numerator,this.denominator)},i.multiply=function(e){y(this.quoteCurrency,e.baseCurrency)||r(!1);var i=t.prototype.multiply.call(this,e);return new n(this.baseCurrency,e.quoteCurrency,i.denominator,i.numerator)},i.quote=function(n){return y(n.token,this.baseCurrency)||r(!1),new k(this.quoteCurrency,t.prototype.multiply.call(this,n.raw).quotient)},i.toSignificant=function(t,n,e){return void 0===t&&(t=6),this.adjusted.toSignificant(t,n,e)},i.toFixed=function(t,n,e){return void 0===t&&(t=4),this.adjusted.toFixed(t,n,e)},d(n,[{key:"raw",get:function(){return new e.Fraction(this.numerator,this.denominator)}},{key:"adjusted",get:function(){return t.prototype.multiply.call(this,this.scalar)}}]),n}(e.Fraction);exports.MAX_U64=a,exports.ONE=c,exports.Price=x,exports.SOL=v,exports.TEN=l,exports.TokenAmount=k,exports.ZERO=s,exports.makeDecimalMultiplier=b,exports.parseBigintIsh=g,exports.tokensEqual=y,exports.validateU64=w;
//# sourceMappingURL=spl-token.cjs.production.min.js.map

@@ -201,2 +201,24 @@ import JSBI from 'jsbi';

return new u64(this.raw.toString());
}
/**
* Multiplies this token amount by a percent.
* WARNING: this loses precision
* @param percent
* @returns
*/
;
_proto.multiplyBy = function multiplyBy(percent) {
return new TokenAmount(this.token, percent.asFraction.multiply(this.raw).toFixed(0));
}
/**
* Reduces this token amount by a percent.
* WARNING: this loses precision
* @param percent
* @returns
*/
;
_proto.reduceBy = function reduceBy(percent) {
return this.multiplyBy(new Percent(1, 1).subtract(percent));
};

@@ -203,0 +225,0 @@

@@ -33,2 +33,16 @@ import { u64 } from "@solana/spl-token";

toU64(): u64;
/**
* Multiplies this token amount by a percent.
* WARNING: this loses precision
* @param percent
* @returns
*/
multiplyBy(percent: Percent): TokenAmount;
/**
* Reduces this token amount by a percent.
* WARNING: this loses precision
* @param percent
* @returns
*/
reduceBy(percent: Percent): TokenAmount;
}
{
"name": "@saberhq/spl-token",
"version": "0.1.0-beta.5",
"version": "0.1.0-beta.6",
"repository": "git@github.com:saber-hq/use-solana.git",

@@ -39,3 +39,3 @@ "author": "Ian Macalinao <ian@saber.so>",

},
"gitHead": "30fdba0961774f43441b419c7e71b3b152244cbb"
"gitHead": "639fb9a2bb1dedaedff2cd47cf6626fbcbfcfc62"
}

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