@saberhq/token-utils
Advanced tools
Comparing version 1.13.26 to 1.13.27
import { u64 } from "@solana/spl-token"; | ||
import type { BigintIsh } 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.js"; | ||
export type { IFormatUint } from "@ubeswap/token-math"; | ||
export interface TokenAmountObject extends FractionObject { | ||
/** | ||
* Discriminator to show this is a token amount. | ||
*/ | ||
_isTA: true; | ||
/** | ||
* Mint of the token. | ||
*/ | ||
mint: string; | ||
/** | ||
* Amount of tokens in string representation. | ||
*/ | ||
uiAmount: string; | ||
} | ||
export declare class TokenAmount extends UTokenAmount<Token> { | ||
@@ -29,16 +43,3 @@ constructor(token: Token, amount: BigintIsh); | ||
*/ | ||
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; | ||
/** | ||
@@ -45,0 +46,0 @@ * Converts this to the raw u64 used by the SPL library |
@@ -46,2 +46,3 @@ "use strict"; | ||
return { | ||
...super.toJSON(), | ||
_isTA: true, | ||
@@ -48,0 +49,0 @@ mint: this.token.address, |
import { u64 } from "@solana/spl-token"; | ||
import type { BigintIsh } 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.js"; | ||
export type { IFormatUint } from "@ubeswap/token-math"; | ||
export interface TokenAmountObject extends FractionObject { | ||
/** | ||
* Discriminator to show this is a token amount. | ||
*/ | ||
_isTA: true; | ||
/** | ||
* Mint of the token. | ||
*/ | ||
mint: string; | ||
/** | ||
* Amount of tokens in string representation. | ||
*/ | ||
uiAmount: string; | ||
} | ||
export declare class TokenAmount extends UTokenAmount<Token> { | ||
@@ -29,16 +43,3 @@ constructor(token: Token, amount: BigintIsh); | ||
*/ | ||
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; | ||
/** | ||
@@ -45,0 +46,0 @@ * Converts this to the raw u64 used by the SPL library |
@@ -42,2 +42,3 @@ import { u64 } from "@solana/spl-token"; | ||
return { | ||
...super.toJSON(), | ||
_isTA: true, | ||
@@ -44,0 +45,0 @@ mint: this.token.address, |
{ | ||
"name": "@saberhq/token-utils", | ||
"description": "Token-related math and transaction utilities for Solana.", | ||
"version": "1.13.26", | ||
"version": "1.13.27", | ||
"homepage": "https://github.com/saber-hq/saber-common/tree/master/packages/token-utils#readme", | ||
@@ -29,6 +29,6 @@ "repository": "git+https://github.com/saber-hq/saber-common.git", | ||
"dependencies": { | ||
"@saberhq/solana-contrib": "^1.13.26", | ||
"@saberhq/solana-contrib": "^1.13.27", | ||
"@solana/buffer-layout": "^4.0.0", | ||
"@solana/spl-token": "^0.1.8", | ||
"@ubeswap/token-math": "^5.1.5", | ||
"@ubeswap/token-math": "^5.1.6", | ||
"tiny-invariant": "^1.2.0", | ||
@@ -42,3 +42,3 @@ "tslib": "^2.4.0" | ||
"devDependencies": { | ||
"@saberhq/tsconfig": "^1.13.26", | ||
"@saberhq/tsconfig": "^1.13.27", | ||
"@solana/web3.js": "^1.43.5", | ||
@@ -45,0 +45,0 @@ "@types/bn.js": "^5.1.0", |
import { u64 } from "@solana/spl-token"; | ||
import type { BigintIsh } from "@ubeswap/token-math"; | ||
import type { BigintIsh, FractionObject } from "@ubeswap/token-math"; | ||
import { | ||
@@ -15,2 +15,17 @@ parseAmountFromString, | ||
export interface TokenAmountObject extends FractionObject { | ||
/** | ||
* Discriminator to show this is a token amount. | ||
*/ | ||
_isTA: true; | ||
/** | ||
* Mint of the token. | ||
*/ | ||
mint: string; | ||
/** | ||
* Amount of tokens in string representation. | ||
*/ | ||
uiAmount: string; | ||
} | ||
export class TokenAmount extends UTokenAmount<Token> { | ||
@@ -60,17 +75,5 @@ // amount _must_ be raw, i.e. in the native representation | ||
*/ | ||
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, | ||
@@ -77,0 +80,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
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
388314
5669