From 3f405d8908046c8461257cf2ce0a0ad42b3201de Mon Sep 17 00:00:00 2001 From: Rob Walker Date: Thu, 19 Dec 2019 14:37:47 -0800 Subject: [PATCH] Add unix_timestap to stake lockups (#7569) --- Cargo.lock | 2 +- book/src/api-reference/cli.md | 1230 +++++++++++++++++++++-------- clap-utils/Cargo.toml | 1 + clap-utils/src/input_parsers.rs | 10 + cli/src/cli.rs | 15 +- cli/src/main.rs | 11 +- cli/src/stake.rs | 27 +- cli/tests/stake.rs | 10 +- genesis/Cargo.toml | 1 - genesis/src/main.rs | 10 +- genesis/src/stakes.rs | 1 + programs/stake/src/stake_state.rs | 93 ++- 12 files changed, 1038 insertions(+), 373 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8020957936..faf630e08d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3264,6 +3264,7 @@ dependencies = [ name = "solana-clap-utils" version = "0.22.0" dependencies = [ + "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "rpassword 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3497,7 +3498,6 @@ name = "solana-genesis" version = "0.22.0" dependencies = [ "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/book/src/api-reference/cli.md b/book/src/api-reference/cli.md index 8a81aaa049..2fe4e6a6db 100644 --- a/book/src/api-reference/cli.md +++ b/book/src/api-reference/cli.md @@ -177,99 +177,128 @@ $ solana send-timestamp --date 2018-12-24T23:59:00 ## Usage ### solana-cli ```text -solana-cli 0.22.0 +solana-cli 0.22.0 [channel=unknown commit=unknown] Blockchain, Rebuilt for Scale USAGE: - solana [OPTIONS] + solana [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json SUBCOMMANDS: - address Get your public key - airdrop Request lamports - balance Get your balance - cancel Cancel a transfer - claim-storage-reward Redeem storage reward credits - cluster-version Get the version of the cluster entrypoint - confirm Confirm transaction by signature - create-archiver-storage-account Create an archiver storage account - create-stake-account Create a stake account - create-validator-storage-account Create a validator storage account - create-vote-account Create a vote account - deactivate-stake Deactivate the delegated stake from the stake account - delegate-stake Delegate stake to a vote account - deploy Deploy a program - fees Display current cluster fees - get Get cli config settings - get-epoch-info Get information about the current epoch - get-genesis-hash Get the genesis hash - get-slot Get current slot - get-transaction-count Get current transaction count - help Prints this message or the help of the given subcommand(s) - pay Send a payment - ping Submit transactions sequentially - redeem-vote-credits Redeem credits in the stake account - send-signature Send a signature to authorize a transfer - send-timestamp Send a timestamp to unlock a transfer - set Set a cli config setting - show-account Show the contents of an account - show-stake-account Show the contents of a stake account - show-storage-account Show the contents of a storage account - show-validators Show information about the current validators - show-vote-account Show the contents of a vote account - stake-authorize-staker Authorize a new stake signing keypair for the given stake account - stake-authorize-withdrawer Authorize a new withdraw signing keypair for the given stake account - uptime Show the uptime of a validator, based on epoch voting history - validator-info Publish/get Validator info on Solana - vote-authorize-voter Authorize a new vote signing keypair for the given vote account - vote-authorize-withdrawer Authorize a new withdraw signing keypair for the given vote account - withdraw-stake Withdraw the unstaked lamports from the stake account + address Get your public key + airdrop Request lamports + balance Get your balance + cancel Cancel a transfer + catchup Wait for a validator to catch up to the cluster + claim-storage-reward Redeem storage reward credits + cluster-version Get the version of the cluster entrypoint + confirm Confirm transaction by signature + create-address-with-seed Generate a dervied account address with a seed + create-archiver-storage-account Create an archiver storage account + create-nonce-account Create a nonce account + create-stake-account Create a stake account + create-validator-storage-account Create a validator storage account + create-vote-account Create a vote account + deactivate-stake Deactivate the delegated stake from the stake account + delegate-stake Delegate stake to a vote account + deploy Deploy a program + fees Display current cluster fees + get Get cli config settings + get-block-time Get estimated production time of a block + get-epoch-info Get information about the current epoch + get-genesis-hash Get the genesis hash + get-nonce Get the current nonce value + get-slot Get current slot + get-transaction-count Get current transaction count + help Prints this message or the help of the given subcommand(s) + new-nonce Generate a new nonce, rendering the existing nonce useless + pay Send a payment + ping Submit transactions sequentially + redeem-vote-credits Redeem credits in the stake account + send-signature Send a signature to authorize a transfer + send-timestamp Send a timestamp to unlock a transfer + set Set a cli config setting + show-account Show the contents of an account + show-gossip Show the current gossip network nodes + show-nonce-account Show the contents of a nonce account + show-stake-account Show the contents of a stake account + show-stake-history Show the stake history + show-storage-account Show the contents of a storage account + show-validators Show information about the current validators + show-vote-account Show the contents of a vote account + stake-authorize-staker Authorize a new stake signing keypair for the given stake account + stake-authorize-withdrawer Authorize a new withdraw signing keypair for the given stake account + uptime Show the uptime of a validator, based on epoch voting history + validator-info Publish/get Validator info on Solana + vote-authorize-voter Authorize a new vote signing keypair for the given vote account + vote-authorize-withdrawer Authorize a new withdraw signing keypair for the given vote account + vote-update-validator Update the vote account's validator identity + withdraw-from-nonce-account Withdraw lamports from the nonce account + withdraw-stake Withdraw the unstaked lamports from the stake account ``` #### solana-address ```text -solana-address +solana-address Get your public key USAGE: - solana address [OPTIONS] + solana address [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ``` #### solana-airdrop ```text -solana-airdrop +solana-airdrop Request lamports USAGE: - solana airdrop [OPTIONS] [UNIT] + solana airdrop [FLAGS] [OPTIONS] [UNIT] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - --faucet-host Drone host to use [default: the --url host] - --faucet-port Drone port to use [default: 9900] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + --faucet-host Faucet host to use [default: the --url host] + --faucet-port Faucet port to use [default: 9900] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ARGS: The airdrop amount to request (default unit SOL) @@ -278,21 +307,27 @@ ARGS: #### solana-balance ```text -solana-balance +solana-balance Get your balance USAGE: solana balance [FLAGS] [OPTIONS] [PUBKEY] FLAGS: - -h, --help Prints help information - --lamports Display balance in lamports instead of SOL - -V, --version Prints version information + -h, --help Prints help information + --lamports Display balance in lamports instead of SOL + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ARGS: The public key of the balance to check @@ -300,41 +335,80 @@ ARGS: #### solana-cancel ```text -solana-cancel +solana-cancel Cancel a transfer USAGE: - solana cancel [OPTIONS] + solana cancel [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ARGS: The process id of the transfer to cancel ``` +#### solana-catchup +```text +solana-catchup +Wait for a validator to catch up to the cluster + +USAGE: + solana catchup [FLAGS] [OPTIONS] + +FLAGS: + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header + +OPTIONS: + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json + +ARGS: + Identity pubkey of the validator +``` + #### solana-claim-storage-reward ```text -solana-claim-storage-reward +solana-claim-storage-reward Redeem storage reward credits USAGE: - solana claim-storage-reward [OPTIONS] + solana claim-storage-reward [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ARGS: The node account to credit the rewards to @@ -343,128 +417,223 @@ ARGS: #### solana-cluster-version ```text -solana-cluster-version +solana-cluster-version Get the version of the cluster entrypoint USAGE: - solana cluster-version [OPTIONS] + solana cluster-version [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ``` #### solana-confirm ```text -solana-confirm +solana-confirm Confirm transaction by signature USAGE: - solana confirm [OPTIONS] + solana confirm [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ARGS: The transaction signature to confirm ``` +#### solana-create-address-with-seed +```text +solana-create-address-with-seed +Generate a dervied account address with a seed + +USAGE: + solana create-address-with-seed [FLAGS] [OPTIONS] + +FLAGS: + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header + +OPTIONS: + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + --from From (base) key, defaults to client keypair. + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json + +ARGS: + The seed. Must not take more than 32 bytes to encode as utf-8 + The program_id that the address will ultimately be used for, + or one of STAKE, VOTE, NONCE, and STORAGE keywords +``` + #### solana-create-archiver-storage-account ```text -solana-create-archiver-storage-account +solana-create-archiver-storage-account Create an archiver storage account USAGE: - solana create-archiver-storage-account [OPTIONS] + solana create-archiver-storage-account [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ARGS: - - + + +``` + +#### solana-create-nonce-account +```text +solana-create-nonce-account +Create a nonce account + +USAGE: + solana create-nonce-account [FLAGS] [OPTIONS] [UNIT] + +FLAGS: + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header + +OPTIONS: + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json + --nonce-authority Assign noncing authority to another entity + +ARGS: + Keypair of the nonce account to fund + The amount to load the nonce account with (default unit SOL) + Specify unit to use for request [possible values: SOL, lamports] ``` #### solana-create-stake-account ```text -solana-create-stake-account +solana-create-stake-account Create a stake account USAGE: - solana create-stake-account [OPTIONS] [UNIT] + solana create-stake-account [FLAGS] [OPTIONS] [UNIT] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - --authorized-staker Public key of authorized staker (defaults to cli config pubkey) - --authorized-withdrawer Public key of the authorized withdrawer (defaults to cli config pubkey) - -C, --config Configuration file to use [default: - ~/.config/solana/cli/config.yml] - --custodian Identity of the custodian (can withdraw before lockup expires) - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json - --lockup The slot height at which this account will be available for withdrawal + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + --authorized-staker Public key of authorized staker (defaults to cli config pubkey) + --authorized-withdrawer Public key of the authorized withdrawer (defaults to cli config pubkey) + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + --custodian Identity of the custodian (can withdraw before lockup expires) + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json + --lockup-date The date and time at which this account will be available for withdrawal + --lockup-epoch The epoch height at which this account will be available for withdrawal ARGS: - Address of the stake account to fund (pubkey or keypair) + Keypair of the stake account to fund The amount of send to the vote account (default unit SOL) Specify unit to use for request [possible values: SOL, lamports] ``` #### solana-create-validator-storage-account ```text -solana-create-validator-storage-account +solana-create-validator-storage-account Create a validator storage account USAGE: - solana create-validator-storage-account [OPTIONS] + solana create-validator-storage-account [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ARGS: - - + + ``` #### solana-create-vote-account ```text -solana-create-vote-account +solana-create-vote-account Create a vote account USAGE: - solana create-vote-account [OPTIONS] + solana create-vote-account [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] --authorized-voter Public key of the authorized voter (defaults to vote account) --authorized-withdrawer Public key of the authorized withdrawer (defaults to cli config pubkey) --commission The commission taken on reward redemption (0-100), default: 0 @@ -474,26 +643,35 @@ OPTIONS: -k, --keypair /path/to/id.json ARGS: - Vote account address to fund - Validator that will vote with this account + Vote account keypair to fund + Validator that will vote with this account ``` #### solana-deactivate-stake ```text -solana-deactivate-stake +solana-deactivate-stake Deactivate the delegated stake from the stake account USAGE: - solana deactivate-stake [OPTIONS] + solana deactivate-stake [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --sign-only Sign the transaction offline + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + --blockhash Use the supplied blockhash + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json + --signer ... Provide a public-key/signature pair for the transaction ARGS: Stake account to be deactivated. @@ -501,20 +679,29 @@ ARGS: #### solana-delegate-stake ```text -solana-delegate-stake +solana-delegate-stake Delegate stake to a vote account USAGE: - solana delegate-stake [OPTIONS] + solana delegate-stake [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --sign-only Sign the transaction offline + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + --blockhash Use the supplied blockhash + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json + --signer ... Provide a public-key/signature pair for the transaction ARGS: Stake account to delegate @@ -523,139 +710,238 @@ ARGS: #### solana-deploy ```text -solana-deploy +solana-deploy Deploy a program USAGE: - solana deploy [OPTIONS] + solana deploy [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ARGS: - /path/to/program.o + /path/to/program.o ``` #### solana-fees ```text -solana-fees +solana-fees Display current cluster fees USAGE: - solana fees [OPTIONS] + solana fees [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ``` #### solana-get ```text -solana-get +solana-get Get cli config settings USAGE: - solana get [OPTIONS] [CONFIG_FIELD] + solana get [FLAGS] [OPTIONS] [CONFIG_FIELD] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ARGS: Return a specific config setting [possible values: url, keypair] ``` +#### solana-get-block-time +```text +solana-get-block-time +Get estimated production time of a block + +USAGE: + solana get-block-time [FLAGS] [OPTIONS] + +FLAGS: + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header + +OPTIONS: + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json + +ARGS: + Slot number of the block to query +``` + #### solana-get-epoch-info ```text -solana-get-epoch-info +solana-get-epoch-info Get information about the current epoch USAGE: - solana get-epoch-info [OPTIONS] + solana get-epoch-info [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + --confirmed Return information at maximum-lockout commitment level + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ``` #### solana-get-genesis-hash ```text -solana-get-genesis-hash +solana-get-genesis-hash Get the genesis hash USAGE: - solana get-genesis-hash [OPTIONS] + solana get-genesis-hash [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json +``` + +#### solana-get-nonce +```text +solana-get-nonce +Get the current nonce value + +USAGE: + solana get-nonce [FLAGS] [OPTIONS] + +FLAGS: + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header + +OPTIONS: + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json + +ARGS: + Address of the nonce account to display ``` #### solana-get-slot ```text -solana-get-slot +solana-get-slot Get current slot USAGE: - solana get-slot [OPTIONS] + solana get-slot [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + --confirmed Return slot at maximum-lockout commitment level + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ``` #### solana-get-transaction-count ```text -solana-get-transaction-count +solana-get-transaction-count Get current transaction count USAGE: - solana get-transaction-count [OPTIONS] + solana get-transaction-count [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + --confirmed Return count at maximum-lockout commitment level + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ``` #### solana-help ```text -solana-help +solana-help Prints this message or the help of the given subcommand(s) USAGE: @@ -665,71 +951,121 @@ ARGS: ... The subcommand whose help message to display ``` +#### solana-new-nonce +```text +solana-new-nonce +Generate a new nonce, rendering the existing nonce useless + +USAGE: + solana new-nonce [FLAGS] [OPTIONS] + +FLAGS: + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header + +OPTIONS: + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json + --nonce-authority Specify nonce authority if different from account + +ARGS: + Address of the nonce account +``` + #### solana-pay ```text -solana-pay +solana-pay Send a payment USAGE: - solana pay [FLAGS] [OPTIONS] [--] [UNIT] + solana pay [FLAGS] [OPTIONS] [--] [UNIT] FLAGS: - --cancelable - -h, --help Prints help information - -V, --version Prints version information + --cancelable + -h, --help Prints help information + --sign-only Sign the transaction offline + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + --blockhash Use the supplied blockhash -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] -u, --url JSON RPC URL for the solana cluster -k, --keypair /path/to/id.json + --signer ... Provide a public-key/signature pair for the transaction --after A timestamp after which transaction will execute --require-timestamp-from Require timestamp from this third party --require-signature-from ... Any third party signatures required to unlock the lamports ARGS: - The pubkey of recipient - The amount to send (default unit SOL) - Specify unit to use for request [possible values: SOL, lamports] + The pubkey of recipient + The amount to send (default unit SOL) + Specify unit to use for request [possible values: SOL, lamports] ``` #### solana-ping ```text -solana-ping +solana-ping Submit transactions sequentially USAGE: - solana ping [OPTIONS] + solana ping [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + --confirmed Wait until the transaction is confirmed at maximum-lockout commitment level + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -c, --count Stop after submitting count transactions - -i, --interval Wait interval seconds between submitting the next transaction [default: 2] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json - -t, --timeout Wait up to timeout seconds for transaction confirmation [default: 10] + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -c, --count Stop after submitting count transactions + -i, --interval Wait interval seconds between submitting the next transaction [default: 2] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json + --lamports Number of lamports to transfer for each transaction [default: 1] + -t, --timeout Wait up to timeout seconds for transaction confirmation [default: 15] ``` #### solana-redeem-vote-credits ```text -solana-redeem-vote-credits +solana-redeem-vote-credits Redeem credits in the stake account USAGE: - solana redeem-vote-credits [OPTIONS] + solana redeem-vote-credits [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ARGS: Address of the stake account in which to redeem credits @@ -738,20 +1074,26 @@ ARGS: #### solana-send-signature ```text -solana-send-signature +solana-send-signature Send a signature to authorize a transfer USAGE: - solana send-signature [OPTIONS] + solana send-signature [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ARGS: The pubkey of recipient @@ -760,21 +1102,27 @@ ARGS: #### solana-send-timestamp ```text -solana-send-timestamp +solana-send-timestamp Send a timestamp to unlock a transfer USAGE: - solana send-timestamp [OPTIONS] + solana send-timestamp [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - --date Optional arbitrary timestamp to apply - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + --date Optional arbitrary timestamp to apply + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ARGS: The pubkey of recipient @@ -783,83 +1131,184 @@ ARGS: #### solana-set ```text -solana-set +solana-set Set a cli config setting USAGE: - solana set [OPTIONS] <--url |--keypair > + solana set [FLAGS] [OPTIONS] <--url |--keypair > FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ``` #### solana-show-account ```text -solana-show-account +solana-show-account Show the contents of an account USAGE: solana show-account [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - --lamports Display balance in lamports instead of SOL - -V, --version Prints version information + -h, --help Prints help information + --lamports Display balance in lamports instead of SOL + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json - -o, --output Write the account data to this file + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json + -o, --output Write the account data to this file ARGS: Account pubkey ``` +#### solana-show-gossip +```text +solana-show-gossip +Show the current gossip network nodes + +USAGE: + solana show-gossip [FLAGS] [OPTIONS] + +FLAGS: + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header + +OPTIONS: + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json +``` + +#### solana-show-nonce-account +```text +solana-show-nonce-account +Show the contents of a nonce account + +USAGE: + solana show-nonce-account [FLAGS] [OPTIONS] + +FLAGS: + -h, --help Prints help information + --lamports Display balance in lamports instead of SOL + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header + +OPTIONS: + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json + +ARGS: + Address of the nonce account to display +``` + #### solana-show-stake-account ```text -solana-show-stake-account +solana-show-stake-account Show the contents of a stake account USAGE: solana show-stake-account [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - --lamports Display balance in lamports instead of SOL - -V, --version Prints version information + -h, --help Prints help information + --lamports Display balance in lamports instead of SOL + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ARGS: Address of the stake account to display ``` +#### solana-show-stake-history +```text +solana-show-stake-history +Show the stake history + +USAGE: + solana show-stake-history [FLAGS] [OPTIONS] + +FLAGS: + -h, --help Prints help information + --lamports Display balance in lamports instead of SOL + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header + +OPTIONS: + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json +``` + #### solana-show-storage-account ```text -solana-show-storage-account +solana-show-storage-account Show the contents of a storage account USAGE: - solana show-storage-account [OPTIONS] + solana show-storage-account [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ARGS: Storage account pubkey @@ -867,40 +1316,52 @@ ARGS: #### solana-show-validators ```text -solana-show-validators +solana-show-validators Show information about the current validators USAGE: solana show-validators [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - --lamports Display balance in lamports instead of SOL - -V, --version Prints version information + -h, --help Prints help information + --lamports Display balance in lamports instead of SOL + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ``` #### solana-show-vote-account ```text -solana-show-vote-account +solana-show-vote-account Show the contents of a vote account USAGE: solana show-vote-account [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - --lamports Display balance in lamports instead of SOL - -V, --version Prints version information + -h, --help Prints help information + --lamports Display balance in lamports instead of SOL + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ARGS: Vote account pubkey @@ -908,20 +1369,26 @@ ARGS: #### solana-stake-authorize-staker ```text -solana-stake-authorize-staker +solana-stake-authorize-staker Authorize a new stake signing keypair for the given stake account USAGE: - solana stake-authorize-staker [OPTIONS] + solana stake-authorize-staker [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ARGS: Stake account in which to set the authorized staker @@ -930,20 +1397,26 @@ ARGS: #### solana-stake-authorize-withdrawer ```text -solana-stake-authorize-withdrawer +solana-stake-authorize-withdrawer Authorize a new withdraw signing keypair for the given stake account USAGE: - solana stake-authorize-withdrawer [OPTIONS] + solana stake-authorize-withdrawer [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ARGS: Stake account in which to set the authorized withdrawer @@ -952,22 +1425,28 @@ ARGS: #### solana-uptime ```text -solana-uptime +solana-uptime Show the uptime of a validator, based on epoch voting history USAGE: solana uptime [FLAGS] [OPTIONS] FLAGS: - --aggregate Aggregate uptime data across span - -h, --help Prints help information - -V, --version Prints version information + --aggregate Aggregate uptime data across span + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json - --span Number of recent epochs to examine + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json + --span Number of recent epochs to examine ARGS: Vote account pubkey @@ -975,20 +1454,26 @@ ARGS: #### solana-validator-info ```text -solana-validator-info +solana-validator-info Publish/get Validator info on Solana USAGE: - solana validator-info [OPTIONS] [SUBCOMMAND] + solana validator-info [FLAGS] [OPTIONS] [SUBCOMMAND] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json SUBCOMMANDS: get Get and parse Solana Validator info @@ -998,20 +1483,26 @@ SUBCOMMANDS: #### solana-vote-authorize-voter ```text -solana-vote-authorize-voter +solana-vote-authorize-voter Authorize a new vote signing keypair for the given vote account USAGE: - solana vote-authorize-voter [OPTIONS] + solana vote-authorize-voter [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ARGS: Vote account in which to set the authorized voter @@ -1020,46 +1511,119 @@ ARGS: #### solana-vote-authorize-withdrawer ```text -solana-vote-authorize-withdrawer +solana-vote-authorize-withdrawer Authorize a new withdraw signing keypair for the given vote account USAGE: - solana vote-authorize-withdrawer [OPTIONS] + solana vote-authorize-withdrawer [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ARGS: Vote account in which to set the authorized withdrawer New withdrawer to authorize ``` +#### solana-vote-update-validator +```text +solana-vote-update-validator +Update the vote account's validator identity + +USAGE: + solana vote-update-validator [FLAGS] [OPTIONS] + +FLAGS: + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header + +OPTIONS: + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json + +ARGS: + Vote account to update + New validator that will vote with this account + Authorized voter keypair +``` + +#### solana-withdraw-from-nonce-account +```text +solana-withdraw-from-nonce-account +Withdraw lamports from the nonce account + +USAGE: + solana withdraw-from-nonce-account [FLAGS] [OPTIONS] [UNIT] + +FLAGS: + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header + +OPTIONS: + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json + --nonce-authority Specify nonce authority if different from account + +ARGS: + Nonce account from to withdraw from + The account to which the lamports should be transferred + The amount to withdraw from the nonce account (default unit SOL) + Specify unit to use for request [possible values: SOL, lamports] +``` + #### solana-withdraw-stake ```text -solana-withdraw-stake +solana-withdraw-stake Withdraw the unstaked lamports from the stake account USAGE: - solana withdraw-stake [OPTIONS] [UNIT] + solana withdraw-stake [FLAGS] [OPTIONS] [UNIT] FLAGS: - -h, --help Prints help information - -V, --version Prints version information + -h, --help Prints help information + --skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39 + official English word list + -V, --version Prints version information + -v, --verbose Show extra information header OPTIONS: - -C, --config Configuration file to use [default: ~/.config/solana/cli/config.yml] - -u, --url JSON RPC URL for the solana cluster - -k, --keypair /path/to/id.json + --ask-seed-phrase Securely recover a keypair using a seed phrase and optional passphrase + [possible values: keypair] + -C, --config Configuration file to use [default: + ~/.config/solana/cli/config.yml] + -u, --url JSON RPC URL for the solana cluster + -k, --keypair /path/to/id.json ARGS: Stake account from which to withdraw - The account to which the lamports should be transfered + The account to which the lamports should be transferred The amount to withdraw from the stake account (default unit SOL) Specify unit to use for request [possible values: SOL, lamports] ``` + diff --git a/clap-utils/Cargo.toml b/clap-utils/Cargo.toml index 70c40f4f8d..aaca006dc6 100644 --- a/clap-utils/Cargo.toml +++ b/clap-utils/Cargo.toml @@ -15,6 +15,7 @@ semver = "0.9.0" solana-sdk = { path = "../sdk", version = "0.22.0" } tiny-bip39 = "0.6.2" url = "2.1.0" +chrono = "0.4" [lib] name = "solana_clap_utils" diff --git a/clap-utils/src/input_parsers.rs b/clap-utils/src/input_parsers.rs index 47b9f8de3f..e8ffc5755a 100644 --- a/clap-utils/src/input_parsers.rs +++ b/clap-utils/src/input_parsers.rs @@ -1,6 +1,8 @@ use crate::keypair::{keypair_from_seed_phrase, ASK_KEYWORD, SKIP_SEED_PHRASE_VALIDATION_ARG}; +use chrono::DateTime; use clap::ArgMatches; use solana_sdk::{ + clock::UnixTimestamp, native_token::sol_to_lamports, pubkey::Pubkey, signature::{read_keypair_file, Keypair, KeypairUtil, Signature}, @@ -31,6 +33,14 @@ where } } +pub fn unix_timestamp_of(matches: &ArgMatches<'_>, name: &str) -> Option { + matches.value_of(name).and_then(|value| { + DateTime::parse_from_rfc3339(value) + .ok() + .map(|date_time| date_time.timestamp()) + }) +} + // Return the keypair for an argument with filename `name` or None if not present. pub fn keypair_of(matches: &ArgMatches<'_>, name: &str) -> Option { if let Some(value) = matches.value_of(name) { diff --git a/cli/src/cli.rs b/cli/src/cli.rs index e979744f29..eef2bce583 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -287,7 +287,7 @@ pub struct CliConfig { pub keypair: Keypair, pub keypair_path: Option, pub rpc_client: Option, - pub print_header: bool, + pub verbose: bool, } impl CliConfig { @@ -313,7 +313,7 @@ impl Default for CliConfig { keypair: Keypair::new(), keypair_path: Some(Self::default_keypair_path()), rpc_client: None, - print_header: true, + verbose: false, } } } @@ -1073,14 +1073,10 @@ fn process_witness( } pub fn process_command(config: &CliConfig) -> ProcessResult { - if config.print_header { + if config.verbose { if let Some(keypair_path) = &config.keypair_path { println_name_value("Keypair:", keypair_path); } - if let CliCommand::Address = config.command { - // Get address of this client - return Ok(format!("{}", config.keypair.pubkey())); - } println_name_value("RPC Endpoint:", &config.json_rpc_url); } @@ -1095,6 +1091,8 @@ pub fn process_command(config: &CliConfig) -> ProcessResult { match &config.command { // Cluster Query Commands + // Get address of this client + CliCommand::Address => Ok(format!("{}", config.keypair.pubkey())), // Return software version of solana-cli and cluster entrypoint node CliCommand::Catchup { node_pubkey } => process_catchup(&rpc_client, node_pubkey), @@ -1383,8 +1381,6 @@ pub fn process_command(config: &CliConfig) -> ProcessResult { // Wallet Commands - // Get address of this client - CliCommand::Address => unreachable!(), // Request an airdrop from Solana Faucet; CliCommand::Airdrop { faucet_host, @@ -2460,6 +2456,7 @@ mod tests { withdrawer: None, lockup: Lockup { epoch: 0, + unix_timestamp: 0, custodian, }, lamports: 1234, diff --git a/cli/src/main.rs b/cli/src/main.rs index f0c54d4cd8..d7e92a2f9a 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -133,15 +133,13 @@ pub fn parse_args(matches: &ArgMatches<'_>) -> Result Result<(), Box> { .help("/path/to/id.json"), ) .arg( - Arg::with_name("no_header") - .long("no-header") + Arg::with_name("verbose") + .long("verbose") + .short("v") .global(true) - .help("Disable information header"), + .help("Show extra information header"), ) .arg( Arg::with_name(ASK_SEED_PHRASE_ARG.name) diff --git a/cli/src/stake.rs b/cli/src/stake.rs index 3a3cae416e..9566c566be 100644 --- a/cli/src/stake.rs +++ b/cli/src/stake.rs @@ -73,11 +73,18 @@ impl StakeSubCommands for App<'_, '_> { .help("Identity of the custodian (can withdraw before lockup expires)") ) .arg( - Arg::with_name("lockup") - .long("lockup") - .value_name("SLOT") + Arg::with_name("lockup_epoch") + .long("lockup-epoch") + .value_name("EPOCH") .takes_value(true) - .help("The slot height at which this account will be available for withdrawal") + .help("The epoch height at which this account will be available for withdrawal") + ) + .arg( + Arg::with_name("lockup_date") + .long("lockup-date") + .value_name("RFC3339 DATE TIME") + .takes_value(true) + .help("The date and time at which this account will be available for withdrawal") ) .arg( Arg::with_name("authorized_staker") @@ -322,7 +329,8 @@ impl StakeSubCommands for App<'_, '_> { pub fn parse_stake_create_account(matches: &ArgMatches<'_>) -> Result { let stake_account = keypair_of(matches, "stake_account").unwrap(); - let epoch = value_of(&matches, "lockup").unwrap_or(0); + let epoch = value_of(&matches, "lockup_epoch").unwrap_or(0); + let unix_timestamp = unix_timestamp_of(&matches, "lockup_date").unwrap_or(0); let custodian = pubkey_of(matches, "custodian").unwrap_or_default(); let staker = pubkey_of(matches, "authorized_staker"); let withdrawer = pubkey_of(matches, "authorized_withdrawer"); @@ -333,7 +341,11 @@ pub fn parse_stake_create_account(matches: &ArgMatches<'_>) -> Result Result<(), Box> { ..GenesisConfig::default() }; - if let Some(creation_time) = matches.value_of("creation_time") { - genesis_config.creation_time = DateTime::parse_from_rfc3339(creation_time)?.timestamp(); + if let Some(creation_time) = unix_timestamp_of(&matches, "creation_time") { + genesis_config.creation_time = creation_time; } if let Some(faucet_pubkey) = faucet_pubkey { diff --git a/genesis/src/stakes.rs b/genesis/src/stakes.rs index 8f74ec568b..fbabcb30a2 100644 --- a/genesis/src/stakes.rs +++ b/genesis/src/stakes.rs @@ -109,6 +109,7 @@ pub fn create_and_add_stakes( let lockup = Lockup { epoch: unlock.epoch, custodian, + unix_timestamp: 0, }; for _ in 0..(lamports / granularity).saturating_sub(1) { genesis_config.add_account( diff --git a/programs/stake/src/stake_state.rs b/programs/stake/src/stake_state.rs index cc54b9727e..5a05fa4270 100644 --- a/programs/stake/src/stake_state.rs +++ b/programs/stake/src/stake_state.rs @@ -8,7 +8,7 @@ use serde_derive::{Deserialize, Serialize}; use solana_sdk::{ account::{Account, KeyedAccount}, account_utils::State, - clock::{Clock, Epoch, Slot}, + clock::{Clock, Epoch, Slot, UnixTimestamp}, instruction::InstructionError, pubkey::Pubkey, rent::Rent, @@ -86,7 +86,10 @@ pub enum StakeAuthorize { #[derive(Default, Debug, Serialize, Deserialize, PartialEq, Clone, Copy)] pub struct Lockup { - /// epoch at which this stake will allow withdrawal, unless + /// UnixTimestamp at which this stake will allow withdrawal, unless + /// to the custodian. + pub unix_timestamp: UnixTimestamp, + /// epoch height at which this stake will allow withdrawal, unless /// to the custodian pub epoch: Epoch, /// custodian account, the only account to which this stake will honor a @@ -95,6 +98,13 @@ pub struct Lockup { pub custodian: Pubkey, } +impl Lockup { + pub fn is_in_force(&self, clock: &Clock, signers: &HashSet) -> bool { + (self.unix_timestamp > clock.unix_timestamp || self.epoch > clock.epoch) + && !signers.contains(&self.custodian) + } +} + #[derive(Default, Debug, Serialize, Deserialize, PartialEq, Clone, Copy)] pub struct Authorized { pub staker: Pubkey, @@ -754,8 +764,8 @@ impl<'a> StakeAccount for KeyedAccount<'a> { }; // verify that lockup has expired or that the withdrawal is signed by - // the custodian - if lockup.epoch > clock.epoch && !signers.contains(&lockup.custodian) { + // the custodian, both epoch and unix_timestamp must have passed + if lockup.is_in_force(&clock, signers) { return Err(StakeError::LockupInForce.into()); } @@ -1404,6 +1414,7 @@ mod tests { &Authorized::auto(&stake_pubkey), &Lockup { epoch: 1, + unix_timestamp: 0, custodian }, &Rent::free(), @@ -1415,6 +1426,7 @@ mod tests { StakeState::from(&stake_keyed_account.account).unwrap(), StakeState::Initialized(Meta { lockup: Lockup { + unix_timestamp: 0, epoch: 1, custodian }, @@ -1555,6 +1567,7 @@ mod tests { .initialize( &Authorized::auto(&stake_pubkey), &Lockup { + unix_timestamp: 0, epoch: 0, custodian, }, @@ -1759,6 +1772,7 @@ mod tests { total_lamports, &StakeState::Initialized(Meta { lockup: Lockup { + unix_timestamp: 0, epoch: 1, custodian, }, @@ -2591,6 +2605,77 @@ mod tests { } } + #[test] + fn test_lockup_is_expired() { + let custodian = Pubkey::new_rand(); + let signers = [custodian].iter().cloned().collect::>(); + let lockup = Lockup { + epoch: 1, + unix_timestamp: 1, + custodian, + }; + // neither time + assert_eq!( + lockup.is_in_force( + &Clock { + epoch: 0, + unix_timestamp: 0, + ..Clock::default() + }, + &HashSet::new() + ), + true + ); + // not timestamp + assert_eq!( + lockup.is_in_force( + &Clock { + epoch: 2, + unix_timestamp: 0, + ..Clock::default() + }, + &HashSet::new() + ), + true + ); + // not epoch + assert_eq!( + lockup.is_in_force( + &Clock { + epoch: 0, + unix_timestamp: 2, + ..Clock::default() + }, + &HashSet::new() + ), + true + ); + // both, no custodian + assert_eq!( + lockup.is_in_force( + &Clock { + epoch: 1, + unix_timestamp: 1, + ..Clock::default() + }, + &HashSet::new() + ), + false + ); + // neither, but custodian + assert_eq!( + lockup.is_in_force( + &Clock { + epoch: 0, + unix_timestamp: 0, + ..Clock::default() + }, + &signers, + ), + false, + ); + } + #[test] fn test_authorize_delegated_stake() { let stake_pubkey = Pubkey::new_rand();