@cowprotocol/cow-sdk
Version:
## 📚 [Docs website](https://docs.cow.fi/)
44 lines (43 loc) • 2.36 kB
TypeScript
import { Log } from '@ethersproject/providers';
import { BridgeStatus, QuoteBridgeRequest } from '../../types';
import { SupportedChainId, TargetChainId } from '../../../chains';
import { AcrossDepositEvent, CowTradeEvent, DepositStatusResponse, SuggestedFeesResponse } from './types';
import { AcrossQuoteResult } from './AcrossBridgeProvider';
import { AcrossChainConfig } from './const/tokens';
/**
* Return the chain configs
*
* This is a temporary implementation. We should use the Across API to get the intermediate tokens (see this.getAvailableRoutes())
*/
export declare function getChainConfigs(sourceChainId: TargetChainId, targetChainId: TargetChainId): {
sourceChainConfig: AcrossChainConfig;
targetChainConfig: AcrossChainConfig;
} | undefined;
export declare function getTokenSymbol(tokenAddress: string, chainConfig: AcrossChainConfig): string | undefined;
export declare function getTokenAddress(tokenSymbol: string, chainConfig: AcrossChainConfig): string | undefined;
export declare function toBridgeQuoteResult(request: QuoteBridgeRequest, slippageBps: number, suggestedFees: SuggestedFeesResponse): AcrossQuoteResult;
/**
* pct represents a percentage.
*
* Note: 1% is represented as 1e16, 100% is 1e18, 50% is 5e17, etc. These values are in the same format that the contract understands.
*
* Bps is a percentage in basis points (1/100th of a percent). For example, 1% is 100 bps.
*
* @param pct - The percentage to convert to bps
* @returns The percentage in bps
* @throws If the percentage is greater than 100% or less than 0%
*/
export declare function pctToBps(pct: bigint): number;
/**
* Apply a percentage fee to an amount.
*
* @param amount - The amount to apply the fee to
* @param pct - The percentage fee to apply
* @throws If the percentage fee is greater than 100% or less than 0%
* @returns The amount after the fee has been applied
*/
export declare function applyPctFee(amount: bigint, pct: bigint): bigint;
export declare function applyBps(amount: bigint, bps: number): bigint;
export declare function mapAcrossStatusToBridgeStatus(status: DepositStatusResponse['status']): BridgeStatus;
export declare function getAcrossDepositEvents(chainId: SupportedChainId, logs: Log[]): AcrossDepositEvent[];
export declare function getCowTradeEvents(chainId: SupportedChainId, logs: Log[]): CowTradeEvent[];