UNPKG

@f5i23q999d/cow-sdk

Version:

<p align="center"> <img width="400" src="https://github.com/cowprotocol/cow-sdk/raw/main/docs/images/CoW.png" /> </p>

28 lines (27 loc) 1.38 kB
import { LimitTradeParametersFromQuote, TradeParameters } from './types.js'; import { OrderQuoteResponse, QuoteAmountsAndCosts } from '../order-book/index.js'; import { SupportedChainId } from '../chains/index.js'; 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, orderParameters, }: { quoteParameters: TradeParameters; orderParameters: TradeParameters; }): TradeParameters; /** * ETH-flow orders are special and need to be adjusted * 1. Sell token should be the wrapped native currency * 2. Default slippage is 2% */ export declare function adjustEthFlowOrderParams(chainId: SupportedChainId, params: TradeParameters | LimitTradeParametersFromQuote): typeof params;