@f5i23q999d/cow-sdk
Version:
<p align="center"> <img width="400" src="https://github.com/cowprotocol/cow-sdk/raw/main/docs/images/CoW.png" /> </p>
40 lines (39 loc) • 1.94 kB
TypeScript
import { QuoteBridgeRequest } from '../../../bridging/types.js';
import { TargetChainId } from '../../../chains/index.js';
import { SuggestedFeesResponse } from './AcrossApi.js';
import { AcrossQuoteResult } from './AcrossBridgeProvider.js';
import { AcrossChainConfig } from './const/tokens.js';
/**
* 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;