UNPKG

@cowprotocol/cow-sdk

Version:

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

68 lines (67 loc) • 2.92 kB
import { AcrossStatus, BungeeBuildTx, BungeeEvent, BungeeQuote, BungeeQuoteAPIRequest, BungeeQuoteWithBuildTx, SocketRequest, SupportedBridge } from './types'; import { SignerLike, TokenInfo } from '../../../common'; import { SupportedChainId, TargetChainId } from '../../../chains'; import { BuyTokensParams } from '../../types'; export interface BungeeApiOptions { apiBaseUrl?: string; manualApiBaseUrl?: string; eventsApiBaseUrl?: string; acrossApiBaseUrl?: string; includeBridges?: SupportedBridge[]; } interface IntermediateTokensParams { fromChainId: SupportedChainId; toChainId: TargetChainId; toTokenAddress: string; includeBridges?: SupportedBridge[]; } export declare class BungeeApi { private readonly options; constructor(options?: BungeeApiOptions); validateBridges(includeBridges: SupportedBridge[]): void; getBuyTokens(params: BuyTokensParams, bridgeParams?: { includeBridges?: SupportedBridge[]; }): Promise<TokenInfo[]>; getIntermediateTokens(params: IntermediateTokensParams): Promise<TokenInfo[]>; /** * Makes a GET request to Bungee APIs for quote and build tx */ getBungeeQuoteWithBuildTx(params: BungeeQuoteAPIRequest): Promise<BungeeQuoteWithBuildTx>; /** * Makes a GET request to Bungee APIs for quote * https://docs.bungee.exchange/bungee-api/api-reference/bungee-controller-quote-v-1 */ getBungeeQuote(params: BungeeQuoteAPIRequest): Promise<BungeeQuote>; /** * Makes a GET request to Bungee APIs for build tx * https://docs.bungee.exchange/bungee-api/api-reference/bungee-controller-build-tx-v-1 */ getBungeeBuildTx(quote: BungeeQuote): Promise<BungeeBuildTx>; /** * Verifies the build tx data for a quote using the SocketVerifier contract * @param quote - The quote object * @param buildTx - The build tx object * @param signer - The signer object * @returns True if the build tx data is valid, false otherwise */ verifyBungeeBuildTx(quote: BungeeQuote, buildTx: BungeeBuildTx, signer: SignerLike): Promise<boolean>; /** * Verifies the bungee tx data using the SocketVerifier contract * @param originChainId - The origin chain id * @param txData - The tx data * @param routeId - The route id * @param expectedSocketRequest - The expected socket request * @param signer - The signer object * @returns True if the bungee tx data is valid, false otherwise */ verifyBungeeBuildTxData(originChainId: SupportedChainId, txData: string, routeId: string, expectedSocketRequest: SocketRequest, signer: SignerLike): Promise<boolean>; getEvents(params: { orderId: string; } | { txHash: string; }): Promise<BungeeEvent[]>; getAcrossStatus(depositTxHash: string): Promise<AcrossStatus>; private getSupportedBridges; private makeApiCall; } export {};