diff --git a/cardano-cli/src/Cardano/CLI/Commands.hs b/cardano-cli/src/Cardano/CLI/Commands.hs index 2cf9a9a547..a28ec94225 100644 --- a/cardano-cli/src/Cardano/CLI/Commands.hs +++ b/cardano-cli/src/Cardano/CLI/Commands.hs @@ -14,6 +14,7 @@ import Cardano.CLI.Commands.Node import Cardano.CLI.Commands.Ping (PingCmd (..)) import Cardano.CLI.Compatible.Commands import Cardano.CLI.EraBased.Commands +import Cardano.CLI.EraBased.Commands.Query import Cardano.CLI.Legacy.Commands import Options.Applicative.Types (ParserInfo (..), ParserPrefs (..)) @@ -32,6 +33,8 @@ data ClientCommand KeyCommands KeyCmds | -- | Era agnostic node commands NodeCommands NodeCmds + | -- | Query commands + forall era. QueryCommands (QueryCmds era) | -- | Legacy shelley-based Commands LegacyCmds LegacyCmds | CliPingCommand PingCmd diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs index e815a95b17..03fd68e489 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs @@ -5,6 +5,7 @@ module Cardano.CLI.EraBased.Options.Query ( pQueryCmds + , pQueryCmdsTopLevel ) where @@ -27,6 +28,142 @@ import qualified Options.Applicative as Opt {- HLINT ignore "Use <$>" -} {- HLINT ignore "Move brackets to avoid $" -} +pQueryCmdsTopLevel :: EnvCli -> Parser (QueryCmds ConwayEra) +pQueryCmdsTopLevel envCli = + let parsers = + [ pProtocolParams envCli + , pTip envCli + , pStakePools envCli + , pStakeDistribution envCli + , pStakeAddressInfo envCli + , pUTxO envCli + , pLedgerState envCli + , pProtocolState envCli + , pStakeSnapshot envCli + , pPoolParams envCli + , pLeadershipSchedule envCli + , pKesPeriodInfo envCli + , pPoolState envCli + , pTxMempool envCli + , pSlotNumber envCli + ] + i = + Opt.progDesc $ + mconcat + [ "Node query commands. Will query the local node whose Unix domain socket is " + , "obtained from the CARDANO_NODE_SOCKET_PATH environment variable." + ] + in subParser "query" $ Opt.info (asum parsers) i + +pProtocolParams :: EnvCli -> Parser (QueryCmds era) +pProtocolParams envCli = + subParser "protocol-parameters" $ + Opt.info (pQueryProtocolParametersCmd envCli) $ + Opt.progDesc "Get the node's current protocol parameters" + +pTip :: EnvCli -> Parser (QueryCmds ConwayEra) +pTip envCli = + subParser "tip" $ + Opt.info (pQueryTipCmd ShelleyBasedEraConway envCli) $ + Opt.progDesc "Get the node's current tip (slot no, hash, block no)" + +pStakePools :: EnvCli -> Parser (QueryCmds ConwayEra) +pStakePools envCli = + subParser "stake-pools" $ + Opt.info (pQueryStakePoolsCmd ShelleyBasedEraConway envCli) $ + Opt.progDesc "Get the node's current set of stake pool ids" + +pStakeDistribution :: EnvCli -> Parser (QueryCmds ConwayEra) +pStakeDistribution envCli = + subParser "stake-distribution" $ + Opt.info (pQueryStakeDistributionCmd ShelleyBasedEraConway envCli) $ + Opt.progDesc "Get the node's current aggregated stake distribution" + +pStakeAddressInfo :: EnvCli -> Parser (QueryCmds ConwayEra) +pStakeAddressInfo envCli = + subParser "stake-address-info" $ + Opt.info (pQueryStakeAddressInfoCmd ShelleyBasedEraConway envCli) $ + Opt.progDesc $ + mconcat + [ "Get the current delegations and reward accounts filtered by stake address." + ] + +pUTxO :: EnvCli -> Parser (QueryCmds ConwayEra) +pUTxO envCli = + subParser "utxo" $ + Opt.info (pQueryUTxOCmd ShelleyBasedEraConway envCli) $ + Opt.progDesc $ + mconcat + [ "Get a portion of the current UTxO: by tx in, by address or the whole." + ] + +pLedgerState :: EnvCli -> Parser (QueryCmds ConwayEra) +pLedgerState envCli = + subParser "ledger-state" $ + Opt.info (pQueryLedgerStateCmd ShelleyBasedEraConway envCli) $ + Opt.progDesc $ + mconcat + [ "Dump the current ledger state of the node (Ledger.NewEpochState -- advanced command)" + ] + +pProtocolState :: EnvCli -> Parser (QueryCmds ConwayEra) +pProtocolState envCli = + subParser "protocol-state" $ + Opt.info (pQueryProtocolStateCmd ShelleyBasedEraConway envCli) $ + Opt.progDesc $ + mconcat + [ "Dump the current protocol state of the node (Ledger.ChainDepState -- advanced command)" + ] + +pStakeSnapshot :: EnvCli -> Parser (QueryCmds ConwayEra) +pStakeSnapshot envCli = + subParser "stake-snapshot" $ + Opt.info (pQueryStakeSnapshotCmd ShelleyBasedEraConway envCli) $ + Opt.progDesc $ + mconcat + [ "Obtain the three stake snapshots for a pool, plus the total active stake (advanced command)" + ] + +pPoolParams :: EnvCli -> Parser (QueryCmds ConwayEra) +pPoolParams envCli = + hiddenSubParser "pool-params" $ + Opt.info (pQueryPoolStateCmd ShelleyBasedEraConway envCli) $ + Opt.progDesc $ + mconcat + [ "DEPRECATED. Use query pool-state instead. Dump the pool parameters " + , "(Ledger.NewEpochState.esLState._delegationState._pState._pParams -- advanced command)" + ] + +pLeadershipSchedule :: EnvCli -> Parser (QueryCmds ConwayEra) +pLeadershipSchedule envCli = + subParser "leadership-schedule" $ + Opt.info (pLeadershipScheduleCmd ShelleyBasedEraConway envCli) $ + Opt.progDesc "Get the slots the node is expected to mint a block in (advanced command)" + +pKesPeriodInfo :: EnvCli -> Parser (QueryCmds ConwayEra) +pKesPeriodInfo envCli = + subParser "kes-period-info" $ + Opt.info (pKesPeriodInfoCmd ShelleyBasedEraConway envCli) $ + Opt.progDesc "Get information about the current KES period and your node's operational certificate." + +pPoolState :: EnvCli -> Parser (QueryCmds ConwayEra) +pPoolState envCli = + subParser "pool-state" $ + Opt.info (pQueryPoolStateCmd ShelleyBasedEraConway envCli) $ + Opt.progDesc "Dump the pool state" + +pTxMempool :: EnvCli -> Parser (QueryCmds era) +pTxMempool envCli = + subParser "tx-mempool" $ + Opt.info (pQueryTxMempoolCmd envCli) $ + Opt.progDesc "Local Mempool info" + +pSlotNumber :: EnvCli -> Parser (QueryCmds ConwayEra) +pSlotNumber envCli = + subParser "slot-number" $ + Opt.info (pQuerySlotNumberCmd ShelleyBasedEraConway envCli) $ + Opt.progDesc "Query slot number for UTC timestamp" + pQueryCmds :: () => ShelleyBasedEra era diff --git a/cardano-cli/src/Cardano/CLI/Options.hs b/cardano-cli/src/Cardano/CLI/Options.hs index 7b4364844a..6505d8786b 100644 --- a/cardano-cli/src/Cardano/CLI/Options.hs +++ b/cardano-cli/src/Cardano/CLI/Options.hs @@ -14,6 +14,7 @@ import Cardano.CLI.Compatible.Commands import Cardano.CLI.Environment (EnvCli) import Cardano.CLI.EraBased.Commands import Cardano.CLI.EraBased.Options.Common +import Cardano.CLI.EraBased.Options.Query (pQueryCmdsTopLevel) import Cardano.CLI.Legacy.Options (parseLegacyCmds) import Cardano.CLI.Options.Address import Cardano.CLI.Options.Debug @@ -60,6 +61,13 @@ addressCmdsTopLevel envCli = AddressCommand <$> pAddressCmds envCli nodeCmdsTopLevel :: Parser ClientCommand nodeCmdsTopLevel = NodeCommands <$> pNodeCmds +-- Queries actually depend on the node to client version which may coincide +-- with a hardfork but not necessarily. We will expose commands at the top level +-- regardless if they are compatible with the era or not. The help text should be +-- updated to make this clear. Gating commands behind eras +queryCmdsTopLevel :: EnvCli -> Parser ClientCommand +queryCmdsTopLevel envCli = QueryCommands <$> pQueryCmdsTopLevel envCli + keyCmdsTopLevel :: Parser ClientCommand keyCmdsTopLevel = KeyCommands <$> pKeyCmds @@ -72,6 +80,7 @@ parseClientCommand envCli = [ addressCmdsTopLevel envCli , keyCmdsTopLevel , nodeCmdsTopLevel + , queryCmdsTopLevel envCli , parseLegacy envCli , parseByron envCli , parseAnyEra envCli diff --git a/cardano-cli/src/Cardano/CLI/Run.hs b/cardano-cli/src/Cardano/CLI/Run.hs index 5ba93976f3..6269502e00 100644 --- a/cardano-cli/src/Cardano/CLI/Run.hs +++ b/cardano-cli/src/Cardano/CLI/Run.hs @@ -20,6 +20,7 @@ import Cardano.CLI.Compatible.Commands import Cardano.CLI.Compatible.Run import Cardano.CLI.EraBased.Commands import Cardano.CLI.EraBased.Run +import Cardano.CLI.EraBased.Run.Query import Cardano.CLI.Legacy.Commands import Cardano.CLI.Legacy.Run (runLegacyCmds) import Cardano.CLI.Render (customRenderHelp) @@ -35,6 +36,7 @@ import Cardano.CLI.Types.Errors.CmdError import Cardano.CLI.Types.Errors.HashCmdError import Cardano.CLI.Types.Errors.KeyCmdError import Cardano.CLI.Types.Errors.NodeCmdError +import Cardano.CLI.Types.Errors.QueryCmdError import Cardano.Git.Rev (gitRev) import Control.Monad (forM_) @@ -63,6 +65,7 @@ data ClientCommandErrors | HashCmdError HashCmdError | KeyCmdError KeyCmdError | NodeCmdError NodeCmdError + | QueryCmdError QueryCmdError | PingClientError PingClientCmdError | DebugCmdError DebugCmdError @@ -86,6 +89,8 @@ runClientCommand = \case firstExceptT KeyCmdError $ runKeyCmds cmds LegacyCmds cmds -> firstExceptT (CmdError (renderLegacyCommand cmds)) $ runLegacyCmds cmds + QueryCommands cmds -> + firstExceptT QueryCmdError $ runQueryCmds cmds CliPingCommand cmds -> firstExceptT PingClientError $ runPingCmd cmds CliDebugCmds cmds -> @@ -111,6 +116,8 @@ renderClientCommandError = \case renderNodeCmdError err KeyCmdError err -> renderKeyCmdError err + QueryCmdError err -> + renderQueryCmdError err PingClientError err -> renderPingClientCmdError err DebugCmdError err -> diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli index d8f5e52f3d..f6f1dd2c7b 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -2,6 +2,7 @@ Usage: cardano-cli ( address | key | node + | query | legacy | byron | shelley @@ -202,6 +203,204 @@ Usage: cardano-cli node issue-op-cert Issue a node operational certificate +Usage: cardano-cli query + ( protocol-parameters + | tip + | stake-pools + | stake-distribution + | stake-address-info + | utxo + | ledger-state + | protocol-state + | stake-snapshot + | leadership-schedule + | kes-period-info + | pool-state + | tx-mempool + | slot-number + ) + + Node query commands. Will query the local node whose Unix domain socket is + obtained from the CARDANO_NODE_SOCKET_PATH environment variable. + +Usage: cardano-cli query protocol-parameters --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + [--out-file FILEPATH] + + Get the node's current protocol parameters + +Usage: cardano-cli query tip --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + [--volatile-tip | --immutable-tip] + [--out-file FILEPATH] + + Get the node's current tip (slot no, hash, block no) + +Usage: cardano-cli query stake-pools --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + [--volatile-tip | --immutable-tip] + [--output-json | --output-text] + [--out-file FILEPATH] + + Get the node's current set of stake pool ids + +Usage: cardano-cli query stake-distribution --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + [--volatile-tip | --immutable-tip] + [--output-json | --output-text] + [--out-file FILEPATH] + + Get the node's current aggregated stake distribution + +Usage: cardano-cli query stake-address-info --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + --address ADDRESS + ( --mainnet + | --testnet-magic NATURAL + ) + [--volatile-tip | --immutable-tip] + [--out-file FILEPATH] + + Get the current delegations and reward accounts filtered by stake address. + +Usage: cardano-cli query utxo --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + ( --whole-utxo + | (--address ADDRESS) + | (--tx-in TX-IN) + ) + (--mainnet | --testnet-magic NATURAL) + [--volatile-tip | --immutable-tip] + [--output-json | --output-text] + [--out-file FILEPATH] + + Get a portion of the current UTxO: by tx in, by address or the whole. + +Usage: cardano-cli query ledger-state --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + [--volatile-tip | --immutable-tip] + [--out-file FILEPATH] + + Dump the current ledger state of the node (Ledger.NewEpochState -- advanced + command) + +Usage: cardano-cli query protocol-state --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + [--volatile-tip | --immutable-tip] + [--out-file FILEPATH] + + Dump the current protocol state of the node (Ledger.ChainDepState -- advanced + command) + +Usage: cardano-cli query stake-snapshot --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + ( --all-stake-pools + | (--stake-pool-id STAKE_POOL_ID) + ) + [--volatile-tip | --immutable-tip] + [--out-file FILEPATH] + + Obtain the three stake snapshots for a pool, plus the total active stake + (advanced command) + +Usage: cardano-cli query pool-params --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + ( --all-stake-pools + | (--stake-pool-id STAKE_POOL_ID) + ) + [--volatile-tip | --immutable-tip] + [--out-file FILEPATH] + + DEPRECATED. Use query pool-state instead. Dump the pool parameters + (Ledger.NewEpochState.esLState._delegationState._pState._pParams -- advanced + command) + +Usage: cardano-cli query leadership-schedule --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + --genesis FILEPATH + ( --stake-pool-verification-key STRING + | --cold-verification-key-file FILEPATH + | --stake-pool-id STAKE_POOL_ID + ) + --vrf-signing-key-file FILEPATH + (--current | --next) + [ --volatile-tip + | --immutable-tip + ] + [--output-json | --output-text] + [--out-file FILEPATH] + + Get the slots the node is expected to mint a block in (advanced command) + +Usage: cardano-cli query kes-period-info --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + --op-cert-file FILEPATH + [--volatile-tip | --immutable-tip] + [--out-file FILEPATH] + + Get information about the current KES period and your node's operational + certificate. + +Usage: cardano-cli query pool-state --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + ( --all-stake-pools + | (--stake-pool-id STAKE_POOL_ID) + ) + [--volatile-tip | --immutable-tip] + [--out-file FILEPATH] + + Dump the pool state + +Usage: cardano-cli query tx-mempool --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + (info | next-tx | tx-exists) + [--out-file FILEPATH] + + Local Mempool info + +Usage: cardano-cli query tx-mempool info + + Ask the node about the current mempool's capacity and sizes + +Usage: cardano-cli query tx-mempool next-tx + + Requests the next transaction from the mempool's current list + +Usage: cardano-cli query tx-mempool tx-exists TX_ID + + Query if a particular transaction exists in the mempool + +Usage: cardano-cli query slot-number --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + [--volatile-tip | --immutable-tip] + TIMESTAMP + + Query slot number for UTC timestamp + Usage: cardano-cli legacy Legacy commands Legacy commands diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/query.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query.cli new file mode 100644 index 0000000000..9db00062dc --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query.cli @@ -0,0 +1,49 @@ +Usage: cardano-cli query + ( protocol-parameters + | tip + | stake-pools + | stake-distribution + | stake-address-info + | utxo + | ledger-state + | protocol-state + | stake-snapshot + | leadership-schedule + | kes-period-info + | pool-state + | tx-mempool + | slot-number + ) + + Node query commands. Will query the local node whose Unix domain socket is + obtained from the CARDANO_NODE_SOCKET_PATH environment variable. + +Available options: + -h,--help Show this help text + +Available commands: + protocol-parameters Get the node's current protocol parameters + tip Get the node's current tip (slot no, hash, block no) + stake-pools Get the node's current set of stake pool ids + stake-distribution Get the node's current aggregated stake distribution + stake-address-info Get the current delegations and reward accounts + filtered by stake address. + utxo Get a portion of the current UTxO: by tx in, by + address or the whole. + ledger-state Dump the current ledger state of the node + (Ledger.NewEpochState -- advanced command) + protocol-state Dump the current protocol state of the node + (Ledger.ChainDepState -- advanced command) + stake-snapshot Obtain the three stake snapshots for a pool, plus the + total active stake (advanced command) + pool-params DEPRECATED. Use query pool-state instead. Dump the + pool parameters + (Ledger.NewEpochState.esLState._delegationState._pState._pParams + -- advanced command) + leadership-schedule Get the slots the node is expected to mint a block in + (advanced command) + kes-period-info Get information about the current KES period and your + node's operational certificate. + pool-state Dump the pool state + tx-mempool Local Mempool info + slot-number Query slot number for UTC timestamp diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/query_kes-period-info.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_kes-period-info.cli new file mode 100644 index 0000000000..6c5976792d --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_kes-period-info.cli @@ -0,0 +1,31 @@ +Usage: cardano-cli query kes-period-info --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + --op-cert-file FILEPATH + [--volatile-tip | --immutable-tip] + [--out-file FILEPATH] + + Get information about the current KES period and your node's operational + certificate. + +Available options: + --socket-path SOCKET_PATH + Path to the node socket. This overrides the + CARDANO_NODE_SOCKET_PATH environment variable. The + argument is optional if CARDANO_NODE_SOCKET_PATH is + defined and mandatory otherwise. + --cardano-mode For talking to a node running in full Cardano mode + (default). + --epoch-slots SLOTS The number of slots per epoch for the Byron era. + (default: 21600) + --mainnet Use the mainnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --testnet-magic NATURAL Specify a testnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --op-cert-file FILEPATH Filepath of the node's operational certificate. + --volatile-tip Use the volatile tip as a target. (This is the + default) + --immutable-tip Use the immutable tip as a target. + --out-file FILEPATH Optional output file. Default is to write to stdout. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/query_leadership-schedule.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_leadership-schedule.cli new file mode 100644 index 0000000000..ea7b3db9bc --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_leadership-schedule.cli @@ -0,0 +1,56 @@ +Usage: cardano-cli query leadership-schedule --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + --genesis FILEPATH + ( --stake-pool-verification-key STRING + | --cold-verification-key-file FILEPATH + | --stake-pool-id STAKE_POOL_ID + ) + --vrf-signing-key-file FILEPATH + (--current | --next) + [ --volatile-tip + | --immutable-tip + ] + [--output-json | --output-text] + [--out-file FILEPATH] + + Get the slots the node is expected to mint a block in (advanced command) + +Available options: + --socket-path SOCKET_PATH + Path to the node socket. This overrides the + CARDANO_NODE_SOCKET_PATH environment variable. The + argument is optional if CARDANO_NODE_SOCKET_PATH is + defined and mandatory otherwise. + --cardano-mode For talking to a node running in full Cardano mode + (default). + --epoch-slots SLOTS The number of slots per epoch for the Byron era. + (default: 21600) + --mainnet Use the mainnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --testnet-magic NATURAL Specify a testnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --genesis FILEPATH Shelley genesis filepath + --stake-pool-verification-key STRING + Stake pool verification key (Bech32 or hex-encoded). + --cold-verification-key-file FILEPATH + Filepath of the stake pool verification key. + --stake-pool-id STAKE_POOL_ID + Stake pool ID/verification key hash (either + Bech32-encoded or hex-encoded). + --vrf-signing-key-file FILEPATH + Input filepath of the VRF signing key. + --current Get the leadership schedule for the current epoch. + --next Get the leadership schedule for the following epoch. + --volatile-tip Use the volatile tip as a target. (This is the + default) + --immutable-tip Use the immutable tip as a target. + --output-json Format leadership-schedule query output to JSON. + Default format when writing to a file + --output-text Format leadership-schedule query output to TEXT. + Default format when writing to stdout + --out-file FILEPATH Optional output file. Default is to write to stdout. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/query_ledger-state.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_ledger-state.cli new file mode 100644 index 0000000000..5dada14b2c --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_ledger-state.cli @@ -0,0 +1,28 @@ +Usage: cardano-cli query ledger-state --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + [--volatile-tip | --immutable-tip] + [--out-file FILEPATH] + + Dump the current ledger state of the node (Ledger.NewEpochState -- advanced + command) + +Available options: + --socket-path SOCKET_PATH + Path to the node socket. This overrides the + CARDANO_NODE_SOCKET_PATH environment variable. The + argument is optional if CARDANO_NODE_SOCKET_PATH is + defined and mandatory otherwise. + --cardano-mode For talking to a node running in full Cardano mode + (default). + --epoch-slots SLOTS The number of slots per epoch for the Byron era. + (default: 21600) + --mainnet Use the mainnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --testnet-magic NATURAL Specify a testnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --volatile-tip Use the volatile tip as a target. (This is the + default) + --immutable-tip Use the immutable tip as a target. + --out-file FILEPATH Optional output file. Default is to write to stdout. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/query_pool-params.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_pool-params.cli new file mode 100644 index 0000000000..5aa0f0c42b --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_pool-params.cli @@ -0,0 +1,36 @@ +Usage: cardano-cli query pool-params --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + ( --all-stake-pools + | (--stake-pool-id STAKE_POOL_ID) + ) + [--volatile-tip | --immutable-tip] + [--out-file FILEPATH] + + DEPRECATED. Use query pool-state instead. Dump the pool parameters + (Ledger.NewEpochState.esLState._delegationState._pState._pParams -- advanced + command) + +Available options: + --socket-path SOCKET_PATH + Path to the node socket. This overrides the + CARDANO_NODE_SOCKET_PATH environment variable. The + argument is optional if CARDANO_NODE_SOCKET_PATH is + defined and mandatory otherwise. + --cardano-mode For talking to a node running in full Cardano mode + (default). + --epoch-slots SLOTS The number of slots per epoch for the Byron era. + (default: 21600) + --mainnet Use the mainnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --testnet-magic NATURAL Specify a testnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --all-stake-pools Query for all stake pools + --stake-pool-id STAKE_POOL_ID + Stake pool ID/verification key hash (either + Bech32-encoded or hex-encoded). + --volatile-tip Use the volatile tip as a target. (This is the + default) + --immutable-tip Use the immutable tip as a target. + --out-file FILEPATH Optional output file. Default is to write to stdout. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/query_pool-state.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_pool-state.cli new file mode 100644 index 0000000000..be6641d6b5 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_pool-state.cli @@ -0,0 +1,34 @@ +Usage: cardano-cli query pool-state --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + ( --all-stake-pools + | (--stake-pool-id STAKE_POOL_ID) + ) + [--volatile-tip | --immutable-tip] + [--out-file FILEPATH] + + Dump the pool state + +Available options: + --socket-path SOCKET_PATH + Path to the node socket. This overrides the + CARDANO_NODE_SOCKET_PATH environment variable. The + argument is optional if CARDANO_NODE_SOCKET_PATH is + defined and mandatory otherwise. + --cardano-mode For talking to a node running in full Cardano mode + (default). + --epoch-slots SLOTS The number of slots per epoch for the Byron era. + (default: 21600) + --mainnet Use the mainnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --testnet-magic NATURAL Specify a testnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --all-stake-pools Query for all stake pools + --stake-pool-id STAKE_POOL_ID + Stake pool ID/verification key hash (either + Bech32-encoded or hex-encoded). + --volatile-tip Use the volatile tip as a target. (This is the + default) + --immutable-tip Use the immutable tip as a target. + --out-file FILEPATH Optional output file. Default is to write to stdout. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/query_protocol-parameters.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_protocol-parameters.cli new file mode 100644 index 0000000000..5ae60269c6 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_protocol-parameters.cli @@ -0,0 +1,26 @@ +Usage: cardano-cli query protocol-parameters --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + [--out-file FILEPATH] + + Get the node's current protocol parameters + +Available options: + --socket-path SOCKET_PATH + Path to the node socket. This overrides the + CARDANO_NODE_SOCKET_PATH environment variable. The + argument is optional if CARDANO_NODE_SOCKET_PATH is + defined and mandatory otherwise. + --cardano-mode For talking to a node running in full Cardano mode + (default). + --epoch-slots SLOTS The number of slots per epoch for the Byron era. + (default: 21600) + --mainnet Use the mainnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --testnet-magic NATURAL Specify a testnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --out-file FILEPATH Optional output file. Default is to write to stdout. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/query_protocol-state.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_protocol-state.cli new file mode 100644 index 0000000000..4b8247c6fd --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_protocol-state.cli @@ -0,0 +1,28 @@ +Usage: cardano-cli query protocol-state --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + [--volatile-tip | --immutable-tip] + [--out-file FILEPATH] + + Dump the current protocol state of the node (Ledger.ChainDepState -- advanced + command) + +Available options: + --socket-path SOCKET_PATH + Path to the node socket. This overrides the + CARDANO_NODE_SOCKET_PATH environment variable. The + argument is optional if CARDANO_NODE_SOCKET_PATH is + defined and mandatory otherwise. + --cardano-mode For talking to a node running in full Cardano mode + (default). + --epoch-slots SLOTS The number of slots per epoch for the Byron era. + (default: 21600) + --mainnet Use the mainnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --testnet-magic NATURAL Specify a testnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --volatile-tip Use the volatile tip as a target. (This is the + default) + --immutable-tip Use the immutable tip as a target. + --out-file FILEPATH Optional output file. Default is to write to stdout. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/query_slot-number.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_slot-number.cli new file mode 100644 index 0000000000..6a77e406b9 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_slot-number.cli @@ -0,0 +1,27 @@ +Usage: cardano-cli query slot-number --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + [--volatile-tip | --immutable-tip] + TIMESTAMP + + Query slot number for UTC timestamp + +Available options: + --socket-path SOCKET_PATH + Path to the node socket. This overrides the + CARDANO_NODE_SOCKET_PATH environment variable. The + argument is optional if CARDANO_NODE_SOCKET_PATH is + defined and mandatory otherwise. + --cardano-mode For talking to a node running in full Cardano mode + (default). + --epoch-slots SLOTS The number of slots per epoch for the Byron era. + (default: 21600) + --mainnet Use the mainnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --testnet-magic NATURAL Specify a testnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --volatile-tip Use the volatile tip as a target. (This is the + default) + --immutable-tip Use the immutable tip as a target. + TIMESTAMP UTC timestamp in YYYY-MM-DDThh:mm:ssZ format + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/query_stake-address-info.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_stake-address-info.cli new file mode 100644 index 0000000000..e1dba2c354 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_stake-address-info.cli @@ -0,0 +1,32 @@ +Usage: cardano-cli query stake-address-info --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + --address ADDRESS + ( --mainnet + | --testnet-magic NATURAL + ) + [--volatile-tip | --immutable-tip] + [--out-file FILEPATH] + + Get the current delegations and reward accounts filtered by stake address. + +Available options: + --socket-path SOCKET_PATH + Path to the node socket. This overrides the + CARDANO_NODE_SOCKET_PATH environment variable. The + argument is optional if CARDANO_NODE_SOCKET_PATH is + defined and mandatory otherwise. + --cardano-mode For talking to a node running in full Cardano mode + (default). + --epoch-slots SLOTS The number of slots per epoch for the Byron era. + (default: 21600) + --address ADDRESS Filter by Cardano stake address (Bech32-encoded). + --mainnet Use the mainnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --testnet-magic NATURAL Specify a testnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --volatile-tip Use the volatile tip as a target. (This is the + default) + --immutable-tip Use the immutable tip as a target. + --out-file FILEPATH Optional output file. Default is to write to stdout. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/query_stake-distribution.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_stake-distribution.cli new file mode 100644 index 0000000000..7c33ecc723 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_stake-distribution.cli @@ -0,0 +1,35 @@ +Usage: cardano-cli query stake-distribution --socket-path SOCKET_PATH + [--cardano-mode + [--epoch-slots SLOTS]] + ( --mainnet + | --testnet-magic NATURAL + ) + [--volatile-tip | --immutable-tip] + [--output-json | --output-text] + [--out-file FILEPATH] + + Get the node's current aggregated stake distribution + +Available options: + --socket-path SOCKET_PATH + Path to the node socket. This overrides the + CARDANO_NODE_SOCKET_PATH environment variable. The + argument is optional if CARDANO_NODE_SOCKET_PATH is + defined and mandatory otherwise. + --cardano-mode For talking to a node running in full Cardano mode + (default). + --epoch-slots SLOTS The number of slots per epoch for the Byron era. + (default: 21600) + --mainnet Use the mainnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --testnet-magic NATURAL Specify a testnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --volatile-tip Use the volatile tip as a target. (This is the + default) + --immutable-tip Use the immutable tip as a target. + --output-json Format stake-distribution query output to JSON. + Default format when writing to a file + --output-text Format stake-distribution query output to TEXT. + Default format when writing to stdout + --out-file FILEPATH Optional output file. Default is to write to stdout. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/query_stake-pools.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_stake-pools.cli new file mode 100644 index 0000000000..2bf8095b2e --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_stake-pools.cli @@ -0,0 +1,32 @@ +Usage: cardano-cli query stake-pools --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + [--volatile-tip | --immutable-tip] + [--output-json | --output-text] + [--out-file FILEPATH] + + Get the node's current set of stake pool ids + +Available options: + --socket-path SOCKET_PATH + Path to the node socket. This overrides the + CARDANO_NODE_SOCKET_PATH environment variable. The + argument is optional if CARDANO_NODE_SOCKET_PATH is + defined and mandatory otherwise. + --cardano-mode For talking to a node running in full Cardano mode + (default). + --epoch-slots SLOTS The number of slots per epoch for the Byron era. + (default: 21600) + --mainnet Use the mainnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --testnet-magic NATURAL Specify a testnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --volatile-tip Use the volatile tip as a target. (This is the + default) + --immutable-tip Use the immutable tip as a target. + --output-json Format stake-pools query output to JSON. Default + format when writing to a file + --output-text Format stake-pools query output to TEXT. Default + format when writing to stdout + --out-file FILEPATH Optional output file. Default is to write to stdout. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/query_stake-snapshot.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_stake-snapshot.cli new file mode 100644 index 0000000000..f6cd339214 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_stake-snapshot.cli @@ -0,0 +1,35 @@ +Usage: cardano-cli query stake-snapshot --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + ( --all-stake-pools + | (--stake-pool-id STAKE_POOL_ID) + ) + [--volatile-tip | --immutable-tip] + [--out-file FILEPATH] + + Obtain the three stake snapshots for a pool, plus the total active stake + (advanced command) + +Available options: + --socket-path SOCKET_PATH + Path to the node socket. This overrides the + CARDANO_NODE_SOCKET_PATH environment variable. The + argument is optional if CARDANO_NODE_SOCKET_PATH is + defined and mandatory otherwise. + --cardano-mode For talking to a node running in full Cardano mode + (default). + --epoch-slots SLOTS The number of slots per epoch for the Byron era. + (default: 21600) + --mainnet Use the mainnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --testnet-magic NATURAL Specify a testnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --all-stake-pools Query for all stake pools + --stake-pool-id STAKE_POOL_ID + Stake pool ID/verification key hash (either + Bech32-encoded or hex-encoded). + --volatile-tip Use the volatile tip as a target. (This is the + default) + --immutable-tip Use the immutable tip as a target. + --out-file FILEPATH Optional output file. Default is to write to stdout. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/query_tip.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_tip.cli new file mode 100644 index 0000000000..647e9e2c57 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_tip.cli @@ -0,0 +1,27 @@ +Usage: cardano-cli query tip --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + [--volatile-tip | --immutable-tip] + [--out-file FILEPATH] + + Get the node's current tip (slot no, hash, block no) + +Available options: + --socket-path SOCKET_PATH + Path to the node socket. This overrides the + CARDANO_NODE_SOCKET_PATH environment variable. The + argument is optional if CARDANO_NODE_SOCKET_PATH is + defined and mandatory otherwise. + --cardano-mode For talking to a node running in full Cardano mode + (default). + --epoch-slots SLOTS The number of slots per epoch for the Byron era. + (default: 21600) + --mainnet Use the mainnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --testnet-magic NATURAL Specify a testnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --volatile-tip Use the volatile tip as a target. (This is the + default) + --immutable-tip Use the immutable tip as a target. + --out-file FILEPATH Optional output file. Default is to write to stdout. + -h,--help Show this help text diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/query_tx-mempool.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_tx-mempool.cli new file mode 100644 index 0000000000..2390c51e4f --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_tx-mempool.cli @@ -0,0 +1,32 @@ +Usage: cardano-cli query tx-mempool --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + (info | next-tx | tx-exists) + [--out-file FILEPATH] + + Local Mempool info + +Available options: + --socket-path SOCKET_PATH + Path to the node socket. This overrides the + CARDANO_NODE_SOCKET_PATH environment variable. The + argument is optional if CARDANO_NODE_SOCKET_PATH is + defined and mandatory otherwise. + --cardano-mode For talking to a node running in full Cardano mode + (default). + --epoch-slots SLOTS The number of slots per epoch for the Byron era. + (default: 21600) + --mainnet Use the mainnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --testnet-magic NATURAL Specify a testnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --out-file FILEPATH Optional output file. Default is to write to stdout. + -h,--help Show this help text + +Available commands: + info Ask the node about the current mempool's capacity and + sizes + next-tx Requests the next transaction from the mempool's + current list + tx-exists Query if a particular transaction exists in the + mempool diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/query_tx-mempool_info.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_tx-mempool_info.cli new file mode 100644 index 0000000000..81aad66dd0 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_tx-mempool_info.cli @@ -0,0 +1,9 @@ +Missing: --socket-path SOCKET_PATH (--mainnet | --testnet-magic NATURAL) + +Usage: cardano-cli query tx-mempool --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + (info | next-tx | tx-exists) + [--out-file FILEPATH] + + Local Mempool info diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/query_tx-mempool_next-tx.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_tx-mempool_next-tx.cli new file mode 100644 index 0000000000..81aad66dd0 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_tx-mempool_next-tx.cli @@ -0,0 +1,9 @@ +Missing: --socket-path SOCKET_PATH (--mainnet | --testnet-magic NATURAL) + +Usage: cardano-cli query tx-mempool --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + (info | next-tx | tx-exists) + [--out-file FILEPATH] + + Local Mempool info diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/query_tx-mempool_tx-exists_TX_ID.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_tx-mempool_tx-exists_TX_ID.cli new file mode 100644 index 0000000000..81aad66dd0 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_tx-mempool_tx-exists_TX_ID.cli @@ -0,0 +1,9 @@ +Missing: --socket-path SOCKET_PATH (--mainnet | --testnet-magic NATURAL) + +Usage: cardano-cli query tx-mempool --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + (--mainnet | --testnet-magic NATURAL) + (info | next-tx | tx-exists) + [--out-file FILEPATH] + + Local Mempool info diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/query_utxo.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_utxo.cli new file mode 100644 index 0000000000..f0ecd043ab --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/query_utxo.cli @@ -0,0 +1,40 @@ +Usage: cardano-cli query utxo --socket-path SOCKET_PATH + [--cardano-mode [--epoch-slots SLOTS]] + ( --whole-utxo + | (--address ADDRESS) + | (--tx-in TX-IN) + ) + (--mainnet | --testnet-magic NATURAL) + [--volatile-tip | --immutable-tip] + [--output-json | --output-text] + [--out-file FILEPATH] + + Get a portion of the current UTxO: by tx in, by address or the whole. + +Available options: + --socket-path SOCKET_PATH + Path to the node socket. This overrides the + CARDANO_NODE_SOCKET_PATH environment variable. The + argument is optional if CARDANO_NODE_SOCKET_PATH is + defined and mandatory otherwise. + --cardano-mode For talking to a node running in full Cardano mode + (default). + --epoch-slots SLOTS The number of slots per epoch for the Byron era. + (default: 21600) + --whole-utxo Return the whole UTxO (only appropriate on small + testnets). + --address ADDRESS Filter by Cardano address(es) (Bech32-encoded). + --tx-in TX-IN Filter by transaction input (TxId#TxIx). + --mainnet Use the mainnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --testnet-magic NATURAL Specify a testnet magic id. This overrides the + CARDANO_NODE_NETWORK_ID environment variable + --volatile-tip Use the volatile tip as a target. (This is the + default) + --immutable-tip Use the immutable tip as a target. + --output-json Format utxo query output to JSON. Default format when + writing to a file + --output-text Format utxo query output to TEXT. Default format when + writing to stdout + --out-file FILEPATH Optional output file. Default is to write to stdout. + -h,--help Show this help text