# Bridge API Documentation

**Purpose**: API documentation for bridge operations

---

## 🔌 RPC Endpoints

### ChainID 138

**HTTP**: `http://192.168.11.250:8545`  
**HTTPS**: `https://rpc-core.d-bis.org`  
**WebSocket**: `ws://192.168.11.250:8546`

---

## 📝 Contract Addresses

### WETH9 Bridge
```
0x89dd12025bfCD38A168455A44B400e913ED33BE2
```

### WETH10 Bridge
```
0xe0E93247376aa097dB308B92e6Ba36bA015535D0
```

### WETH9 Token
```
0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
```

### WETH10 Token
```
0xf4BB2e28688e89fCcE3c0580D37d36A7672E8A9f
```

### LINK Token
```
0x326C977E6efc84E512bB9C30f76E30c160eD06FB
```

---

## 🔧 Available Functions

### Bridge Functions

#### sendCrossChain
Send tokens cross-chain via CCIP

**Parameters**:
- `uint64 destinationChainSelector`: Destination chain selector
- `address receiver`: Receiver address on destination chain
- `uint256 amount`: Amount to send

**Example**:
```bash
cast send <BRIDGE_ADDRESS> "sendCrossChain(uint64,address,uint256)" \
  <CHAIN_SELECTOR> <RECEIVER> <AMOUNT> \
  --rpc-url $RPC_URL --private-key $PRIVATE_KEY
```

#### calculateFee
Calculate CCIP fee for transfer

**Parameters**:
- `uint64 destinationChainSelector`: Destination chain selector
- `uint256 amount`: Amount to send

**Returns**: Fee in wei

**Example**:
```bash
cast call <BRIDGE_ADDRESS> "calculateFee(uint64,uint256)" \
  <CHAIN_SELECTOR> <AMOUNT> --rpc-url $RPC_URL
```

#### destinations
Get destination bridge address for chain

**Parameters**:
- `uint64 chainSelector`: Chain selector

**Returns**: Bridge address on destination chain

**Example**:
```bash
cast call <BRIDGE_ADDRESS> "destinations(uint64)" \
  <CHAIN_SELECTOR> --rpc-url $RPC_URL
```

---

## 🌐 Chain Selectors

| Chain | Selector |
|-------|----------|
| BSC | 11344663589394136015 |
| Polygon | 4051577828743386545 |
| Avalanche | 6433500567565415381 |
| Base | 15971525489660198786 |
| Arbitrum | 4949039107694359620 |
| Optimism | 3734403246176062136 |
| Ethereum | 5009297550715157269 |

---

## 📊 Events

### CrossChainTransferInitiated

Emitted when cross-chain transfer is initiated

**Parameters**:
- `uint64 destinationChainSelector`
- `address receiver`
- `uint256 amount`

**Example**:
```bash
cast logs --address <BRIDGE_ADDRESS> \
  "CrossChainTransferInitiated(uint64,address,uint256)" \
  --rpc-url $RPC_URL
```

---

## 🧪 Testing

### Test Connectivity
```bash
cast block-number --rpc-url $RPC_URL
```

### Test Contract
```bash
cast code <CONTRACT_ADDRESS> --rpc-url $RPC_URL
```

### Test Function
```bash
cast call <CONTRACT_ADDRESS> "<function>" <args> --rpc-url $RPC_URL
```

---

**Last Updated**: $(date)

