@cowprotocol/cow-sdk
Version:
## 📚 [Docs website](https://docs.cow.fi/)
36 lines (35 loc) • 1.24 kB
TypeScript
import { QuoteAmountsAndCosts } from './types';
import { type OrderParameters } from './generated';
export interface QuoteAmountsAndCostsParams {
orderParams: OrderParameters;
sellDecimals: number;
buyDecimals: number;
slippagePercentBps: number;
partnerFeeBps: number | undefined;
}
export declare function getQuoteAmountsWithCosts(params: {
sellDecimals: number;
buyDecimals: number;
orderParams: OrderParameters;
}): {
isSell: boolean;
quotePrice: number;
sellAmountAfterNetworkCosts: bigint;
buyAmountAfterNetworkCosts: bigint;
buyAmountBeforeNetworkCosts: bigint;
networkCostAmount: bigint;
sellAmountBeforeNetworkCosts: bigint;
};
export declare function getQuoteAmountsAndCosts(params: QuoteAmountsAndCostsParams): QuoteAmountsAndCosts;
type BigNumber = {
big: bigint;
num: number;
};
/**
* BigInt works well with subtraction and addition, but it's not very good with multiplication and division
* To multiply/divide token amounts we have to convert them to numbers, but we have to be careful with precision
* @param value
* @param decimals
*/
export declare function getBigNumber(value: string | bigint | number, decimals: number): BigNumber;
export {};