Skip to content

Commit

Permalink
feat(local-ic): typescript driver (#1203)
Browse files Browse the repository at this point in the history
* chore: host_port_override for all chains

* test: basic e2e in typescript with CosmJS

* e2e: local-ic ts action

* remove old js package

* chore: readme links

* tweak

* feat: full backend driver + test (cosmjs + local-ic)

* cleanup!
  • Loading branch information
Reecepbcups authored Aug 15, 2024
1 parent 7b7fea1 commit c48b82d
Show file tree
Hide file tree
Showing 15 changed files with 1,735 additions and 3 deletions.
40 changes: 39 additions & 1 deletion .github/workflows/local-interchain.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ concurrency:

env:
GO_VERSION: 1.21
NODE_JS_VERSION: v21.x

jobs:
build:
Expand All @@ -36,7 +37,6 @@ jobs:
name: local-ic
path: ~/go/bin/local-ic


rust-e2e:
name: rust
needs: build
Expand Down Expand Up @@ -117,5 +117,43 @@ jobs:
- name: Run Python Script
run: python3 ./python/${{ matrix.test[0] }}.py --api-port ${{ matrix.test[1] }}

- name: Cleanup
run: killall local-ic && exit 0

typescript-e2e:
name: typescript
needs: build
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./local-interchain

steps:
- name: checkout chain
uses: actions/checkout@v4

- name: Use Node.js ${{ env.NODE_JS_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_JS_VERSION }}

- name: npm install
run: cd ts && npm ci

- name: Download Tarball Artifact
uses: actions/download-artifact@v3
with:
name: local-ic
path: /tmp

- name: Make local-ic executable
run: chmod +x /tmp/local-ic

- name: Start background juno_ibc
run: /tmp/local-ic start juno_ibc &

- name: Run TS Script
run: cd ts && npm run start

- name: Cleanup
run: killall local-ic && exit 0
4 changes: 3 additions & 1 deletion local-interchain/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ contracts/*.wasm
!contracts/cw_ibc_example.wasm


__pycache__/
__pycache__/

node_modules/
6 changes: 5 additions & 1 deletion local-interchain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

A simple way to config and run IBC local chain testing environments with any language of choice for interaction.

## Repository CI
- [**Rust**](./rust/README.md)
- [**Typescript**](./ts/README.md)
- [**Python**](./python/README.md)

## External Repository CI

- [**Rust**](./rust/README.md)

Expand Down
5 changes: 5 additions & 0 deletions local-interchain/chains/base_ibc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
"docker_image": {
"version": "v9.1.0"
},
"host_port_override": {
"26657": "26657",
"1317": "1317",
"9090": "9090"
},
"block_time": "2s",
"gas_prices": "0%DENOM%",
"gas_adjustment": 2.0,
Expand Down
5 changes: 5 additions & 0 deletions local-interchain/chains/cosmoshub.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
"number_node": 0,
"debugging": true,
"block_time": "500ms",
"host_port_override": {
"26657": "26657",
"1317": "1317",
"9090": "9090"
},
"genesis": {
"modify": [
{
Expand Down
5 changes: 5 additions & 0 deletions local-interchain/chains/juno_ibc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
"number_vals": 1,
"number_node": 0,
"block_time": "500ms",
"host_port_override": {
"26657": "26657",
"1317": "1317",
"9090": "9090"
},
"ibc_paths": ["juno-ibc-1"],
"debugging": true,
"genesis": {
Expand Down
5 changes: 5 additions & 0 deletions local-interchain/chains/osmosis.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
"chain_id": "localosmo-1",
"denom": "uosmo",
"binary": "osmosisd",
"host_port_override": {
"26657": "26657",
"1317": "1317",
"9090": "9090"
},
"bech32_prefix": "osmo",
"docker_image": {
"version": "v25.0.0"
Expand Down
5 changes: 5 additions & 0 deletions local-interchain/chains/stargaze.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
"chain_type": "cosmos",
"coin_type": 118,
"trusting_period": "112h",
"host_port_override": {
"26657": "26657",
"1317": "1317",
"9090": "9090"
},
"gas_adjustment": 2.0,
"number_vals": 1,
"number_node": 0,
Expand Down
16 changes: 16 additions & 0 deletions local-interchain/python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Python

The python local-interchain interaction client / driver.

## Running

```bash
cd python

# or setup your own virtualenv
pip install -r requirements.txt --break-system-packages

local-ic start juno_ibc

python3 api_test.py
```
22 changes: 22 additions & 0 deletions local-interchain/ts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Typescript

Using CosmJS, you can write e2e test on top of interchaintest / local-interchain

## How to run

```bash
# install local-ic if not already
cd local-interchain
make install

# move into the typescript directory
cd ts

npm i

# starts a cosmoshub testnet on :26657
local-ic start cosmoshub

# runs a basic test
npm run start
```
Loading

0 comments on commit c48b82d

Please sign in to comment.