Skip to main content

Class: AcrossBridgeProvider

Implementsโ€‹

Constructorsโ€‹

constructorโ€‹

โ€ข new AcrossBridgeProvider(options): AcrossBridgeProvider

Parametersโ€‹

NameType
optionsAcrossBridgeProviderOptions

Returnsโ€‹

AcrossBridgeProvider

Defined inโ€‹

external/cow-sdk/src/bridging/providers/across/AcrossBridgeProvider.ts:68

Propertiesโ€‹

apiโ€‹

โ€ข Protected api: AcrossApi

Defined inโ€‹

external/cow-sdk/src/bridging/providers/across/AcrossBridgeProvider.ts:62


cowShedSdkโ€‹

โ€ข Protected cowShedSdk: CowShedSdk

Defined inโ€‹

external/cow-sdk/src/bridging/providers/across/AcrossBridgeProvider.ts:63


getRpcProviderโ€‹

โ€ข getRpcProvider: (chainId: SupportedChainId) => JsonRpcProvider

Type declarationโ€‹

โ–ธ (chainId): JsonRpcProvider

Parametersโ€‹
NameType
chainIdSupportedChainId
Returnsโ€‹

JsonRpcProvider

Implementation ofโ€‹

BridgeProvider.getRpcProvider

Defined inโ€‹

external/cow-sdk/src/bridging/providers/across/AcrossBridgeProvider.ts:64


infoโ€‹

โ€ข info: BridgeProviderInfo

Implementation ofโ€‹

BridgeProvider.info

Defined inโ€‹

external/cow-sdk/src/bridging/providers/across/AcrossBridgeProvider.ts:74


supportedTokensโ€‹

โ€ข Private supportedTokens: null | SupportedTokensState = null

Defined inโ€‹

external/cow-sdk/src/bridging/providers/across/AcrossBridgeProvider.ts:66

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>

Implementation ofโ€‹

BridgeProvider.decodeBridgeHook

Defined inโ€‹

external/cow-sdk/src/bridging/providers/across/AcrossBridgeProvider.ts:189


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 }>

Implementation ofโ€‹

BridgeProvider.getBridgingParams

Defined inโ€‹

external/cow-sdk/src/bridging/providers/across/AcrossBridgeProvider.ts:193


getBuyTokensโ€‹

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

Get supported tokens for a chain

Parametersโ€‹

NameType
paramsBuyTokensParams

Returnsโ€‹

Promise<GetProviderBuyTokens>

Implementation ofโ€‹

BridgeProvider.getBuyTokens

Defined inโ€‹

external/cow-sdk/src/bridging/providers/across/AcrossBridgeProvider.ts:85


getCancelBridgingTxโ€‹

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

Parametersโ€‹

NameType
_bridgingIdstring

Returnsโ€‹

Promise<EvmCall>

Implementation ofโ€‹

BridgeProvider.getCancelBridgingTx

Defined inโ€‹

external/cow-sdk/src/bridging/providers/across/AcrossBridgeProvider.ts:228


getExplorerUrlโ€‹

โ–ธ getExplorerUrl(bridgingId): string

Get the explorer url for a bridging id.

Parametersโ€‹

NameTypeDescription
bridgingIdstringThe bridging id

Returnsโ€‹

string

Implementation ofโ€‹

BridgeProvider.getExplorerUrl

Defined inโ€‹

external/cow-sdk/src/bridging/providers/across/AcrossBridgeProvider.ts:210


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
requestQuoteBridgeRequest

Returnsโ€‹

Promise<number>

Implementation ofโ€‹

BridgeProvider.getGasLimitEstimationForHook

Defined inโ€‹

external/cow-sdk/src/bridging/providers/across/AcrossBridgeProvider.ts:147


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[]>

Implementation ofโ€‹

BridgeProvider.getIntermediateTokens

Defined inโ€‹

external/cow-sdk/src/bridging/providers/across/AcrossBridgeProvider.ts:95


getNetworksโ€‹

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

Get basic supported chains

Returnsโ€‹

Promise<ChainInfo[]>

Implementation ofโ€‹

BridgeProvider.getNetworks

Defined inโ€‹

external/cow-sdk/src/bridging/providers/across/AcrossBridgeProvider.ts:81


getQuoteโ€‹

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

Get a quote for a bridge request.

Parametersโ€‹

NameTypeDescription
requestQuoteBridgeRequestThe quote request

Returnsโ€‹

Promise<AcrossQuoteResult>

Implementation ofโ€‹

BridgeProvider.getQuote

Defined inโ€‹

external/cow-sdk/src/bridging/providers/across/AcrossBridgeProvider.ts:116


getRefundBridgingTxโ€‹

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

Parametersโ€‹

NameType
_bridgingIdstring

Returnsโ€‹

Promise<EvmCall>

Implementation ofโ€‹

BridgeProvider.getRefundBridgingTx

Defined inโ€‹

external/cow-sdk/src/bridging/providers/across/AcrossBridgeProvider.ts:232


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>

Implementation ofโ€‹

BridgeProvider.getSignedHook

Defined inโ€‹

external/cow-sdk/src/bridging/providers/across/AcrossBridgeProvider.ts:151


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>

Implementation ofโ€‹

BridgeProvider.getStatus

Defined inโ€‹

external/cow-sdk/src/bridging/providers/across/AcrossBridgeProvider.ts:215


getSupportedTokensStateโ€‹

โ–ธ getSupportedTokensState(): Promise<SupportedTokensState>

Returnsโ€‹

Promise<SupportedTokensState>

Defined inโ€‹

external/cow-sdk/src/bridging/providers/across/AcrossBridgeProvider.ts:236


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
quoteAcrossQuoteResultThe quote

Returnsโ€‹

Promise<EvmCall>

The unsigned transaction details that cow-shed needs to sign

Implementation ofโ€‹

BridgeProvider.getUnsignedBridgeCall

Defined inโ€‹

external/cow-sdk/src/bridging/providers/across/AcrossBridgeProvider.ts:139