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

fix(fungible): add CLI command to query system contract #1252

Merged
merged 5 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion docs/openapi/openapi.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27889,7 +27889,7 @@ paths:
- Query
/zeta-chain/zetacore/fungible/system_contract:
get:
summary: Queries a ZetaDepositAndCallContract by index.
summary: Queries SystemContract
operationId: Query_SystemContract
responses:
"200":
Expand Down
2 changes: 1 addition & 1 deletion proto/fungible/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ service Query {
option (google.api.http).get = "/zeta-chain/zetacore/fungible/foreign_coins";
}

// Queries a ZetaDepositAndCallContract by index.
// Queries SystemContract
rpc SystemContract(QueryGetSystemContractRequest) returns (QueryGetSystemContractResponse) {
option (google.api.http).get = "/zeta-chain/zetacore/fungible/system_contract";
}
Expand Down
1 change: 1 addition & 0 deletions x/fungible/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func GetQueryCmd(_ string) *cobra.Command {
CmdShowForeignCoins(),
CmdGasStabilityPoolAddress(),
CmdGasStabilityPoolBalance(),
CmdSystemContract(),
)

return cmd
Expand Down
32 changes: 32 additions & 0 deletions x/fungible/client/cli/query_system_contract.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package cli

import (
"context"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/fungible/types"
)

func CmdSystemContract() *cobra.Command {
cmd := &cobra.Command{
Use: "system-contract",
Short: "query system contract",
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)

res, err := queryClient.SystemContract(context.Background(), &types.QueryGetSystemContractRequest{})
if err != nil {
return err
}

return clientCtx.PrintProto(res)
},
}

flags.AddQueryFlagsToCmd(cmd)

return cmd
}
4 changes: 2 additions & 2 deletions x/fungible/types/query.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading