UNPKG

@cowprotocol/cow-sdk

Version:

## 📚 [Docs website](https://docs.cow.fi/)

63 lines (62 loc) • 2.63 kB
import { BungeeQuoteResult } from './BungeeBridgeProvider'; import { BungeeQuoteWithBuildTx } from './types'; import { ethers, Signer } from 'ethers'; import { BungeeBridge } from './types'; import { QuoteBridgeRequest } from '../../types'; import { SignerLike } from '../../../common'; /** * Convert a QuoteBridgeRequest to a BungeeQuoteResult * @param request - The QuoteBridgeRequest to convert * @param slippageBps * @param bungeeQuoteWithBuildTx * @returns The BungeeQuoteResult */ export declare function toBridgeQuoteResult(request: QuoteBridgeRequest, slippageBps: number, bungeeQuoteWithBuildTx: BungeeQuoteWithBuildTx): BungeeQuoteResult; /** * Decodes the txData from Bungee API * @param txData - The txData to decode * @returns The routeId and encoded function data */ export declare function decodeBungeeBridgeTxData(txData: string): { routeId: string; encodedFunctionData: string; functionSelector: string; }; export declare function applyBps(amount: bigint, bps: number): bigint; export declare function calculateFeeBps(feeAmountBig: bigint, amountBig: bigint): number; /** * Converts an object to URLSearchParams, handling arrays by joining values with commas * @param params Object to convert to URLSearchParams * @returns URLSearchParams instance * * @example * const params = { * userAddress: '0x123', * includeBridges: ['across', 'cctp'] * } * const searchParams = objectToSearchParams(params) * Results in: ?userAddress=0x123&includeBridges=across,cctp */ export declare function objectToSearchParams(params: object): URLSearchParams; export declare function getSignerForChainId(chainId: number, signer: SignerLike): Promise<Signer>; export declare function fetchTokenAllowance(params: { chainId: number; tokenAddress: string; ownerAddress: string; spenderAddress: string; signer: SignerLike; }): Promise<bigint>; export declare function getErc20Contract(tokenAddress: string, signer?: ethers.Signer | ethers.providers.Provider): ethers.Contract; export declare const getBungeeBridgeFromDisplayName: (displayName: string) => BungeeBridge | undefined; export declare const getDisplayNameFromBungeeBridge: (bridge: BungeeBridge) => string | undefined; export declare const decodeAmountsBungeeTxData: (txData: string, bridge: BungeeBridge) => { inputAmountBytes: string; inputAmountBigNumber: ethers.BigNumber; outputAmountBytes: string; outputAmountBigNumber: ethers.BigNumber; } | { inputAmountBytes: string; inputAmountBigNumber: ethers.BigNumber; outputAmountBytes?: undefined; outputAmountBigNumber?: undefined; };