Socket
Socket
Sign inDemoInstall

@dahlia-labs/token-utils

Package Overview
Dependencies
Maintainers
3
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dahlia-labs/token-utils - npm Package Compare versions

Comparing version 0.5.2 to 0.5.4

36

dist/cjs/tokenAmount.d.ts

@@ -1,13 +0,17 @@

import type { BigintIsh, NumberFormat } from "@ubeswap/token-math";
import type { BigintIsh, FractionObject } from "@ubeswap/token-math";
import { TokenAmount as UTokenAmount } from "@ubeswap/token-math";
import type { Token } from "./token";
export interface IFormatUint {
export interface TokenAmountObject extends FractionObject {
/**
* If specified, format this according to `toLocaleString`
* Discriminator to show this is a token amount.
*/
numberFormatOptions?: Intl.NumberFormatOptions;
_isTA: true;
/**
* Locale of the number
* Mint of the token.
*/
locale?: string;
mint: string;
/**
* Amount of tokens in string representation.
*/
uiAmount: string;
}

@@ -25,7 +29,2 @@ export declare class TokenAmount extends UTokenAmount<Token> {

/**
* Formats the token amount with units and decimal adjustment, e.g. "100.42 SOL"
* @returns
*/
formatUnits(format?: NumberFormat): string;
/**
* String representation of this token amount.

@@ -37,17 +36,4 @@ */

*/
toJSON(): {
/**
* Discriminator to show this is a token amount.
*/
_isTA: true;
/**
* Mint of the token.
*/
mint: string;
/**
* Amount of tokens in string representation.
*/
uiAmount: string;
};
toJSON(): TokenAmountObject;
}
//# sourceMappingURL=tokenAmount.d.ts.map

@@ -21,13 +21,6 @@ "use strict";

static parse(token, uiAmount) {
const prev = (0, token_math_1.parseAmountFromString)(token, uiAmount);
const prev = (0, token_math_1.parseAmountFromString)(token, uiAmount, ".", ",");
return new TokenAmount(token, prev);
}
/**
* Formats the token amount with units and decimal adjustment, e.g. "100.42 SOL"
* @returns
*/
formatUnits(format = { groupSeparator: "," }) {
return `${this.toExact(format)} ${this.token.symbol}`;
}
/**
* String representation of this token amount.

@@ -43,2 +36,3 @@ */

return {
...super.toJSON(),
_isTA: true,

@@ -45,0 +39,0 @@ mint: this.token.address,

@@ -1,13 +0,17 @@

import type { BigintIsh, NumberFormat } from "@ubeswap/token-math";
import type { BigintIsh, FractionObject } from "@ubeswap/token-math";
import { TokenAmount as UTokenAmount } from "@ubeswap/token-math";
import type { Token } from "./token";
export interface IFormatUint {
export interface TokenAmountObject extends FractionObject {
/**
* If specified, format this according to `toLocaleString`
* Discriminator to show this is a token amount.
*/
numberFormatOptions?: Intl.NumberFormatOptions;
_isTA: true;
/**
* Locale of the number
* Mint of the token.
*/
locale?: string;
mint: string;
/**
* Amount of tokens in string representation.
*/
uiAmount: string;
}

@@ -25,7 +29,2 @@ export declare class TokenAmount extends UTokenAmount<Token> {

/**
* Formats the token amount with units and decimal adjustment, e.g. "100.42 SOL"
* @returns
*/
formatUnits(format?: NumberFormat): string;
/**
* String representation of this token amount.

@@ -37,17 +36,4 @@ */

*/
toJSON(): {
/**
* Discriminator to show this is a token amount.
*/
_isTA: true;
/**
* Mint of the token.
*/
mint: string;
/**
* Amount of tokens in string representation.
*/
uiAmount: string;
};
toJSON(): TokenAmountObject;
}
//# sourceMappingURL=tokenAmount.d.ts.map

@@ -18,13 +18,6 @@ import { parseAmountFromString, TokenAmount as UTokenAmount, } from "@ubeswap/token-math";

static parse(token, uiAmount) {
const prev = parseAmountFromString(token, uiAmount);
const prev = parseAmountFromString(token, uiAmount, ".", ",");
return new TokenAmount(token, prev);
}
/**
* Formats the token amount with units and decimal adjustment, e.g. "100.42 SOL"
* @returns
*/
formatUnits(format = { groupSeparator: "," }) {
return `${this.toExact(format)} ${this.token.symbol}`;
}
/**
* String representation of this token amount.

@@ -40,2 +33,3 @@ */

return {
...super.toJSON(),
_isTA: true,

@@ -42,0 +36,0 @@ mint: this.token.address,

{
"name": "@dahlia-labs/token-utils",
"description": "Token-related math and transaction utilities.",
"version": "0.5.2",
"version": "0.5.4",
"repository": {

@@ -23,4 +23,4 @@ "type": "git",

"dependencies": {
"@dahlia-labs/celo-contrib": "^0.5.2",
"@ubeswap/token-math": "^5.1.2",
"@dahlia-labs/celo-contrib": "^0.5.4",
"@ubeswap/token-math": "^5.1.6",
"tiny-invariant": "^1.2.0",

@@ -36,3 +36,3 @@ "tslib": "^2.4.0"

"devDependencies": {
"@saberhq/tsconfig": "^1.13.24",
"@saberhq/tsconfig": "^1.13.28",
"@types/bn.js": "^5.1.0",

@@ -53,3 +53,3 @@ "jsbi": "^4.3.0"

"homepage": "https://github.com/DahliaLabs/dahlia-common#readme",
"gitHead": "04302fe3dde02511e25e9b13088e88c3dcb7327a"
"gitHead": "ae24942ba7fb8041d6aec796344f343612f44966"
}

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

import type { BigintIsh, NumberFormat } from "@ubeswap/token-math";
import type { BigintIsh, FractionObject } from "@ubeswap/token-math";
import {

@@ -9,11 +9,15 @@ parseAmountFromString,

export interface IFormatUint {
export interface TokenAmountObject extends FractionObject {
/**
* If specified, format this according to `toLocaleString`
* Discriminator to show this is a token amount.
*/
numberFormatOptions?: Intl.NumberFormatOptions;
_isTA: true;
/**
* Locale of the number
* Mint of the token.
*/
locale?: string;
mint: string;
/**
* Amount of tokens in string representation.
*/
uiAmount: string;
}

@@ -39,3 +43,3 @@

static parse(token: Token, uiAmount: string): TokenAmount {
const prev = parseAmountFromString(token, uiAmount);
const prev = parseAmountFromString(token, uiAmount, ".", ",");
return new TokenAmount(token, prev);

@@ -45,10 +49,2 @@ }

/**
* Formats the token amount with units and decimal adjustment, e.g. "100.42 SOL"
* @returns
*/
override formatUnits(format: NumberFormat = { groupSeparator: "," }): string {
return `${this.toExact(format)} ${this.token.symbol}`;
}
/**
* String representation of this token amount.

@@ -63,17 +59,5 @@ */

*/
toJSON(): {
/**
* Discriminator to show this is a token amount.
*/
_isTA: true;
/**
* Mint of the token.
*/
mint: string;
/**
* Amount of tokens in string representation.
*/
uiAmount: string;
} {
override toJSON(): TokenAmountObject {
return {
...super.toJSON(),
_isTA: true,

@@ -80,0 +64,0 @@ mint: this.token.address,

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

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