|
40 | 40 | fi |
41 | 41 | DST_OPTIONS=$(cat ${CHAIN_CONFIG} | jq -r '.chains.'${DST}'.options // empty') |
42 | 42 |
|
| 43 | +SRC_NETWORK_NAME=$(echo ${SRC_NETWORK} | cut -d. -f2) |
| 44 | +DST_NETWORK_NAME=$(echo ${DST_NETWORK} | cut -d. -f2) |
| 45 | +# Assume src is always an ICON chain |
| 46 | +if [ $SRC_NETWORK_NAME != icon ]; then |
| 47 | + echo "Source network is not an ICON-compatible chain: $SRC_NETWORK_NAME" |
| 48 | + exit 1 |
| 49 | +fi |
| 50 | +# Determine src type |
43 | 51 | if [ "x$BMV_BRIDGE" = xtrue ]; then |
44 | 52 | echo "Using Bridge mode" |
| 53 | + SRC_TYPE="icon-bridge" |
45 | 54 | else |
46 | 55 | echo "Using BTPBlock mode" |
47 | | - BMV_BRIDGE=false |
| 56 | + SRC_TYPE="icon-btpblock" |
| 57 | +fi |
| 58 | +# Determine dst type |
| 59 | +if [ $DST_NETWORK_NAME == icon ]; then |
| 60 | + DST_TYPE="icon-btpblock" |
| 61 | +else |
| 62 | + DST_TYPE="eth2-v2.0" |
48 | 63 | fi |
49 | 64 |
|
| 65 | +get_config() { |
| 66 | + if [ $# -gt 5 -a ${#6} -gt 0 ]; then |
| 67 | + echo '{ |
| 68 | + "address": "'$1'", |
| 69 | + "endpoint": "'$2'", |
| 70 | + "key_store": "'$3'", |
| 71 | + "key_password": "'$4'", |
| 72 | + "type": "'$5'", |
| 73 | + "options": '$6' |
| 74 | + }' | tr -d [:space:] |
| 75 | + else |
| 76 | + echo '{ |
| 77 | + "address": "'$1'", |
| 78 | + "endpoint": "'$2'", |
| 79 | + "key_store": "'$3'", |
| 80 | + "key_password": "'$4'", |
| 81 | + "type": "'$5'" |
| 82 | + }' | tr -d [:space:] |
| 83 | + fi |
| 84 | +} |
| 85 | +SRC_CONFIG=$(get_config "$SRC_ADDRESS" "$SRC_ENDPOINT" "$SRC_KEY_STORE" "$SRC_KEY_PASSWORD" "$SRC_TYPE" "$SRC_OPTIONS") |
| 86 | +DST_CONFIG=$(get_config "$DST_ADDRESS" "$DST_ENDPOINT" "$DST_KEY_STORE" "$DST_KEY_PASSWORD" "$DST_TYPE" "$DST_OPTIONS") |
| 87 | + |
50 | 88 | ${RELAY_BIN} \ |
| 89 | + --base_dir .relay \ |
51 | 90 | --direction both \ |
52 | | - --src.address ${SRC_ADDRESS} \ |
53 | | - --src.endpoint ${SRC_ENDPOINT} \ |
54 | | - --src.key_store ${SRC_KEY_STORE} \ |
55 | | - --src.key_password ${SRC_KEY_PASSWORD} \ |
56 | | - --src.bridge_mode=${BMV_BRIDGE} \ |
57 | | - ${SRC_OPTIONS:+--dst.options $SRC_OPTIONS} \ |
58 | | - --dst.address ${DST_ADDRESS} \ |
59 | | - --dst.endpoint ${DST_ENDPOINT} \ |
60 | | - --dst.key_store ${DST_KEY_STORE} \ |
61 | | - --dst.key_password ${DST_KEY_PASSWORD} \ |
62 | | - ${DST_OPTIONS:+--dst.options $DST_OPTIONS} \ |
| 91 | + --src_config ${SRC_CONFIG} \ |
| 92 | + --dst_config ${DST_CONFIG} \ |
63 | 93 | start |
0 commit comments