Skip to main content

Router Chain iDapp Functions

To support Router's cross-chain functionality on the Router chain, CosmWasm contracts need to have router-wasm-bindings.

Adding router-wasm-bindings as a dependency

You can add the router-wasm-bindings crate to your project as shown in the following code snippet:

[dependencies]
# add the following line in the cargo.toml [dependencies] section
router-wasm-bindings = "0.2.4"

Functions

Once you have added router-wasm-bindings to your project, you can start building your cross-chain contract by implementing the following functions:

  • RouterMsg - A function to send requests to other chains. This function is akin to the iSend function for EVM chains.
  • SudoMsg - A function to handle incoming requests from the other chains, be it a generic cross-chain request or an acknowledgment. This function encapsulates the functionality of both iReceive and iAck as present on EVM contracts.

Contracts on the Router chain can also be used to enable stateful bridging between any two chains. Developers can write custom bridging logic on these contracts such that a request originating from any chain A gets processed on the Router chain contract before it is sent to the designated destination chain. More details about stateful bridging using Router have been provided here.