@pancakeswap/swap-sdk-core
Version:
🛠An SDK for building applications on top of Pancakeswap.
49 lines • 2.11 kB
TypeScript
import { BigintIsh, Rounding } from '../constants';
import { Currency } from '../currency';
import { Token } from '../token';
import { CurrencyAmount } from './currencyAmount';
import { Fraction } from './fraction';
export declare class Price<TBase extends Currency, TQuote extends Currency> extends Fraction {
readonly baseCurrency: TBase;
readonly quoteCurrency: TQuote;
readonly scalar: Fraction;
/**
* Construct a price, either with the base and quote currency amount, or the
* @param args
*/
constructor(...args: [TBase, TQuote, BigintIsh, BigintIsh] | [{
baseAmount: CurrencyAmount<TBase>;
quoteAmount: CurrencyAmount<TQuote>;
}]);
/**
* Flip the price, switching the base and quote currency
*/
invert(): Price<TQuote, TBase>;
/**
* Multiply the price by another price, returning a new price. The other price must have the same base currency as this price's quote currency
* @param other the other price
*/
multiply<TOtherQuote extends Currency>(other: Price<TQuote, TOtherQuote>): Price<TBase, TOtherQuote>;
/**
* Return the amount of quote currency corresponding to a given amount of the base currency
* @param currencyAmount the amount of base currency to quote against the price
*/
quote(currencyAmount: CurrencyAmount<TBase>): CurrencyAmount<TQuote>;
/**
* Get the value scaled by decimals for formatting
* @private
*/
private get adjustedForDecimals();
toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string;
toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string;
get wrapped(): Price<Token, Token>;
/**
* Create a price from base and quote currency and a decimal string
* @param base
* @param quote
* @param value
* @returns Price<TBase, TQuote> | undefined
*/
static fromDecimal<TBase extends Currency, TQuote extends Currency>(base: TBase, quote: TQuote, value: string): Price<TBase, TQuote> | undefined;
}
//# sourceMappingURL=price.d.ts.map