fix: keyring-backend flag usage (#14509)
This commit is contained in:
parent
6ac0c3628e
commit
3e2dde54c5
@ -62,6 +62,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
* [#13473](https://github.com/cosmos/cosmos-sdk/pull/13473) ADR-038: Go plugin system proposal
|
||||
* [#14356](https://github.com/cosmos/cosmos-sdk/pull/14356) Add `events.GetAttributes` and `event.GetAttribute` methods to simplify the retrieval of an attribute from event(s).
|
||||
* [#14472](https://github.com/cosmos/cosmos-sdk/pull/14356) The recommended metadata format for x/gov and x/group proposals now uses an array of strings (instead of a single string) for the `authors` field.
|
||||
* (client) [#14509](https://github.com/cosmos/cosmos-sdk/pull/#14509) Added `AddKeyringFlags` function.
|
||||
|
||||
### Improvements
|
||||
|
||||
@ -237,6 +238,7 @@ extension interfaces. `module.Manager.Modules` is now of type `map[string]interf
|
||||
* (server) [#13778](https://github.com/cosmos/cosmos-sdk/pull/13778) Set Cosmos SDK default endpoints to localhost to avoid unknown exposure of endpoints.
|
||||
* (x/auth) [#13877](https://github.com/cosmos/cosmos-sdk/pull/13877) Handle missing account numbers during `InitGenesis`.
|
||||
* (ante) [#14448](https://github.com/cosmos/cosmos-sdk/pull/14448) Return anteEvents when postHandler fail.
|
||||
* (cli) [#14509](https://github.com/cosmos/cosmos-sdk/pull/#14509) Added missing options to keyring-backend flag usage
|
||||
|
||||
### Deprecated
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
tmcli "github.com/tendermint/tendermint/libs/cli"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
||||
@ -106,34 +107,40 @@ func AddQueryFlagsToCmd(cmd *cobra.Command) {
|
||||
|
||||
// AddTxFlagsToCmd adds common flags to a module tx command.
|
||||
func AddTxFlagsToCmd(cmd *cobra.Command) {
|
||||
cmd.Flags().StringP(FlagOutput, "o", "json", "Output format (text|json)")
|
||||
cmd.Flags().String(FlagKeyringDir, "", "The client Keyring directory; if omitted, the default 'home' directory will be used")
|
||||
cmd.Flags().String(FlagFrom, "", "Name or address of private key with which to sign")
|
||||
cmd.Flags().Uint64P(FlagAccountNumber, "a", 0, "The account number of the signing account (offline mode only)")
|
||||
cmd.Flags().Uint64P(FlagSequence, "s", 0, "The sequence number of the signing account (offline mode only)")
|
||||
cmd.Flags().String(FlagNote, "", "Note to add a description to the transaction (previously --memo)")
|
||||
cmd.Flags().String(FlagFees, "", "Fees to pay along with transaction; eg: 10uatom")
|
||||
cmd.Flags().String(FlagGasPrices, "", "Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom)")
|
||||
cmd.Flags().String(FlagNode, "tcp://localhost:26657", "<host>:<port> to tendermint rpc interface for this chain")
|
||||
cmd.Flags().Bool(FlagUseLedger, false, "Use a connected Ledger device")
|
||||
cmd.Flags().Float64(FlagGasAdjustment, DefaultGasAdjustment, "adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored ")
|
||||
cmd.Flags().StringP(FlagBroadcastMode, "b", BroadcastSync, "Transaction broadcasting mode (sync|async)")
|
||||
cmd.Flags().Bool(FlagDryRun, false, "ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible)")
|
||||
cmd.Flags().Bool(FlagGenerateOnly, false, "Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name)")
|
||||
cmd.Flags().Bool(FlagOffline, false, "Offline mode (does not allow any online functionality)")
|
||||
cmd.Flags().BoolP(FlagSkipConfirmation, "y", false, "Skip tx broadcasting prompt confirmation")
|
||||
cmd.Flags().String(FlagKeyringBackend, DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test|memory)")
|
||||
cmd.Flags().String(FlagSignMode, "", "Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature")
|
||||
cmd.Flags().Uint64(FlagTimeoutHeight, 0, "Set a block timeout height to prevent the tx from being committed past a certain height")
|
||||
cmd.Flags().String(FlagFeePayer, "", "Fee payer pays fees for the transaction instead of deducting from the signer")
|
||||
cmd.Flags().String(FlagFeeGranter, "", "Fee granter grants fees for the transaction")
|
||||
cmd.Flags().String(FlagTip, "", "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")
|
||||
cmd.Flags().Bool(FlagAux, false, "Generate aux signer data instead of sending a tx")
|
||||
cmd.Flags().String(FlagChainID, "", "The network chain ID")
|
||||
|
||||
f := cmd.Flags()
|
||||
f.StringP(FlagOutput, "o", "json", "Output format (text|json)")
|
||||
f.String(FlagFrom, "", "Name or address of private key with which to sign")
|
||||
f.Uint64P(FlagAccountNumber, "a", 0, "The account number of the signing account (offline mode only)")
|
||||
f.Uint64P(FlagSequence, "s", 0, "The sequence number of the signing account (offline mode only)")
|
||||
f.String(FlagNote, "", "Note to add a description to the transaction (previously --memo)")
|
||||
f.String(FlagFees, "", "Fees to pay along with transaction; eg: 10uatom")
|
||||
f.String(FlagGasPrices, "", "Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom)")
|
||||
f.String(FlagNode, "tcp://localhost:26657", "<host>:<port> to tendermint rpc interface for this chain")
|
||||
f.Bool(FlagUseLedger, false, "Use a connected Ledger device")
|
||||
f.Float64(FlagGasAdjustment, DefaultGasAdjustment, "adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored ")
|
||||
f.StringP(FlagBroadcastMode, "b", BroadcastSync, "Transaction broadcasting mode (sync|async)")
|
||||
f.Bool(FlagDryRun, false, "ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible)")
|
||||
f.Bool(FlagGenerateOnly, false, "Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name)")
|
||||
f.Bool(FlagOffline, false, "Offline mode (does not allow any online functionality)")
|
||||
f.BoolP(FlagSkipConfirmation, "y", false, "Skip tx broadcasting prompt confirmation")
|
||||
f.String(FlagSignMode, "", "Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature")
|
||||
f.Uint64(FlagTimeoutHeight, 0, "Set a block timeout height to prevent the tx from being committed past a certain height")
|
||||
f.String(FlagFeePayer, "", "Fee payer pays fees for the transaction instead of deducting from the signer")
|
||||
f.String(FlagFeeGranter, "", "Fee granter grants fees for the transaction")
|
||||
f.String(FlagTip, "", "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")
|
||||
f.Bool(FlagAux, false, "Generate aux signer data instead of sending a tx")
|
||||
f.String(FlagChainID, "", "The network chain ID")
|
||||
// --gas can accept integers and "auto"
|
||||
cmd.Flags().String(FlagGas, "", fmt.Sprintf("gas limit to set per-transaction; set to %q to calculate sufficient gas automatically. Note: %q option doesn't always report accurate results. Set a valid coin value to adjust the result. Can be used instead of %q. (default %d)",
|
||||
f.String(FlagGas, "", fmt.Sprintf("gas limit to set per-transaction; set to %q to calculate sufficient gas automatically. Note: %q option doesn't always report accurate results. Set a valid coin value to adjust the result. Can be used instead of %q. (default %d)",
|
||||
GasFlagAuto, GasFlagAuto, FlagFees, DefaultGasLimit))
|
||||
|
||||
AddKeyringFlags(f)
|
||||
}
|
||||
|
||||
// AddKeyringFlags sets common keyring flags
|
||||
func AddKeyringFlags(flags *pflag.FlagSet) {
|
||||
flags.String(FlagKeyringDir, "", "The client Keyring directory; if omitted, the default 'home' directory will be used")
|
||||
flags.String(FlagKeyringBackend, DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test|memory)")
|
||||
}
|
||||
|
||||
// AddPaginationFlagsToCmd adds common pagination flags to cmd
|
||||
|
||||
@ -51,9 +51,8 @@ The pass backend requires GnuPG: https://gnupg.org/
|
||||
)
|
||||
|
||||
cmd.PersistentFlags().String(flags.FlagHome, defaultNodeHome, "The application home directory")
|
||||
cmd.PersistentFlags().String(flags.FlagKeyringDir, "", "The client Keyring directory; if omitted, the default 'home' directory will be used")
|
||||
cmd.PersistentFlags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)")
|
||||
cmd.PersistentFlags().String(cli.OutputFlag, "text", "Output format (text|json)")
|
||||
flags.AddKeyringFlags(cmd.PersistentFlags())
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@ -106,6 +106,10 @@ The `memory` backend stores keys in memory. The keys are immediately deleted aft
|
||||
|
||||
**Provided for testing purposes only. The `memory` backend is not recommended for use in production environments**.
|
||||
|
||||
### Setting backend using the env variable
|
||||
|
||||
You can set the keyring-backend using env variable: `BINNAME_KEYRING_BACKEND`. For example, if you binary name is `gaia-v5` then set: `export GAIA_V5_KEYRING_BACKEND=pass`
|
||||
|
||||
## Adding keys to the keyring
|
||||
|
||||
:::warning
|
||||
|
||||
Loading…
Reference in New Issue
Block a user