@confio/relayer v0.0.0-main-75d7ac8
ts-relayer
IBC Relayer in TypeScript
Installation
Latest stable release
https://github.com/confio/ts-relayer/releases/latest
npm i -g @confio/relayer
# with yarn
yarn global add @confio/relayerFrom main branch
Always tied with code on the main branch.
npm i -g @confio/relayer@main
# with yarn
yarn global add @confio/relayer@mainFunctionality
This will be both a isomorphic library (running in browsers and Node.js), as well as a simple binary that can run to relay packets between chains. The library is meant to be very generic as to the business logic, and you should be able to fork the relayer binary and add new functionality to it.
Please look at the spec for more information on the binary
Development
Set up local chains
To start two local blockchains, so we can test, run the following commands in two different consoles.
# in one console
./scripts/simapp/start.sh
# in another console
./scripts/wasmd/start.shWhen you are done, you can run the following in any console:
./scripts/simapp/stop.sh
./scripts/wasmd/stop.shRunning CLIs
Build the project.
yarn install
yarn buildLink the binaries so you can reference them w/o specifying the full path. Use npm since yarn has issues with setting permissions.
npm link
ibc-setup # should be available
./build/main/binary/ibc-setup/index.js # run w/o linkingCLI quick start
This is just mean for manual testing with the local CI chains defined in demo/registry.yaml. First get some keys:
ibc-setup init --src local_wasm --dest local_simapp # initializes home directory at: ~/.ibc-setup
ibc-setup keys listThen edit manual/consts.ts and place your keys in those address variables.
exports.simappAddress = 'cosmos1y6m4llfs0ruxr0p67cs748vrv40ryh9r0gaqvd';exports.wasmdAddress = 'wasm1q6cggcxghka0yj88927zqs6d2pdq58wnkptx52';
vi src/lib/manual/consts.tsSend some coins to the relayer accounts to get started:
yarn build && yarn test:unit ./src/lib/manual/fund-relayer.spec.tsNow you should see an updated balance, and can make an ics20 channel:
ibc-setup balances # show relayer account balances
ibc-setup ics20 # creates clients, connections and channelsFor example:
Created channels for connections connection-0 <=> connection-0: channel-21 (transfer) => channel-10 (custom)
^^^^^^^^^^ ^^^^^^^^^^
dest srcNow we have a channel, let's send some packets. Go back to manual/consts.ts place the proper channel ids from in the channels object. Make sure to place the channel that was listed next to (custom) on the top part. Then run a task to generate packets:
yarn build && yarn test:unit ./src/lib/manual/create-packets.spec.tsWith a connection, channel, and packets, let's start the relayer:
ibc-relayer startTesting
You must have the local blockchains running for the tests to pass.
Manually building, linting and testing:
yarn build
yarn test
# linting happens while testing, you can run it alone like this
yarn test:lintAutomatic build and test (you must watch build, as test setup watches for js changes). Code will be build and tests run everytime you save a file:
# in one console
yarn watch:build
# in another console
yarn watch:testTest Framework
I am using Ava here simply because that was automatically set up with the TypeScript helper. Rather than immediately rush to the well-known jasmine from CosmJS, I tried it out and so far like the functionality. Nice test watcher, clean error messages, and clickable links right to the failing source. Let's try this out a bit on this project.
You will want to read how to write tests and maybe a little the list of valid assertions before coding.
Protobuf
To re-build the protobuf definitions, first look at scripts/proto/env and ensure you
have set the desired Cosmos SDK tag there (eg. v0.41.0). After that, run:
./scripts/proto/get-proto.sh
./scripts/proto/define-proto.shThis will overwrite the data in src/codec with newly generated definitions. We delete the folder first
to avoid outdated artifacts, meaning any manual changes will be lost.
Changelog and Publishing
Please use Conventional Commits for all commit messages. Some basic examples:
feat(api): add client upgrade to API
docs: update README
fix(client): properly reconnect
refactor!: Rewrite public APIExamples:
# normal flow
yarn build
yarn test
yarn fix
# advanced checks
yarn cov
yarn doc
# constant builder
yarn watch:buildPublishing workflow:
yarn global add commitizen
# bump version and update changelog
yarn version
# OR do full release prep
yarn prepare-release2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago