Class: MockBridgeProvider
Implementsโ
Constructorsโ
constructorโ
โข new MockBridgeProvider(): MockBridgeProvider
Returnsโ
Propertiesโ
infoโ
โข info: BridgeProviderInfo
Implementation ofโ
Defined inโ
external/cow-sdk/src/bridging/providers/mock/MockBridgeProvider.ts:72
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โ
Name | Type | Description |
---|---|---|
_hook | CoWHook | The bridge hook |
Returnsโ
Promise
<BridgeDeposit
>
Implementation ofโ
BridgeProvider.decodeBridgeHook
Defined inโ
external/cow-sdk/src/bridging/providers/mock/MockBridgeProvider.ts:137
getBridgingIdโ
โธ getBridgingId(_orderUid
, _settlementTx
, _logIndex
): Promise
<string
>
Get the identifier of the bridging transaction from the settlement transaction.
Parametersโ
Name | Type | Description |
---|---|---|
_orderUid | string | The unique identifier of the order |
_settlementTx | string | The settlement transaction in which the bridging post-hook was executed |
_logIndex | number | The log index of the trade within the settlement transaction |
Returnsโ
Promise
<string
>
Implementation ofโ
Defined inโ
external/cow-sdk/src/bridging/providers/mock/MockBridgeProvider.ts:159
getBuyTokensโ
โธ getBuyTokens(targetChainId
): Promise
<TokenInfo
[]>
Get supported tokens for a chain
Parametersโ
Name | Type |
---|---|
targetChainId | TargetChainId |
Returnsโ
Promise
<TokenInfo
[]>
Implementation ofโ
Defined inโ
external/cow-sdk/src/bridging/providers/mock/MockBridgeProvider.ts:81
getCancelBridgingTxโ
โธ getCancelBridgingTx(_bridgingId
): Promise
<EvmCall
>
Parametersโ
Name | Type |
---|---|
_bridgingId | string |
Returnsโ
Promise
<EvmCall
>
Implementation ofโ
BridgeProvider.getCancelBridgingTx
Defined inโ
external/cow-sdk/src/bridging/providers/mock/MockBridgeProvider.ts:174
getExplorerUrlโ
โธ getExplorerUrl(bridgingId
): string
Get the explorer url for a bridging id.
Parametersโ
Name | Type | Description |
---|---|---|
bridgingId | string | The bridging id |
Returnsโ
string
Implementation ofโ
Defined inโ
external/cow-sdk/src/bridging/providers/mock/MockBridgeProvider.ts:163
getGasLimitEstimationForHookโ
โธ getGasLimitEstimationForHook(_request
): 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:
- Hook gas costs affect the final amount
- The final amount could affect hook gas costs
By estimating gas costs independently, we can resolve this dependency cycle.
Parametersโ
Name | Type |
---|---|
_request | QuoteBridgeRequest |
Returnsโ
number
Implementation ofโ
BridgeProvider.getGasLimitEstimationForHook
Defined inโ
external/cow-sdk/src/bridging/providers/mock/MockBridgeProvider.ts:119
getIntermediateTokensโ
โธ getIntermediateTokens(ยซdestructuredยป
): Promise
<string
[]>
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โ
Name | Type | Description |
---|---|---|
ยซdestructuredยป | QuoteBridgeRequest | The quote request |
Returnsโ
Promise
<string
[]>
Implementation ofโ
BridgeProvider.getIntermediateTokens
Defined inโ
external/cow-sdk/src/bridging/providers/mock/MockBridgeProvider.ts:85
getNetworksโ
โธ getNetworks(): Promise
<ChainInfo
[]>
Get basic supported chains
Returnsโ
Promise
<ChainInfo
[]>
Implementation ofโ
Defined inโ
external/cow-sdk/src/bridging/providers/mock/MockBridgeProvider.ts:77
getQuoteโ
โธ getQuote(_request
): Promise
<BridgeQuoteResult
>
Get a quote for a bridge request.
Parametersโ
Name | Type | Description |
---|---|---|
_request | QuoteBridgeRequest | The quote request |
Returnsโ
Promise
<BridgeQuoteResult
>
Implementation ofโ
Defined inโ
external/cow-sdk/src/bridging/providers/mock/MockBridgeProvider.ts:89
getRefundBridgingTxโ
โธ getRefundBridgingTx(_bridgingId
): Promise
<EvmCall
>
Parametersโ
Name | Type |
---|---|
_bridgingId | string |
Returnsโ
Promise
<EvmCall
>
Implementation ofโ
BridgeProvider.getRefundBridgingTx
Defined inโ
external/cow-sdk/src/bridging/providers/mock/MockBridgeProvider.ts:177
getSignedHookโ
โธ getSignedHook(_chainId
, _unsignedCall
, _signer
): 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โ
Name | Type |
---|---|
_chainId | SupportedChainId |
_unsignedCall | EvmCall |
_signer | Signer |
Returnsโ
Promise
<BridgeHook
>
Implementation ofโ
Defined inโ
external/cow-sdk/src/bridging/providers/mock/MockBridgeProvider.ts:126
getStatusโ
โธ getStatus(_bridgingId
): Promise
<BridgeStatusResult
>
Get the status of a bridging transaction.
Parametersโ
Name | Type | Description |
---|---|---|
_bridgingId | string | The bridging id |
Returnsโ
Promise
<BridgeStatusResult
>
Implementation ofโ
Defined inโ
external/cow-sdk/src/bridging/providers/mock/MockBridgeProvider.ts:167
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โ
Name | Type | Description |
---|---|---|
_request | QuoteBridgeRequest | The quote request |
_quote | BridgeQuoteResult | The 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/mock/MockBridgeProvider.ts:123