generated from okp4/template-oss
-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #568 from okp4/fix/cli-logic-query
- Loading branch information
Showing
12 changed files
with
200 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
## okp4d tx logic | ||
|
||
Transactions commands for the logic module | ||
|
||
``` | ||
okp4d tx logic [flags] | ||
``` | ||
|
||
### Options | ||
|
||
``` | ||
-h, --help help for logic | ||
``` | ||
|
||
### SEE ALSO | ||
|
||
* [okp4d tx](okp4d_tx.md) - Transactions subcommands | ||
* [okp4d tx logic update-params](okp4d_tx_logic_update-params.md) - Execute the UpdateParams RPC method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
## okp4d tx logic update-params | ||
|
||
Execute the UpdateParams RPC method | ||
|
||
``` | ||
okp4d tx logic update-params [flags] | ||
``` | ||
|
||
### Options | ||
|
||
``` | ||
-a, --account-number uint The account number of the signing account (offline mode only) | ||
--aux Generate aux signer data instead of sending a tx | ||
-b, --broadcast-mode string Transaction broadcasting mode (sync|async) (default "sync") | ||
--chain-id string The network chain ID | ||
--dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible) | ||
--fee-granter string Fee granter grants fees for the transaction | ||
--fee-payer string Fee payer pays fees for the transaction instead of deducting from the signer | ||
--fees string Fees to pay along with transaction; eg: 10uatom | ||
--from string Name or address of private key with which to sign | ||
--gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically. Note: "auto" option doesn't always report accurate results. Set a valid coin value to adjust the result. Can be used instead of "fees". (default 200000) | ||
--gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1) | ||
--gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) | ||
--generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) | ||
-h, --help help for update-params | ||
--keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) (default "os") | ||
--keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used | ||
--ledger Use a connected Ledger device | ||
--node string <host>:<port> to CometBFT rpc interface for this chain (default "tcp://localhost:26657") | ||
--note string Note to add a description to the transaction (previously --memo) | ||
--offline Offline mode (does not allow any online functionality) | ||
-o, --output string Output format (text|json) (default "json") | ||
--params logic.v1beta2.Params (json) | ||
-s, --sequence uint The sequence number of the signing account (offline mode only) | ||
--sign-mode string Choose sign mode (direct|amino-json|direct-aux|textual), this is an advanced feature | ||
--timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height | ||
--tip string Tip is the amount that is going to be transferred to the fee payer on the target chain. This flag is only valid when used with --aux, and is ignored if the target chain didn't enable the TipDecorator | ||
-y, --yes Skip tx broadcasting prompt confirmation | ||
``` | ||
|
||
### SEE ALSO | ||
|
||
* [okp4d tx logic](okp4d_tx_logic.md) - Transactions commands for the logic module |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package cli | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/cosmos/cosmos-sdk/client" | ||
|
||
"github.com/okp4/okp4d/x/logic/types" | ||
) | ||
|
||
// GetQueryCmd returns the cli query commands for this module. | ||
func GetQueryCmd() *cobra.Command { | ||
// Group logic queries under a subcommand | ||
cmd := &cobra.Command{ | ||
Use: types.ModuleName, | ||
Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), | ||
DisableFlagParsing: true, | ||
SuggestionsMinimumDistance: 2, | ||
RunE: client.ValidateCmd, | ||
} | ||
|
||
cmd.AddCommand(CmdQueryParams()) | ||
cmd.AddCommand(CmdQueryAsk()) | ||
|
||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package cli | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/cosmos/cosmos-sdk/client/flags" | ||
"github.com/cosmos/cosmos-sdk/version" | ||
|
||
"github.com/okp4/okp4d/x/logic/types" | ||
) | ||
|
||
var program string | ||
|
||
func CmdQueryAsk() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "ask [query]", | ||
Short: "executes a logic query and returns the solutions found.", | ||
Long: `Executes the [query] and return the solution(s) found. | ||
Optionally, a program can be transmitted, which will be interpreted before the query is processed. | ||
Since the query is without any side-effect, the query is not executed in the context of a transaction and no fee | ||
is charged for this, but the execution is constrained by the current limits configured in the module (that you can | ||
query).`, | ||
Example: fmt.Sprintf(`$ %s query %s ask "chain_id(X)." # returns the chain-id`, | ||
version.AppName, | ||
types.ModuleName), | ||
Args: cobra.MinimumNArgs(1), | ||
RunE: func(cmd *cobra.Command, args []string) (err error) { | ||
clientCtx := client.GetClientContextFromCmd(cmd) | ||
query := args[0] | ||
queryClient := types.NewQueryServiceClient(clientCtx) | ||
|
||
res, err := queryClient.Ask(context.Background(), &types.QueryServiceAskRequest{ | ||
Program: program, | ||
Query: query, | ||
}) | ||
if err != nil { | ||
return | ||
} | ||
|
||
return clientCtx.PrintProto(res) | ||
}, | ||
} | ||
|
||
cmd.Flags().StringVar( | ||
&program, | ||
"program", | ||
"", | ||
`reads the program from the given string.`) | ||
|
||
flags.AddQueryFlagsToCmd(cmd) | ||
|
||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package cli | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/cosmos/cosmos-sdk/client/flags" | ||
|
||
"github.com/okp4/okp4d/x/logic/types" | ||
) | ||
|
||
func CmdQueryParams() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "params", | ||
Short: "shows the parameters of the module", | ||
Args: cobra.NoArgs, | ||
RunE: func(cmd *cobra.Command, _ []string) error { | ||
clientCtx := client.GetClientContextFromCmd(cmd) | ||
|
||
queryClient := types.NewQueryServiceClient(clientCtx) | ||
|
||
res, err := queryClient.Params(context.Background(), &types.QueryServiceParamsRequest{}) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return clientCtx.PrintProto(res) | ||
}, | ||
} | ||
|
||
flags.AddQueryFlagsToCmd(cmd) | ||
|
||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.