Examples

TODO: cleanup links from old monorepo

Example Code

This repository has several examples one can use to build understanding around Cross-Chain Applications.

xApp Template

circle-exclamation

This is a templatearrow-up-right provided by the Nomad team that shows the high-level components of an xApp, ready for one to fill in their own application logic and utilize a Nomad channel for cross-chain communication.

To implement a xApp, define the actions you would like to execute across chains. For each type of action,

  • In the xApp Routerarrow-up-right:

    • implement a function like doTypeA to initiate the action from one domain to another (add your own parameters and logic)

    • implement a corresponding _handle function to receive, parse, and execute this type of message on the remote domain

    • add logic to the handle function to route incoming messages to the appropriate _handle function

  • In the Message libraryarrow-up-right:

    • implement functions to format the message to send to the other chain (encodes all necessary information for the action)

    • implement functions to parse the message once it is received on the other chain (decode all necessary information for the action)

Connection Management

The router implements the XappConnectionClientarrow-up-right abstract contract. This contract provides convenience functions for working with a XAppConnectionManagerarrow-up-right.

See the section on Connection Management.

Last updated