Skip to main content

Interface: BridgeProvider<Q>

Type parametersโ€‹

NameType
Qextends BridgeQuoteResult

Implemented byโ€‹

Propertiesโ€‹

infoโ€‹

โ€ข info: BridgeProviderInfo

Defined inโ€‹

external/cow-sdk/src/bridging/types.ts:161

Methodsโ€‹

decodeBridgeHookโ€‹

โ–ธ decodeBridgeHook(hook): Promise<BridgeDeposit>

Decode a bridge hook into a bridge deposit information.

This method is used to recover the information about the limit order placed into the bridge locking contract. This allows to load an order from the orderbook and decode the bridging hook and understand what was the minimum buy amount the user signed to receive in the destination chain.

Parametersโ€‹

NameTypeDescription
hookCoWHookThe bridge hook

Returnsโ€‹

Promise<BridgeDeposit>

Defined inโ€‹

external/cow-sdk/src/bridging/types.ts:246


getBridgingParamsโ€‹

โ–ธ getBridgingParams(chainId, orderUid, txHash): Promise<null | { params: BridgingDepositParams ; status: BridgeStatusResult }>

Get the identifier of the bridging transaction from the settlement transaction.

Parametersโ€‹

NameTypeDescription
chainIdnumber
orderUidstringThe unique identifier of the order
txHashstringThe hash of the settlement transaction in which the bridging post-hook was executed

Returnsโ€‹

Promise<null | { params: BridgingDepositParams ; status: BridgeStatusResult }>

Defined inโ€‹

external/cow-sdk/src/bridging/types.ts:254


getBuyTokensโ€‹

โ–ธ getBuyTokens(params): Promise<GetProviderBuyTokens>

Get supported tokens for a chain

Parametersโ€‹

NameType
paramsBuyTokensParams

Returnsโ€‹

Promise<GetProviderBuyTokens>

Defined inโ€‹

external/cow-sdk/src/bridging/types.ts:173


getCancelBridgingTxโ€‹

โ–ธ getCancelBridgingTx(bridgingId): Promise<EvmCall>

Parametersโ€‹

NameType
bridgingIdstring

Returnsโ€‹

Promise<EvmCall>

Defined inโ€‹

external/cow-sdk/src/bridging/types.ts:277


getExplorerUrlโ€‹

โ–ธ getExplorerUrl(bridgingId): string

Get the explorer url for a bridging id.

Parametersโ€‹

NameTypeDescription
bridgingIdstringThe bridging id

Returnsโ€‹

string

Defined inโ€‹

external/cow-sdk/src/bridging/types.ts:265


getGasLimitEstimationForHookโ€‹

โ–ธ getGasLimitEstimationForHook(request): Promise<number>

Returns the estimated gas cost for executing the bridge hook.

This method helps calculate the final amount of tokens the user will receive more accurately. The estimation is done without the amount parameter to break a circular dependency:

  1. Hook gas costs affect the final amount
  2. The final amount could affect hook gas costs

By estimating gas costs independently, we can resolve this dependency cycle. For some providers, the extraGas flag adds a 100,000 gasโ€unit buffer to the hook (see DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION).

Parametersโ€‹

NameType
requestOmit<QuoteBridgeRequest, "amount"> & { extraGas?: number }

Returnsโ€‹

Promise<number>

Defined inโ€‹

external/cow-sdk/src/bridging/types.ts:215


getIntermediateTokensโ€‹

โ–ธ getIntermediateTokens(request): Promise<TokenInfo[]>

Get intermediate tokens given a quote request.

An intermediate token, is a token in the source chain, that could be used to bridge the tokens to the destination chain. This method returns a sorted list of tokens, they are sorted by priority, so first tokens are more likely to be more liquid.

Parametersโ€‹

NameTypeDescription
requestQuoteBridgeRequestThe quote request

Returnsโ€‹

Promise<TokenInfo[]>

Defined inโ€‹

external/cow-sdk/src/bridging/types.ts:183


getNetworksโ€‹

โ–ธ getNetworks(): Promise<ChainInfo[]>

Get basic supported chains

Returnsโ€‹

Promise<ChainInfo[]>

Defined inโ€‹

external/cow-sdk/src/bridging/types.ts:168


getQuoteโ€‹

โ–ธ getQuote(request): Promise<Q>

Get a quote for a bridge request.

Parametersโ€‹

NameTypeDescription
requestQuoteBridgeRequestThe quote request

Returnsโ€‹

Promise<Q>

Defined inโ€‹

external/cow-sdk/src/bridging/types.ts:190


getRefundBridgingTxโ€‹

โ–ธ getRefundBridgingTx(bridgingId): Promise<EvmCall>

Parametersโ€‹

NameType
bridgingIdstring

Returnsโ€‹

Promise<EvmCall>

Defined inโ€‹

external/cow-sdk/src/bridging/types.ts:281


getRpcProviderโ€‹

โ–ธ getRpcProvider(chainId): JsonRpcProvider

Parametersโ€‹

NameType
chainIdSupportedChainId

Returnsโ€‹

JsonRpcProvider

Defined inโ€‹

external/cow-sdk/src/bridging/types.ts:163


getSignedHookโ€‹

โ–ธ getSignedHook(chainId, unsignedCall, signer, bridgeHookNonce, deadline, hookGasLimit): Promise<BridgeHook>

Get a pre-authorized hook for initiating a bridge.

The hook contains the ethereum call that the trampoline contract will need to execute during the settlement to initate the bridge.

Typically, this hook will:

  • Get the balance of cow-shed account
  • Ensure the approval for the bridge lock contract is set
  • Deposit into the bridge contract

This hook will include the pre-authorization (signature) of the owner of the cow-shed account (the trader).

Parametersโ€‹

NameType
chainIdSupportedChainId
unsignedCallEvmCall
signerSigner
bridgeHookNoncestring
deadlinebigint
hookGasLimitnumber

Returnsโ€‹

Promise<BridgeHook>

Defined inโ€‹

external/cow-sdk/src/bridging/types.ts:229


getStatusโ€‹

โ–ธ getStatus(bridgingId, originChainId): Promise<BridgeStatusResult>

Get the status of a bridging transaction.

Parametersโ€‹

NameTypeDescription
bridgingIdstringThe bridging id
originChainIdSupportedChainIdid of network where funds were deposited

Returnsโ€‹

Promise<BridgeStatusResult>

Defined inโ€‹

external/cow-sdk/src/bridging/types.ts:273


getUnsignedBridgeCallโ€‹

โ–ธ getUnsignedBridgeCall(request, quote): Promise<EvmCall>

Get an unsigned bridge call for a quote.

The transaction details should be executed in the context of cow-shed account.

Parametersโ€‹

NameTypeDescription
requestQuoteBridgeRequestThe quote request
quoteQThe quote

Returnsโ€‹

Promise<EvmCall>

The unsigned transaction details that cow-shed needs to sign

Defined inโ€‹

external/cow-sdk/src/bridging/types.ts:201