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

@saberhq/token-utils

Package Overview
Dependencies
Maintainers
2
Versions
209
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@saberhq/token-utils - npm Package Compare versions

Comparing version 1.7.4 to 1.8.0

dist/cjs/ata.d.ts

17

package.json
{
"name": "@saberhq/token-utils",
"description": "Token-related math and transaction utilities for Solana.",
"version": "1.7.4",
"version": "1.8.0",
"repository": "git@github.com:saber-hq/solana-common.git",

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

"scripts": {
"build": "tsc",
"build": "tsc && tsc -P tsconfig.esm.json",
"clean": "rm -fr dist/",

@@ -19,10 +19,11 @@ "prepublishOnly": "npm run build"

"dependencies": {
"@saberhq/solana-contrib": "^1.7.4",
"@saberhq/solana-contrib": "^1.8.0",
"@solana/buffer-layout": "^3.0.0",
"@solana/spl-token": "^0.1.8",
"@ubeswap/token-math": "^4.3.0",
"@ubeswap/token-math": "^4.3.1",
"tiny-invariant": "^1.2.0",
"tslib": "^2.3.1"
},
"main": "dist/index.js",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"files": [

@@ -33,4 +34,4 @@ "dist/",

"devDependencies": {
"@solana/spl-token-registry": "^0.2.300",
"@solana/web3.js": "^1.30.2",
"@solana/spl-token-registry": "^0.2.467",
"@solana/web3.js": "^1.31.0",
"@types/bn.js": "^5.1.0",

@@ -48,3 +49,3 @@ "jsbi": "^4.1.0"

},
"gitHead": "a7c5759302c3bcd47fff25305bb643438627d725"
"gitHead": "0b76ec82acbe47ddcac6afbfb6375d33034e5695"
}

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

import type { BigintIsh } from "@ubeswap/token-math";
import { Price as UPrice } from "@ubeswap/token-math";

@@ -11,2 +12,18 @@ import invariant from "tiny-invariant";

export class Price extends UPrice<Token> {
/**
* Constructs a price.
* @param baseCurrency
* @param quoteCurrency
* @param denominator
* @param numerator
*/
public constructor(
baseCurrency: Token,
quoteCurrency: Token,
denominator: BigintIsh,
numerator: BigintIsh
) {
super(baseCurrency, quoteCurrency, denominator, numerator);
}
public override invert(): Price {

@@ -13,0 +30,0 @@ return new Price(

import { u64 } from "@solana/spl-token";
import type { BigintIsh, Percent } from "@ubeswap/token-math";
import type { BigintIsh, NumberFormat, Percent } from "@ubeswap/token-math";
import {

@@ -41,15 +41,15 @@ parseBigintIsh,

add(other: TokenAmount): TokenAmount {
override add(other: TokenAmount): TokenAmount {
const result = super.add(other);
return new TokenAmount(this.token, result.raw);
}
subtract(other: TokenAmount): TokenAmount {
override subtract(other: TokenAmount): TokenAmount {
const result = super.subtract(other);
return new TokenAmount(this.token, result.raw);
}
multiplyBy(percent: Percent): TokenAmount {
override multiplyBy(percent: Percent): TokenAmount {
const result = super.multiplyBy(percent);
return new TokenAmount(this.token, result.raw);
}
reduceBy(percent: Percent): TokenAmount {
override reduceBy(percent: Percent): TokenAmount {
const result = super.reduceBy(percent);

@@ -75,4 +75,4 @@ return new TokenAmount(this.token, result.raw);

*/
formatUnits(): string {
return `${this.toExact()} ${this.token.symbol}`;
formatUnits(format: NumberFormat = { groupSeparator: "," }): string {
return `${this.toExact(format)} ${this.token.symbol}`;
}

@@ -83,3 +83,3 @@

*/
toString(): string {
override toString(): string {
return `TokenAmount[Token=(${this.token.toString()}), amount=${this.toExact()}`;

@@ -86,0 +86,0 @@ }

@@ -6,2 +6,23 @@ import type * as tokenRegistry from "@solana/spl-token-registry";

/**
* Known origin chains.
*/
export const ORIGIN_CHAINS = [
"bitcoin",
"ethereum",
"terra",
"avalanche",
"binance",
"celo",
"polygon",
"fantom",
"polygon",
"heco",
] as const;
/**
* Known origin chains.
*/
export type OriginChain = typeof ORIGIN_CHAINS[number];
/**
* Token extensions with additional information.

@@ -29,2 +50,6 @@ */

readonly currency?: string;
/**
* If this token is a bridged token, this is the chain that the asset originates from.
*/
readonly originChain?: OriginChain;
};

@@ -31,0 +56,0 @@

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