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

[Chore] Add QueryBlockValidation #79

Closed
wants to merge 1 commit into from
Closed
Changes from all 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
16 changes: 16 additions & 0 deletions cosmos/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,22 @@ func (node *Node) QueryModuleAccount(ctx context.Context, moduleName string) (*M
return &moduleAccount, nil
}

// QueryModuleAccount returns the result for validate block height
func (node *Node) QueryBlockValidation(ctx context.Context, blockHight string) (string, error) {
command := []string{"curl", fmt.Sprintf("http://%s:26657/block_validated?height=%s", node.HostName(), blockHight)}
stdout, stderr, err := node.Exec(ctx, command, nil)

if err != nil {
return "", fmt.Errorf("failed to query block validation (stderr=%q): %w", stderr, err)
}
var result string
if err := json.Unmarshal(stdout, &result); err != nil {
return "", fmt.Errorf("block validation result response unmarshal failed: %w", err)
}

return result, nil
}

// QueryEscrowAddress returns the escrow address of a given channel.
func (node *Node) QueryEscrowAddress(ctx context.Context, portID, channelID string) (string, error) {
stdout, _, err := node.ExecQuery(ctx, "ibc-transfer", "escrow-address", portID, channelID, "--output=json")
Expand Down