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

# Axelar Router

This `AxRouter` contract extends the `Router` contract functionality plugging in the Axelar network to send and receive arbitrary cross-chain payloads. It extends the router to:

1. Map a standardised `chainId` to Axelar chain name as string
2. Set the Axelar-powered peer router address on each remote chain
3. Receive incoming messages and dispatch them to the correct smart contract.

{% @mermaid/diagram content="sequenceDiagram
participant SourceContract
participant AxRouter(A)
participant AxRouter(B)
participant DestContract

```
SourceContract->>AxRouter(A): send(message)
AxRouter(A)-->>AxRouter(A): revert if chain unsupported
AxRouter(A)->>AxRouter(B): relay message
AxRouter(B)-->>DestContract: Invoke onMessageReceived method
```

" %}

***

#### Events

| Event               | Parameters                                                                                                                   | Description                                                                                   |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| `PeerRouterUpdated` | <p><code>uint32 indexed chainId</code><br><code>string indexed oldRouter</code><br><code>string indexed newRouter</code></p> | Emitted when the owner changes which Axelar contract your router will call on a given chain.  |
| `AxChainStrUpdated` | <p><code>uint32 indexed chainId</code><br><code>string indexed axChainStr</code></p>                                         | Emitted when you set or update the Axelar‐chain name corresponding to your numeric `chainId`. |
| `MessageRoutedAx`   | —                                                                                                                            | Emitted immediately after dispatching a payload via Axelar’s gateway.                         |

***

#### Errors

| Error                  | When It’s Thrown                                                                                                                                            |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `UnsupportedAxChain()` | The chain isn't supported by the router.                                                                                                                    |
| `InvalidPeer()`        | If there is no peer router to send the message to for the specific chain OR if the incoming `sourceAddress` doesn’t match the owner-configured peer router. |
