Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: ibc related cmd is not supported #113

Merged
merged 5 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
- [#109](https://github.com/crypto-com/pystarport/pull/109) add feegrants in relayer config
- [#110](https://github.com/crypto-com/pystarport/pull/110) add event_query_tx_for to allow subscribe and wait for transaction.
- [#112](https://github.com/crypto-com/pystarport/pull/112) add cmd for migrate keystore.
- [#](https://github.com/crypto-com/pystarport/pull/) support ibc related cmd.
mmsqe marked this conversation as resolved.
Show resolved Hide resolved


*Feb 7, 2023*

Expand Down
9 changes: 9 additions & 0 deletions pystarport/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,15 @@ def event_query_tx_for(self, hash, i=0):
def migrate_keystore(self, i=0):
return self.cosmos_cli(i).migrate_keystore()

def ibc_query_channels(self, connid, i=0):
return self.cosmos_cli(i).ibc_query_channels(connid)

def icaauth_register_account(self, connid, i=0):
return self.cosmos_cli(i).icaauth_register_account(connid)

def icaauth_submit_tx(self, connid, tx, timeout_duration="1h", i=0):
return self.cosmos_cli(i).icaauth_submit_tx(connid, tx, timeout_duration)


def start_cluster(data_dir):
cmd = [
Expand Down
62 changes: 62 additions & 0 deletions pystarport/cosmoscli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,3 +1070,65 @@ def event_query_tx_for(self, hash):

def migrate_keystore(self):
return self.raw("keys", "migrate", home=self.data_dir)

def ibc_query_channels(self, connid, **kwargs):
default_kwargs = {
"node": self.node_rpc,
"output": "json",
}
return json.loads(
self.raw(
"q",
"ibc",
"channel",
"connections",
connid,
**(default_kwargs | kwargs),
)
)

def icaauth_register_account(self, connid, **kwargs):
"execute on host chain to attach an account to the connection"
default_kwargs = {
"home": self.data_dir,
"node": self.node_rpc,
"chain_id": self.chain_id,
"keyring_backend": "test",
}
rsp = json.loads(
self.raw(
"tx",
"icaauth",
"register-account",
connid,
"-y",
**(default_kwargs | kwargs),
)
)
if rsp["code"] == 0:
rsp = self.event_query_tx_for(rsp["txhash"])
return rsp

def icaauth_submit_tx(self, connid, tx, timeout_duration="1h", **kwargs):
default_kwargs = {
"home": self.data_dir,
"node": self.node_rpc,
"chain_id": self.chain_id,
"keyring_backend": "test",
}
rsp = json.loads(
self.raw(
"tx",
"icaauth",
"submit-tx",
connid,
tx,
"--timeout-duration" if timeout_duration else None,
timeout_duration if timeout_duration else None,
"-y",
**(default_kwargs | kwargs),
)
)
if rsp["code"] == 0:
rsp = self.event_query_tx_for(rsp["txhash"])
return rsp
Loading