@cowprotocol/cow-sdk
Version:
## 📚 [Docs website](https://docs.cow.fi/)
28 lines (27 loc) • 1.44 kB
TypeScript
import { LimitTradeParametersFromQuote, TradeParameters } from '../types';
import { OrderQuoteResponse, QuoteAmountsAndCosts } from '../../order-book';
import { SupportedChainId } from '../../chains';
export declare function swapParamsToLimitOrderParams(params: TradeParameters, quoteResponse: OrderQuoteResponse): LimitTradeParametersFromQuote;
export declare function getIsEthFlowOrder(params: {
sellToken: string;
}): boolean;
/**
* Returns the gas value plus a margin for unexpected or variable gas costs (20%)
* @param value the gas value to pad
*/
export declare function calculateGasMargin(value: bigint): bigint;
export declare function mapQuoteAmountsAndCosts<T, R>(value: QuoteAmountsAndCosts<T>, mapper: (value: T) => R): QuoteAmountsAndCosts<R>;
/**
* Set sell token to the initial one
* Because for ETH-flow orders we do quote requests with wrapped token
*/
export declare function getTradeParametersAfterQuote({ quoteParameters, sellToken, }: {
quoteParameters: TradeParameters;
sellToken: string;
}): TradeParameters;
/**
* ETH-flow orders are special and need to be adjusted
* 1. Sell token should be the wrapped native currency
*/
export declare function adjustEthFlowOrderParams(chainId: SupportedChainId, params: TradeParameters): TradeParameters;
export declare function adjustEthFlowOrderParams(chainId: SupportedChainId, params: LimitTradeParametersFromQuote): LimitTradeParametersFromQuote;