-
Notifications
You must be signed in to change notification settings - Fork 9
How to reverse engineer the channel and connection IBC information
noah edited this page Apr 3, 2024
·
1 revision
Given a Polytone note contract that has been connected to a voice contract on another chain, this script will query for the channel and connection IBC information:
#!/bin/bash
NOTE=$1
LOCAL_CONNECTION=$(BINARY q wasm contract-state smart $NOTE '"pair"' --output json | jq '.data.connection_id' | tr -d '"')
LOCAL_CHANNEL=$(BINARY q wasm contract-state smart $NOTE '"active_channel"' --output json | jq '.data' | tr -d '"')
REMOTE_CONNECTION=$(BINARY q ibc connection end $LOCAL_CONNECTION --output json | jq '.connection.counterparty.connection_id' | tr -d '"')
REMOTE_CHANNEL=$(BINARY q ibc channel end wasm.$NOTE $LOCAL_CHANNEL --output json | jq '.channel.counterparty.channel_id' | tr -d '"')
echo "NOTE: $NOTE"
echo
echo "LOCAL_CONNECTION: $LOCAL_CONNECTION"
echo "REMOTE_CONNECTION: $REMOTE_CONNECTION"
echo
echo "LOCAL_CHANNEL: $LOCAL_CHANNEL"
echo "REMOTE_CHANNEL: $REMOTE_CHANNEL"
Usage: ./script.sh NOTE_CONTRACT
Make sure to replace BINARY
with the chain binary, such as kujirad
.