> For the complete documentation index, see [llms.txt](https://bitprotocol.gitbook.io/bitprotocol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bitprotocol.gitbook.io/bitprotocol/resources/technical-documentation/bridgeadapter.md).

# BridgeAdapter

Vialabs Bridge Adapter

## **Write Methods**

```
function bridge(
    uint256 _destChainId, 
    address _recipient, 
    uint256 _amount, 
    bytes memory _approval
) external onlyActiveChain(_destChainId) returns (uint256 _txId)
```

Burns tokens on the source chain and sends a cross-chain message to mint them on the destination chain.

| **Parameter**  | **Type**  | **Description**                                                     |
| -------------- | --------- | ------------------------------------------------------------------- |
| `_destChainId` | `uint256` | Chain ID of the destination blockchain where tokens will be minted. |
| `_recipient`   | `address` | Address on the destination chain to receive the bridged tokens.     |
| `_amount`      | `uint256` | Amount of tokens to bridge (before fees).                           |
| `_approval`    | `bytes`   | Optional approval signature if `requireApproval` is enabled.        |

**Returns:**

| **Value** | **Type**  | **Description**                            |
| --------- | --------- | ------------------------------------------ |
| `_txId`   | `uint256` | Transaction ID of the cross-chain message. |

## **View Methods**

```
function fee(uint256 _amount) public view returns (uint256)
```

Calculates the fee for bridging a given amount (returns the higher of flat or percentage fee).

| **Parameter** | **Type**  | **Description**                            |
| ------------- | --------- | ------------------------------------------ |
| `_amount`     | `uint256` | Amount of tokens to calculate the fee for. |

**Returns:**

| **Value**   | **Type**  | **Description**                                         |
| ----------- | --------- | ------------------------------------------------------- |
| `feeAmount` | `uint256` | Higher of flat fee or `(_amount * percentFee / 10000)`. |

## Structs

## Events
