forked from cosmos/relayer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev-env
executable file
·60 lines (47 loc) · 1.79 KB
/
dev-env
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash -e
RELAYER_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
RELAYER_CONF="$HOME/.relayer"
GAIA_CONF="$(pwd)/data"
GAIA_DATA="$(pwd)/data"
# Ensure user understands what will be deleted
if ([[ -d $RELAYER_CONF ]] || [[ -d $GAIA_CONF ]]) && [[ ! "$1" == "skip" ]]; then
read -p "$0 will delete \$HOME/.relayer and \$(pwd)/data folder. Do you wish to continue? (y/n): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
fi
set -exu
cd $RELAYER_DIR
rm -rf $RELAYER_CONF &> /dev/null
pwd
bash scripts/one-chain gaiad ibc-0 ./data 26657 26656 6060 9090
[ -f $GAIA_DATA/ibc-0.log ] && echo "ibc-0 initialized. Watch file $GAIA_DATA/ibc-0.log to see its execution."
cd $RELAYER_DIR
echo "Building Relayer..."
make install
echo "Generating rly configurations..."
rly config init
rly config add-chains configs/demo/chains
SEED0=$(jq -r '.mnemonic' $GAIA_DATA/ibc-0/key_seed.json)
#SEED1=$(jq -r '.mnemonic' $GAIA_DATA/ibc-1/key_seed.json)
echo "Key $(rly keys restore ibc-0 testkey "$SEED0") imported from ibc-0 to relayer..."
echo "Key $(rly keys restore ibc-1 testkey "best garlic clinic panic spare supply thing various truth thing void cruel") imported from ibc-1 to relayer..."
rly config add-paths configs/demo/paths
echo "waiting for blocks..."
sleep 3
rly tx link demo -d -t 3s
sleep 2
echo "Initial balances"
echo "balance 0 $(rly q bal ibc-0)"
echo "balance 1 $(rly q bal ibc-1)"
rly tx transfer ibc-0 ibc-1 100000samoleans "$(rly keys show ibc-1)" channel-0 -d
rly tx transfer ibc-1 ibc-0 100000samoleans "$(rly keys show ibc-0)" channel-0 -d
sleep 5
rly tx relay-packets demo channel-0 -d
sleep 5
rly tx relay-acknowledgements demo channel-0 -d
sleep 5
echo "Balances after packets are sent"
echo "balance 0 $(rly q bal ibc-0)"
echo "balance 1 $(rly q bal ibc-1)"