Skip to content

Commit

Permalink
chore: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
npty committed Dec 8, 2023
1 parent 49e80f5 commit bbd6f95
Showing 1 changed file with 74 additions and 4 deletions.
78 changes: 74 additions & 4 deletions packages/axelar-local-dev-cosmos/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Axelar Local Dev Cosmos

> Note: This package is under development and may have unstable functionalities.
## Prerequisite

- Make sure you have running Docker in your local machine.
- Docker running on your local machine.

## Start Wasm and Axelar Chain
## Quick Start

This step will take some time because it need to pull the docker image, setup the chains, and IBC connections.
### Start Wasm and Axelar Chain

All you have to do is run the following command:
Run the following command to pull the Docker image, set up the chains, and establish IBC connections:

```bash
npm run start
Expand All @@ -19,3 +23,69 @@ import { startAll } from "@axelar-network/axelar-local-dev-cosmos";

startAll();
```

## Run IBC Relayer and Axelar Event Listener

Now, you have to run the Axelar Listener to keep listening to incoming IBC events from IBC Relayer which relays message from Wasm chain to Axelar chain.

1. **Run IBC Relayer** to relay messages periodically:

```ts
const {
IBCRelayerService,
} = require("@axelar-network/axelar-local-dev-cosmos");

const ibcRelayer = await IBCRelayerService.create();
await ibcRelayer.setup();
await ibcRelayer.runInterval();
```

2. **Run Axelar Relayer Service** to keep listening to incoming events:

```ts
import {
defaultAxelarChainInfo,
AxelarRelayerService,
} from "@axelar-network/axelar-local-dev-cosmos";

const axelarRelayerService = await AxelarRelayerService.create(
defaultAxelarChainInfo
);

await axelarRelayerService.listenForEvents();
```

### Relaying Messages

After submitting a message from `Ethereum` or `Wasm` chain, use the relay function:

```ts
import { evmRelayer } from "@axelar-network/axelar-local-dev";
import {
defaultAxelarChainInfo,
AxelarRelayerService,
} from "@axelar-network/axelar-local-dev-cosmos";

// Setup for Ethereum Network and Wasm chain relayer
const evmNetwork = await createNetwork({ name: "Ethereum" });
const wasmRelayer = await AxelarRelayerService.create(defaultAxelarChainInfo);

// Deploy contracts, send message, and call relay function
// ...

// evmRelayer is initialized prior to export.
await relay({
wasm: wasmRelayer,
evm: evmRelayer,
});

// Verify results on the destination chain
// ...
```

### Examples

- Currently, we support Ethereum as the destination chain for messages from the Wasm chain.
- See our [Local E2E Test](src/__tests__/e2e/relayer.e2e.ts) and [Axelar Example](https://github.com/axelarnetwork/axelar-examples/tree/feat/add-cosmos-examples/examples/cosmos/call-contract) for implementation details.

> The Local E2E test utilizes the same contracts as in the Axelar Examples.

0 comments on commit bbd6f95

Please sign in to comment.