Cli: Remove units from various subcommands (#8301)
* Cli: Remove unit arg from various subcommands * Update book usage page * Update scripts and docs
This commit is contained in:
parent
9bcca268a3
commit
b997d3eb4e
|
@ -22,12 +22,6 @@ $ solana airdrop 2
|
|||
|
||||
// Return
|
||||
"2.00000000 SOL"
|
||||
|
||||
// Command
|
||||
$ solana airdrop 123 --lamports
|
||||
|
||||
// Return
|
||||
"123 lamports"
|
||||
```
|
||||
|
||||
### Get Balance
|
||||
|
|
|
@ -191,12 +191,17 @@ FLAGS:
|
|||
-v, --verbose Show extra information header
|
||||
|
||||
OPTIONS:
|
||||
--ask-seed-phrase <KEYPAIR NAME> Recover a keypair using a seed phrase and optional passphrase [possible
|
||||
values: keypair]
|
||||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
--ask-seed-phrase <KEYPAIR NAME>
|
||||
Recover a keypair using a seed phrase and optional passphrase [possible values: keypair]
|
||||
|
||||
-C, --config <PATH>
|
||||
Configuration file to use [default: ~/.config/solana/cli/config.yml]
|
||||
|
||||
--derivation-path <ACCOUNT or ACCOUNT/CHANGE>
|
||||
Derivation path to use: m/44'/501'/ACCOUNT'/CHANGE'; default key is device base pubkey: m/44'/501'/0'
|
||||
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
SUBCOMMANDS:
|
||||
account Show the contents of an account
|
||||
|
@ -226,6 +231,8 @@ SUBCOMMANDS:
|
|||
genesis-hash Get the genesis hash
|
||||
gossip Show the current gossip network nodes
|
||||
help Prints this message or the help of the given subcommand(s)
|
||||
leader-schedule Display leader schedule
|
||||
live-slots Show information about the current slot progression
|
||||
new-nonce Generate a new nonce, rendering the existing nonce useless
|
||||
nonce Get the current nonce value
|
||||
nonce-account Show the contents of a nonce account
|
||||
|
@ -233,14 +240,17 @@ SUBCOMMANDS:
|
|||
ping Submit transactions sequentially
|
||||
send-signature Send a signature to authorize a transfer
|
||||
send-timestamp Send a timestamp to unlock a transfer
|
||||
show-stake-account Show the contents of a stake account
|
||||
slot Get current slot
|
||||
split-stake Split a stake account
|
||||
stake-account Show the contents of a stake 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
|
||||
stake-history Show the stake history
|
||||
stake-set-lockup Set Lockup for the stake account
|
||||
stakes Show stake account information
|
||||
storage-account Show the contents of a storage account
|
||||
transaction-count Get current transaction count
|
||||
transfer Transfer funds between system accounts
|
||||
validator-info Publish/get Validator info on Solana
|
||||
validators Show summary information about the current validators
|
||||
vote-account Show the contents of a vote account
|
||||
|
@ -273,7 +283,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
-o, --output <FILE> Write the account data to this file
|
||||
|
||||
ARGS:
|
||||
|
@ -301,7 +311,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
```
|
||||
|
||||
#### solana-airdrop
|
||||
|
@ -310,7 +320,7 @@ solana-airdrop
|
|||
Request lamports
|
||||
|
||||
USAGE:
|
||||
solana airdrop [FLAGS] [OPTIONS] <AMOUNT> [UNIT]
|
||||
solana airdrop [FLAGS] [OPTIONS] <AMOUNT>
|
||||
|
||||
FLAGS:
|
||||
-h, --help Prints help information
|
||||
|
@ -327,11 +337,10 @@ OPTIONS:
|
|||
--faucet-host <HOST> Faucet host to use [default: the --url host]
|
||||
--faucet-port <PORT> Faucet port to use [default: 9900]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<AMOUNT> The airdrop amount to request (default unit SOL)
|
||||
<UNIT> Specify unit to use for request and balance display [possible values: SOL, lamports]
|
||||
<AMOUNT> The airdrop amount to request, in SOL
|
||||
```
|
||||
|
||||
#### solana-authorize-nonce-account
|
||||
|
@ -357,7 +366,7 @@ OPTIONS:
|
|||
Configuration file to use [default: ~/.config/solana/cli/config.yml]
|
||||
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
--nonce-authority <KEYPAIR or PUBKEY>
|
||||
Provide the nonce authority keypair to use when signing a nonced transaction
|
||||
|
||||
|
@ -392,7 +401,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<PUBKEY> The public key of the balance to check
|
||||
|
@ -420,7 +429,7 @@ OPTIONS:
|
|||
~/.config/solana/cli/config.yml]
|
||||
--epoch <epoch> Epoch to show block production for [default: current epoch]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
--slot-limit <slot_limit> Limit results to this many slots from the end of the epoch [default: full
|
||||
epoch]
|
||||
```
|
||||
|
@ -446,7 +455,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<SLOT> Slot number of the block to query
|
||||
|
@ -473,7 +482,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<PROCESS ID> The process id of the transfer to cancel
|
||||
|
@ -500,7 +509,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<PUBKEY> Identity pubkey of the validator
|
||||
|
@ -527,7 +536,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<NODE PUBKEY> The node account to credit the rewards to
|
||||
|
@ -555,7 +564,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
```
|
||||
|
||||
#### solana-config
|
||||
|
@ -579,7 +588,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
SUBCOMMANDS:
|
||||
get Get current config settings
|
||||
|
@ -608,7 +617,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<SIGNATURE> The transaction signature to confirm
|
||||
|
@ -636,7 +645,7 @@ OPTIONS:
|
|||
~/.config/solana/cli/config.yml]
|
||||
--from <PUBKEY> From (base) key, defaults to client keypair.
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<SEED_STRING> The seed. Must not take more than 32 bytes to encode as utf-8
|
||||
|
@ -665,7 +674,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<STORAGE ACCOUNT OWNER PUBKEY>
|
||||
|
@ -678,7 +687,7 @@ solana-create-nonce-account
|
|||
Create a nonce account
|
||||
|
||||
USAGE:
|
||||
solana create-nonce-account [FLAGS] [OPTIONS] <NONCE ACCOUNT> <AMOUNT> [UNIT]
|
||||
solana create-nonce-account [FLAGS] [OPTIONS] <NONCE ACCOUNT> <AMOUNT>
|
||||
|
||||
FLAGS:
|
||||
-h, --help Prints help information
|
||||
|
@ -693,13 +702,12 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
--nonce-authority <BASE58_PUBKEY> Assign noncing authority to another entity
|
||||
|
||||
ARGS:
|
||||
<NONCE ACCOUNT> Keypair of the nonce account to fund
|
||||
<AMOUNT> The amount to load the nonce account with (default unit SOL)
|
||||
<UNIT> Specify unit to use for request [possible values: SOL, lamports]
|
||||
<AMOUNT> The amount to load the nonce account with, in SOL
|
||||
```
|
||||
|
||||
#### solana-create-stake-account
|
||||
|
@ -708,34 +716,56 @@ solana-create-stake-account
|
|||
Create a stake account
|
||||
|
||||
USAGE:
|
||||
solana create-stake-account [FLAGS] [OPTIONS] <STAKE ACCOUNT> <AMOUNT> [UNIT]
|
||||
solana create-stake-account [FLAGS] [OPTIONS] <STAKE ACCOUNT> <AMOUNT>
|
||||
|
||||
FLAGS:
|
||||
-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 <KEYPAIR NAME> Recover a keypair using a seed phrase and optional passphrase [possible
|
||||
values: keypair]
|
||||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
--custodian <PUBKEY> Identity of the custodian (can withdraw before lockup expires)
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
--lockup-date <RFC3339 DATE TIME> The date and time at which this account will be available for withdrawal
|
||||
--lockup-epoch <EPOCH> The epoch height at which this account will be available for withdrawal
|
||||
--seed <SEED STRING> Seed for address generation; if specified, the resulting account will be at
|
||||
a derived address of the STAKE ACCOUNT pubkey
|
||||
--stake-authority <PUBKEY> Public key of authorized staker (defaults to cli config pubkey)
|
||||
--withdraw-authority <PUBKEY> Public key of authorized withdrawer (defaults to cli config pubkey)
|
||||
--ask-seed-phrase <KEYPAIR NAME>
|
||||
Recover a keypair using a seed phrase and optional passphrase [possible values: keypair]
|
||||
|
||||
--blockhash <BLOCKHASH> Use the supplied blockhash
|
||||
-C, --config <PATH>
|
||||
Configuration file to use [default: ~/.config/solana/cli/config.yml]
|
||||
|
||||
--custodian <KEYPAIR or PUBKEY> Identity of the custodian (can withdraw before lockup expires)
|
||||
--fee-payer <KEYPAIR or PUBKEY>
|
||||
Specify the fee-payer account. This may be a keypair file, the ASK keyword
|
||||
or the pubkey of an offline signer, provided an appropriate --signer argument
|
||||
is also passed. Defaults to the client keypair.
|
||||
--from <KEYPAIR or PUBKEY> Source account of funds (if different from client local account)
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
--lockup-date <RFC3339 DATE TIME>
|
||||
The date and time at which this account will be available for withdrawal
|
||||
|
||||
--lockup-epoch <EPOCH>
|
||||
The epoch height at which this account will be available for withdrawal
|
||||
|
||||
--nonce <PUBKEY>
|
||||
Provide the nonce account to use when creating a nonced
|
||||
transaction. Nonced transactions are useful when a transaction
|
||||
requires a lengthy signing process. Learn more about nonced
|
||||
transactions at https://docs.solana.com/offline-signing/durable-nonce
|
||||
--nonce-authority <KEYPAIR or PUBKEY>
|
||||
Provide the nonce authority keypair to use when signing a nonced transaction
|
||||
|
||||
--seed <SEED STRING>
|
||||
Seed for address generation; if specified, the resulting account will be at a derived address of the STAKE
|
||||
ACCOUNT pubkey
|
||||
--signer <BASE58_PUBKEY=BASE58_SIG>... Provide a public-key/signature pair for the transaction
|
||||
--stake-authority <PUBKEY> Public key of authorized staker (defaults to cli config pubkey)
|
||||
--withdraw-authority <PUBKEY> Public key of authorized withdrawer (defaults to cli config pubkey)
|
||||
|
||||
ARGS:
|
||||
<STAKE ACCOUNT> Keypair of the stake account to fund
|
||||
<AMOUNT> The amount of send to the vote account (default unit SOL)
|
||||
<UNIT> Specify unit to use for request [possible values: SOL, lamports]
|
||||
<STAKE ACCOUNT> Signing authority of the stake address to fund
|
||||
<AMOUNT> The amount of send to the vote account, in SOL
|
||||
```
|
||||
|
||||
#### solana-create-validator-storage-account
|
||||
|
@ -759,7 +789,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<STORAGE ACCOUNT OWNER PUBKEY>
|
||||
|
@ -790,7 +820,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
--seed <SEED STRING> Seed for address generation; if specified, the resulting account will be at
|
||||
a derived address of the VOTE ACCOUNT pubkey
|
||||
|
||||
|
@ -819,12 +849,16 @@ OPTIONS:
|
|||
--ask-seed-phrase <KEYPAIR NAME>
|
||||
Recover a keypair using a seed phrase and optional passphrase [possible values: keypair]
|
||||
|
||||
--blockhash <BLOCKHASH> Use the supplied blockhash
|
||||
--blockhash <BLOCKHASH> Use the supplied blockhash
|
||||
-C, --config <PATH>
|
||||
Configuration file to use [default: ~/.config/solana/cli/config.yml]
|
||||
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
--fee-payer <KEYPAIR or PUBKEY>
|
||||
Specify the fee-payer account. This may be a keypair file, the ASK keyword
|
||||
or the pubkey of an offline signer, provided an appropriate --signer argument
|
||||
is also passed. Defaults to the client keypair.
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
--nonce <PUBKEY>
|
||||
Provide the nonce account to use when creating a nonced
|
||||
transaction. Nonced transactions are useful when a transaction
|
||||
|
@ -833,8 +867,8 @@ OPTIONS:
|
|||
--nonce-authority <KEYPAIR or PUBKEY>
|
||||
Provide the nonce authority keypair to use when signing a nonced transaction
|
||||
|
||||
--signer <PUBKEY=BASE58_SIG>... Provide a public-key/signature pair for the transaction
|
||||
--stake-authority <KEYPAIR of PUBKEY> Public key of authorized staker (defaults to cli config pubkey)
|
||||
--signer <BASE58_PUBKEY=BASE58_SIG>... Provide a public-key/signature pair for the transaction
|
||||
--stake-authority <KEYPAIR or PUBKEY> Public key of authorized staker (defaults to cli config pubkey)
|
||||
|
||||
ARGS:
|
||||
<STAKE ACCOUNT> Stake account to be deactivated.
|
||||
|
@ -860,12 +894,16 @@ OPTIONS:
|
|||
--ask-seed-phrase <KEYPAIR NAME>
|
||||
Recover a keypair using a seed phrase and optional passphrase [possible values: keypair]
|
||||
|
||||
--blockhash <BLOCKHASH> Use the supplied blockhash
|
||||
--blockhash <BLOCKHASH> Use the supplied blockhash
|
||||
-C, --config <PATH>
|
||||
Configuration file to use [default: ~/.config/solana/cli/config.yml]
|
||||
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
--fee-payer <KEYPAIR or PUBKEY>
|
||||
Specify the fee-payer account. This may be a keypair file, the ASK keyword
|
||||
or the pubkey of an offline signer, provided an appropriate --signer argument
|
||||
is also passed. Defaults to the client keypair.
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
--nonce <PUBKEY>
|
||||
Provide the nonce account to use when creating a nonced
|
||||
transaction. Nonced transactions are useful when a transaction
|
||||
|
@ -874,8 +912,8 @@ OPTIONS:
|
|||
--nonce-authority <KEYPAIR or PUBKEY>
|
||||
Provide the nonce authority keypair to use when signing a nonced transaction
|
||||
|
||||
--signer <PUBKEY=BASE58_SIG>... Provide a public-key/signature pair for the transaction
|
||||
--stake-authority <KEYPAIR of PUBKEY> Public key of authorized staker (defaults to cli config pubkey)
|
||||
--signer <BASE58_PUBKEY=BASE58_SIG>... Provide a public-key/signature pair for the transaction
|
||||
--stake-authority <KEYPAIR or PUBKEY> Public key of authorized staker (defaults to cli config pubkey)
|
||||
|
||||
ARGS:
|
||||
<STAKE ACCOUNT> Stake account to delegate
|
||||
|
@ -903,7 +941,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<PATH TO BPF PROGRAM> /path/to/program.o
|
||||
|
@ -931,7 +969,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
```
|
||||
|
||||
#### solana-fees
|
||||
|
@ -955,7 +993,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
```
|
||||
|
||||
#### solana-genesis-hash
|
||||
|
@ -979,7 +1017,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
```
|
||||
|
||||
#### solana-gossip
|
||||
|
@ -1003,7 +1041,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
```
|
||||
|
||||
#### solana-help
|
||||
|
@ -1018,6 +1056,55 @@ ARGS:
|
|||
<subcommand>... The subcommand whose help message to display
|
||||
```
|
||||
|
||||
#### solana-leader-schedule
|
||||
```text
|
||||
solana-leader-schedule
|
||||
Display leader schedule
|
||||
|
||||
USAGE:
|
||||
solana leader-schedule [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 <KEYPAIR NAME> Recover a keypair using a seed phrase and optional passphrase [possible
|
||||
values: keypair]
|
||||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
```
|
||||
|
||||
#### solana-live-slots
|
||||
```text
|
||||
solana-live-slots
|
||||
Show information about the current slot progression
|
||||
|
||||
USAGE:
|
||||
solana live-slots [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 <KEYPAIR NAME> Recover a keypair using a seed phrase and optional passphrase [possible
|
||||
values: keypair]
|
||||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
-w, --ws <URL> WebSocket URL for PubSub RPC connection [default: ws://127.0.0.1:8900]
|
||||
```
|
||||
|
||||
#### solana-new-nonce
|
||||
```text
|
||||
solana-new-nonce
|
||||
|
@ -1041,7 +1128,7 @@ OPTIONS:
|
|||
Configuration file to use [default: ~/.config/solana/cli/config.yml]
|
||||
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
--nonce-authority <KEYPAIR or PUBKEY>
|
||||
Provide the nonce authority keypair to use when signing a nonced transaction
|
||||
|
||||
|
@ -1071,7 +1158,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<NONCE ACCOUNT> Address of the nonce account to display
|
||||
|
@ -1099,7 +1186,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<NONCE ACCOUNT> Address of the nonce account to display
|
||||
|
@ -1111,7 +1198,7 @@ solana-pay
|
|||
Send a payment
|
||||
|
||||
USAGE:
|
||||
solana pay [FLAGS] [OPTIONS] <TO PUBKEY> <AMOUNT> [--] [UNIT]
|
||||
solana pay [FLAGS] [OPTIONS] <TO PUBKEY> <AMOUNT>
|
||||
|
||||
FLAGS:
|
||||
--cancelable
|
||||
|
@ -1126,12 +1213,12 @@ OPTIONS:
|
|||
--ask-seed-phrase <KEYPAIR NAME>
|
||||
Recover a keypair using a seed phrase and optional passphrase [possible values: keypair]
|
||||
|
||||
--blockhash <BLOCKHASH> Use the supplied blockhash
|
||||
--blockhash <BLOCKHASH> Use the supplied blockhash
|
||||
-C, --config <PATH>
|
||||
Configuration file to use [default: ~/.config/solana/cli/config.yml]
|
||||
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
--nonce <PUBKEY>
|
||||
Provide the nonce account to use when creating a nonced
|
||||
transaction. Nonced transactions are useful when a transaction
|
||||
|
@ -1140,15 +1227,14 @@ OPTIONS:
|
|||
--nonce-authority <KEYPAIR or PUBKEY>
|
||||
Provide the nonce authority keypair to use when signing a nonced transaction
|
||||
|
||||
--signer <PUBKEY=BASE58_SIG>... Provide a public-key/signature pair for the transaction
|
||||
--after <DATETIME> A timestamp after which transaction will execute
|
||||
--require-timestamp-from <PUBKEY> Require timestamp from this third party
|
||||
--require-signature-from <PUBKEY>... Any third party signatures required to unlock the lamports
|
||||
--signer <BASE58_PUBKEY=BASE58_SIG>... Provide a public-key/signature pair for the transaction
|
||||
--after <DATETIME> A timestamp after which transaction will execute
|
||||
--require-timestamp-from <PUBKEY> Require timestamp from this third party
|
||||
--require-signature-from <PUBKEY>... Any third party signatures required to unlock the lamports
|
||||
|
||||
ARGS:
|
||||
<TO PUBKEY> The pubkey of recipient
|
||||
<AMOUNT> The amount to send (default unit SOL)
|
||||
<UNIT> Specify unit to use for request [possible values: SOL, lamports]
|
||||
<AMOUNT> The amount to send, in SOL
|
||||
```
|
||||
|
||||
#### solana-ping
|
||||
|
@ -1175,7 +1261,7 @@ OPTIONS:
|
|||
-c, --count <NUMBER> Stop after submitting count transactions
|
||||
-i, --interval <SECONDS> Wait interval seconds between submitting the next transaction [default: 2]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
--lamports <NUMBER> Number of lamports to transfer for each transaction [default: 1]
|
||||
-t, --timeout <SECONDS> Wait up to timeout seconds for transaction confirmation [default: 15]
|
||||
```
|
||||
|
@ -1201,7 +1287,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<PUBKEY> The pubkey of recipient
|
||||
|
@ -1230,41 +1316,13 @@ OPTIONS:
|
|||
~/.config/solana/cli/config.yml]
|
||||
--date <DATETIME> Optional arbitrary timestamp to apply
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<PUBKEY> The pubkey of recipient
|
||||
<PROCESS ID> The process id of the transfer to unlock
|
||||
```
|
||||
|
||||
#### solana-show-stake-account
|
||||
```text
|
||||
solana-show-stake-account
|
||||
Show the contents of a stake account
|
||||
|
||||
USAGE:
|
||||
solana show-stake-account [FLAGS] [OPTIONS] <STAKE ACCOUNT>
|
||||
|
||||
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 <KEYPAIR NAME> Recover a keypair using a seed phrase and optional passphrase [possible
|
||||
values: keypair]
|
||||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
|
||||
ARGS:
|
||||
<STAKE ACCOUNT> Address of the stake account to display
|
||||
```
|
||||
|
||||
#### solana-slot
|
||||
```text
|
||||
solana-slot
|
||||
|
@ -1287,7 +1345,85 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
```
|
||||
|
||||
#### solana-split-stake
|
||||
```text
|
||||
solana-split-stake
|
||||
Split a stake account
|
||||
|
||||
USAGE:
|
||||
solana split-stake [FLAGS] [OPTIONS] <STAKE ACCOUNT> <SPLIT STAKE ACCOUNT> <AMOUNT>
|
||||
|
||||
FLAGS:
|
||||
-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 <KEYPAIR NAME>
|
||||
Recover a keypair using a seed phrase and optional passphrase [possible values: keypair]
|
||||
|
||||
--blockhash <BLOCKHASH> Use the supplied blockhash
|
||||
-C, --config <PATH>
|
||||
Configuration file to use [default: ~/.config/solana/cli/config.yml]
|
||||
|
||||
--fee-payer <KEYPAIR or PUBKEY>
|
||||
Specify the fee-payer account. This may be a keypair file, the ASK keyword
|
||||
or the pubkey of an offline signer, provided an appropriate --signer argument
|
||||
is also passed. Defaults to the client keypair.
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
--nonce <PUBKEY>
|
||||
Provide the nonce account to use when creating a nonced
|
||||
transaction. Nonced transactions are useful when a transaction
|
||||
requires a lengthy signing process. Learn more about nonced
|
||||
transactions at https://docs.solana.com/offline-signing/durable-nonce
|
||||
--nonce-authority <KEYPAIR or PUBKEY>
|
||||
Provide the nonce authority keypair to use when signing a nonced transaction
|
||||
|
||||
--seed <SEED STRING>
|
||||
Seed for address generation; if specified, the resulting account will be at a derived address of the SPLIT
|
||||
STAKE ACCOUNT pubkey
|
||||
--signer <BASE58_PUBKEY=BASE58_SIG>... Provide a public-key/signature pair for the transaction
|
||||
--stake-authority <KEYPAIR or PUBKEY> Public key of authorized staker (defaults to cli config pubkey)
|
||||
|
||||
ARGS:
|
||||
<STAKE ACCOUNT> Stake account to be split
|
||||
<SPLIT STAKE ACCOUNT> Keypair of the new stake account to split funds into
|
||||
<AMOUNT> The amount to move into the new stake account, in unit SOL
|
||||
```
|
||||
|
||||
#### solana-stake-account
|
||||
```text
|
||||
solana-stake-account
|
||||
Show the contents of a stake account
|
||||
|
||||
USAGE:
|
||||
solana stake-account [FLAGS] [OPTIONS] <STAKE ACCOUNT>
|
||||
|
||||
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 <KEYPAIR NAME> Recover a keypair using a seed phrase and optional passphrase [possible
|
||||
values: keypair]
|
||||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<STAKE ACCOUNT> Address of the stake account to display
|
||||
```
|
||||
|
||||
#### solana-stake-authorize-staker
|
||||
|
@ -1310,12 +1446,16 @@ OPTIONS:
|
|||
--ask-seed-phrase <KEYPAIR NAME>
|
||||
Recover a keypair using a seed phrase and optional passphrase [possible values: keypair]
|
||||
|
||||
--blockhash <BLOCKHASH> Use the supplied blockhash
|
||||
--blockhash <BLOCKHASH> Use the supplied blockhash
|
||||
-C, --config <PATH>
|
||||
Configuration file to use [default: ~/.config/solana/cli/config.yml]
|
||||
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
--fee-payer <KEYPAIR or PUBKEY>
|
||||
Specify the fee-payer account. This may be a keypair file, the ASK keyword
|
||||
or the pubkey of an offline signer, provided an appropriate --signer argument
|
||||
is also passed. Defaults to the client keypair.
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
--nonce <PUBKEY>
|
||||
Provide the nonce account to use when creating a nonced
|
||||
transaction. Nonced transactions are useful when a transaction
|
||||
|
@ -1324,8 +1464,8 @@ OPTIONS:
|
|||
--nonce-authority <KEYPAIR or PUBKEY>
|
||||
Provide the nonce authority keypair to use when signing a nonced transaction
|
||||
|
||||
--signer <PUBKEY=BASE58_SIG>... Provide a public-key/signature pair for the transaction
|
||||
--stake-authority <KEYPAIR of PUBKEY> Public key of authorized staker (defaults to cli config pubkey)
|
||||
--signer <BASE58_PUBKEY=BASE58_SIG>... Provide a public-key/signature pair for the transaction
|
||||
--stake-authority <KEYPAIR or PUBKEY> Public key of authorized staker (defaults to cli config pubkey)
|
||||
|
||||
ARGS:
|
||||
<STAKE ACCOUNT> Stake account in which to set the authorized staker
|
||||
|
@ -1356,8 +1496,12 @@ OPTIONS:
|
|||
-C, --config <PATH>
|
||||
Configuration file to use [default: ~/.config/solana/cli/config.yml]
|
||||
|
||||
--fee-payer <KEYPAIR or PUBKEY>
|
||||
Specify the fee-payer account. This may be a keypair file, the ASK keyword
|
||||
or the pubkey of an offline signer, provided an appropriate --signer argument
|
||||
is also passed. Defaults to the client keypair.
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
--nonce <PUBKEY>
|
||||
Provide the nonce account to use when creating a nonced
|
||||
transaction. Nonced transactions are useful when a transaction
|
||||
|
@ -1366,7 +1510,7 @@ OPTIONS:
|
|||
--nonce-authority <KEYPAIR or PUBKEY>
|
||||
Provide the nonce authority keypair to use when signing a nonced transaction
|
||||
|
||||
--signer <PUBKEY=BASE58_SIG>... Provide a public-key/signature pair for the transaction
|
||||
--signer <BASE58_PUBKEY=BASE58_SIG>... Provide a public-key/signature pair for the transaction
|
||||
--withdraw-authority <KEYPAIR or PUBKEY> Public key of authorized withdrawer (defaults to cli config pubkey)
|
||||
|
||||
ARGS:
|
||||
|
@ -1396,7 +1540,61 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
```
|
||||
|
||||
#### solana-stake-set-lockup
|
||||
```text
|
||||
solana-stake-set-lockup
|
||||
Set Lockup for the stake account
|
||||
|
||||
USAGE:
|
||||
solana stake-set-lockup [FLAGS] [OPTIONS] <STAKE ACCOUNT>
|
||||
|
||||
FLAGS:
|
||||
-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 <KEYPAIR NAME>
|
||||
Recover a keypair using a seed phrase and optional passphrase [possible values: keypair]
|
||||
|
||||
--blockhash <BLOCKHASH> Use the supplied blockhash
|
||||
-C, --config <PATH>
|
||||
Configuration file to use [default: ~/.config/solana/cli/config.yml]
|
||||
|
||||
--custodian <KEYPAIR or PUBKEY> Public key of signing custodian (defaults to cli config pubkey)
|
||||
--fee-payer <KEYPAIR or PUBKEY>
|
||||
Specify the fee-payer account. This may be a keypair file, the ASK keyword
|
||||
or the pubkey of an offline signer, provided an appropriate --signer argument
|
||||
is also passed. Defaults to the client keypair.
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
--lockup-date <RFC3339 DATE TIME>
|
||||
The date and time at which this account will be available for withdrawal
|
||||
|
||||
--lockup-epoch <EPOCH>
|
||||
The epoch height at which this account will be available for withdrawal
|
||||
|
||||
--new-custodian <KEYPAIR or PUBKEY>
|
||||
Identity of the new lockup custodian (can withdraw before lockup expires)
|
||||
|
||||
--nonce <PUBKEY>
|
||||
Provide the nonce account to use when creating a nonced
|
||||
transaction. Nonced transactions are useful when a transaction
|
||||
requires a lengthy signing process. Learn more about nonced
|
||||
transactions at https://docs.solana.com/offline-signing/durable-nonce
|
||||
--nonce-authority <KEYPAIR or PUBKEY>
|
||||
Provide the nonce authority keypair to use when signing a nonced transaction
|
||||
|
||||
--signer <BASE58_PUBKEY=BASE58_SIG>... Provide a public-key/signature pair for the transaction
|
||||
|
||||
ARGS:
|
||||
<STAKE ACCOUNT> Stake account for which to set Lockup
|
||||
```
|
||||
|
||||
#### solana-stakes
|
||||
|
@ -1421,7 +1619,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<VOTE ACCOUNT PUBKEYS>... Only show stake accounts delegated to the provided vote accounts
|
||||
|
@ -1448,7 +1646,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<STORAGE ACCOUNT PUBKEY> Storage account pubkey
|
||||
|
@ -1476,7 +1674,53 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
```
|
||||
|
||||
#### solana-transfer
|
||||
```text
|
||||
solana-transfer
|
||||
Transfer funds between system accounts
|
||||
|
||||
USAGE:
|
||||
solana transfer [FLAGS] [OPTIONS] <TO PUBKEY> <AMOUNT>
|
||||
|
||||
FLAGS:
|
||||
-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 <KEYPAIR NAME>
|
||||
Recover a keypair using a seed phrase and optional passphrase [possible values: keypair]
|
||||
|
||||
--blockhash <BLOCKHASH> Use the supplied blockhash
|
||||
-C, --config <PATH>
|
||||
Configuration file to use [default: ~/.config/solana/cli/config.yml]
|
||||
|
||||
--fee-payer <KEYPAIR or PUBKEY>
|
||||
Specify the fee-payer account. This may be a keypair file, the ASK keyword
|
||||
or the pubkey of an offline signer, provided an appropriate --signer argument
|
||||
is also passed. Defaults to the client keypair.
|
||||
--from <KEYPAIR or PUBKEY> Source account of funds (if different from client local account)
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
--nonce <PUBKEY>
|
||||
Provide the nonce account to use when creating a nonced
|
||||
transaction. Nonced transactions are useful when a transaction
|
||||
requires a lengthy signing process. Learn more about nonced
|
||||
transactions at https://docs.solana.com/offline-signing/durable-nonce
|
||||
--nonce-authority <KEYPAIR or PUBKEY>
|
||||
Provide the nonce authority keypair to use when signing a nonced transaction
|
||||
|
||||
--signer <BASE58_PUBKEY=BASE58_SIG>... Provide a public-key/signature pair for the transaction
|
||||
|
||||
ARGS:
|
||||
<TO PUBKEY> The pubkey of recipient
|
||||
<AMOUNT> The amount to send, in SOL
|
||||
```
|
||||
|
||||
#### solana-validator-info
|
||||
|
@ -1500,7 +1744,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
SUBCOMMANDS:
|
||||
get Get and parse Solana Validator info
|
||||
|
@ -1530,7 +1774,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
```
|
||||
|
||||
#### solana-vote-account
|
||||
|
@ -1555,7 +1799,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<VOTE ACCOUNT PUBKEY> Vote account pubkey
|
||||
|
@ -1582,7 +1826,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<VOTE ACCOUNT PUBKEY> Vote account in which to set the authorized voter
|
||||
|
@ -1610,7 +1854,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<VOTE ACCOUNT PUBKEY> Vote account in which to set the authorized withdrawer
|
||||
|
@ -1638,7 +1882,7 @@ OPTIONS:
|
|||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
|
||||
ARGS:
|
||||
<VOTE ACCOUNT PUBKEY> Vote account to update
|
||||
|
@ -1652,7 +1896,7 @@ solana-withdraw-from-nonce-account
|
|||
Withdraw lamports from the nonce account
|
||||
|
||||
USAGE:
|
||||
solana withdraw-from-nonce-account [FLAGS] [OPTIONS] <NONCE ACCOUNT> <DESTINATION ACCOUNT> <AMOUNT> [UNIT]
|
||||
solana withdraw-from-nonce-account [FLAGS] [OPTIONS] <NONCE ACCOUNT> <DESTINATION ACCOUNT> <AMOUNT>
|
||||
|
||||
FLAGS:
|
||||
-h, --help Prints help information
|
||||
|
@ -1669,7 +1913,7 @@ OPTIONS:
|
|||
Configuration file to use [default: ~/.config/solana/cli/config.yml]
|
||||
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
--nonce-authority <KEYPAIR or PUBKEY>
|
||||
Provide the nonce authority keypair to use when signing a nonced transaction
|
||||
|
||||
|
@ -1677,8 +1921,7 @@ OPTIONS:
|
|||
ARGS:
|
||||
<NONCE ACCOUNT> Nonce account from to withdraw from
|
||||
<DESTINATION ACCOUNT> The account to which the lamports should be transferred
|
||||
<AMOUNT> The amount to withdraw from the nonce account (default unit SOL)
|
||||
<UNIT> Specify unit to use for request [possible values: SOL, lamports]
|
||||
<AMOUNT> The amount to withdraw from the nonce account, in SOL
|
||||
```
|
||||
|
||||
#### solana-withdraw-stake
|
||||
|
@ -1687,10 +1930,11 @@ solana-withdraw-stake
|
|||
Withdraw the unstaked lamports from the stake account
|
||||
|
||||
USAGE:
|
||||
solana withdraw-stake [FLAGS] [OPTIONS] <STAKE ACCOUNT> <DESTINATION ACCOUNT> <AMOUNT> [UNIT]
|
||||
solana withdraw-stake [FLAGS] [OPTIONS] <STAKE ACCOUNT> <DESTINATION ACCOUNT> <AMOUNT>
|
||||
|
||||
FLAGS:
|
||||
-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
|
||||
|
@ -1700,17 +1944,29 @@ OPTIONS:
|
|||
--ask-seed-phrase <KEYPAIR NAME>
|
||||
Recover a keypair using a seed phrase and optional passphrase [possible values: keypair]
|
||||
|
||||
--blockhash <BLOCKHASH> Use the supplied blockhash
|
||||
-C, --config <PATH>
|
||||
Configuration file to use [default: ~/.config/solana/cli/config.yml]
|
||||
|
||||
--fee-payer <KEYPAIR or PUBKEY>
|
||||
Specify the fee-payer account. This may be a keypair file, the ASK keyword
|
||||
or the pubkey of an offline signer, provided an appropriate --signer argument
|
||||
is also passed. Defaults to the client keypair.
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
-k, --keypair <PATH> /path/to/id.json
|
||||
-k, --keypair <PATH> /path/to/id.json or usb://remote/wallet/path
|
||||
--nonce <PUBKEY>
|
||||
Provide the nonce account to use when creating a nonced
|
||||
transaction. Nonced transactions are useful when a transaction
|
||||
requires a lengthy signing process. Learn more about nonced
|
||||
transactions at https://docs.solana.com/offline-signing/durable-nonce
|
||||
--nonce-authority <KEYPAIR or PUBKEY>
|
||||
Provide the nonce authority keypair to use when signing a nonced transaction
|
||||
|
||||
--signer <BASE58_PUBKEY=BASE58_SIG>... Provide a public-key/signature pair for the transaction
|
||||
--withdraw-authority <KEYPAIR or PUBKEY> Public key of authorized withdrawer (defaults to cli config pubkey)
|
||||
|
||||
ARGS:
|
||||
<STAKE ACCOUNT> Stake account from which to withdraw
|
||||
<DESTINATION ACCOUNT> The account to which the lamports should be transferred
|
||||
<AMOUNT> The amount to withdraw from the stake account (default unit SOL)
|
||||
<UNIT> Specify unit to use for request [possible values: SOL, lamports]
|
||||
<AMOUNT> The amount to withdraw from the stake account, in SOL
|
||||
```
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ At present, the following commands support offline signing:
|
|||
|
||||
To sign a transaction offline, pass the following arguments on the command line
|
||||
1) `--sign-only`, prevents the client from submitting the signed transaction
|
||||
to the network. Instead, the pubkey/signature pairs are printed to stdout.
|
||||
to the network. Instead, the pubkey/signature pairs are printed to stdout.
|
||||
2) `--blockhash BASE58_HASH`, allows the caller to specify the value used to
|
||||
fill the transaction's `recent_blockhash` field. This serves a number of
|
||||
purposes, namely:
|
||||
|
@ -37,7 +37,7 @@ Command
|
|||
|
||||
```bash
|
||||
solana@offline$ solana pay --sign-only --blockhash 5Tx8F3jgSHx21CbtjwmdaKPLM5tWmreWAnPrbqHomSJF \
|
||||
recipient-keypair.json 1 SOL
|
||||
recipient-keypair.json 1
|
||||
```
|
||||
|
||||
Output
|
||||
|
@ -67,7 +67,7 @@ Command
|
|||
```bash
|
||||
solana@online$ solana pay --blockhash 5Tx8F3jgSHx21CbtjwmdaKPLM5tWmreWAnPrbqHomSJF \
|
||||
--signer FhtzLVsmcV7S5XqGD79ErgoseCLhZYmEZnz9kQg1Rp7j=4vC38p4bz7XyiXrk6HtaooUqwxTWKocf45cstASGtmrD398biNJnmTcUCVEojE7wVQvgdYbjHJqRFZPpzfCQpmUN
|
||||
recipient-keypair.json 1 SOL
|
||||
recipient-keypair.json 1
|
||||
```
|
||||
|
||||
Output
|
||||
|
|
|
@ -36,7 +36,7 @@ A nonce account is created by first generating a new keypair, then create the ac
|
|||
|
||||
```bash
|
||||
solana-keygen new -o nonce-keypair.json
|
||||
solana create-nonce-account nonce-keypair.json 1 SOL
|
||||
solana create-nonce-account nonce-keypair.json 1
|
||||
```
|
||||
|
||||
- Output
|
||||
|
@ -64,7 +64,7 @@ presently stored nonce value with
|
|||
- Command
|
||||
|
||||
```bash
|
||||
solana nonce nonce-keypair.json
|
||||
solana nonce nonce-keypair.json
|
||||
```
|
||||
|
||||
- Output
|
||||
|
@ -105,7 +105,7 @@ Inspect a nonce account in a more human friendly format with
|
|||
- Command
|
||||
|
||||
```bash
|
||||
solana nonce-account nonce-keypair.json
|
||||
solana nonce-account nonce-keypair.json
|
||||
```
|
||||
|
||||
- Output
|
||||
|
@ -127,7 +127,7 @@ Withdraw funds from a nonce account with
|
|||
- Command
|
||||
|
||||
```bash
|
||||
solana withdraw-from-nonce-account nonce-keypair.json ~/.config/solana/id.json 0.5 SOL
|
||||
solana withdraw-from-nonce-account nonce-keypair.json ~/.config/solana/id.json 0.5
|
||||
```
|
||||
|
||||
- Output
|
||||
|
@ -151,7 +151,7 @@ Reassign the authority of a nonce account after creation with
|
|||
- Command
|
||||
|
||||
```bash
|
||||
solana authorize-nonce-account nonce-keypair.json nonce-authority.json
|
||||
solana authorize-nonce-account nonce-keypair.json nonce-authority.json
|
||||
```
|
||||
|
||||
- Output
|
||||
|
@ -197,7 +197,7 @@ Alice will need some funds to create a nonce account and send to Bob. Airdrop
|
|||
her some SOL
|
||||
|
||||
```bash
|
||||
$ solana airdrop -k alice.json 10 SOL
|
||||
$ solana airdrop -k alice.json 10
|
||||
10 SOL
|
||||
```
|
||||
|
||||
|
@ -211,7 +211,7 @@ has full authority over the nonce account
|
|||
{% endhint %}
|
||||
|
||||
```bash
|
||||
$ solana create-nonce-account -k alice.json nonce.json 1 SOL
|
||||
$ solana create-nonce-account -k alice.json nonce.json 1
|
||||
3KPZr96BTsL3hqera9up82KAU462Gz31xjqJ6eHUAjF935Yf8i1kmfEbo6SVbNaACKE5z6gySrNjVRvmS8DcPuwV
|
||||
```
|
||||
|
||||
|
@ -221,7 +221,7 @@ Alice attempts to pay Bob, but takes too long to sign. The specified blockhash
|
|||
expires and the transaction fails
|
||||
|
||||
```bash
|
||||
$ solana pay -k alice.json --blockhash expiredDTaxfagttWjQweib42b6ZHADSx94Tw8gHx3W7 bob.json 1 SOL
|
||||
$ solana pay -k alice.json --blockhash expiredDTaxfagttWjQweib42b6ZHADSx94Tw8gHx3W7 bob.json 1
|
||||
[2020-01-02T18:48:28.462911000Z ERROR solana_cli::cli] Io(Custom { kind: Other, error: "Transaction \"33gQQaoPc9jWePMvDAeyJpcnSPiGUAdtVg8zREWv4GiKjkcGNufgpcbFyRKRrA25NkgjZySEeKue5rawyeH5TzsV\" failed: None" })
|
||||
Error: Io(Custom { kind: Other, error: "Transaction \"33gQQaoPc9jWePMvDAeyJpcnSPiGUAdtVg8zREWv4GiKjkcGNufgpcbFyRKRrA25NkgjZySEeKue5rawyeH5TzsV\" failed: None" })
|
||||
```
|
||||
|
@ -236,13 +236,13 @@ Remember, `alice.json` is the [nonce authority](#nonce-authority) in this exampl
|
|||
{% endhint %}
|
||||
|
||||
```bash
|
||||
$ solana nonce-account nonce.json
|
||||
$ solana nonce-account nonce.json
|
||||
balance: 1 SOL
|
||||
minimum balance required: 0.00136416 SOL
|
||||
nonce: F7vmkY3DTaxfagttWjQweib42b6ZHADSx94Tw8gHx3W7
|
||||
```
|
||||
```bash
|
||||
$ solana pay -k alice.json --blockhash F7vmkY3DTaxfagttWjQweib42b6ZHADSx94Tw8gHx3W7 --nonce nonce.json bob.json 1 SOL
|
||||
$ solana pay -k alice.json --blockhash F7vmkY3DTaxfagttWjQweib42b6ZHADSx94Tw8gHx3W7 --nonce nonce.json bob.json 1
|
||||
HR1368UKHVZyenmH7yVz5sBAijV6XAPeWbEiXEGVYQorRMcoijeNAbzZqEZiH8cDB8tk65ckqeegFjK8dHwNFgQ
|
||||
```
|
||||
|
||||
|
@ -256,7 +256,7 @@ $ solana balance -k bob.json
|
|||
1 SOL
|
||||
```
|
||||
```bash
|
||||
$ solana nonce-account nonce.json
|
||||
$ solana nonce-account nonce.json
|
||||
balance: 1 SOL
|
||||
minimum balance required: 0.00136416 SOL
|
||||
nonce: 6bjroqDcZgTv6Vavhqf81oBHTv3aMnX19UTB51YhAZnN
|
||||
|
|
|
@ -169,7 +169,7 @@ trigger a seed phrase input prompt for the stake account and use
|
|||
`--ask-seed-phrase keypair` to securely input the funding keypair.
|
||||
|
||||
```bash
|
||||
solana create-stake-account ASK 1 SOL --ask-seed-phrase keypair
|
||||
solana create-stake-account ASK 1 --ask-seed-phrase keypair
|
||||
|
||||
[stake_account] seed phrase: 🔒
|
||||
[stake_account] If this seed phrase has an associated passphrase, enter it now. Otherwise, press ENTER to continue:
|
||||
|
|
|
@ -129,7 +129,7 @@ Use solana-keygen to show the public keys for each of the keypairs, they will be
|
|||
```text
|
||||
Then set up the storage accounts for your archiver by running:
|
||||
```bash
|
||||
solana --keypair archiver-keypair.json airdrop 100000 lamports
|
||||
solana --keypair archiver-keypair.json airdrop .0001
|
||||
solana --keypair archiver-keypair.json create-archiver-storage-account $ARCHIVER_IDENTITY $STORAGE_IDENTITY
|
||||
```
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ solana-keygen new -o ~/validator-stake-keypair.json
|
|||
Now delegate 1 SOL to your validator by first creating your stake account:
|
||||
|
||||
```bash
|
||||
solana create-stake-account ~/validator-stake-keypair.json 1 SOL
|
||||
solana create-stake-account ~/validator-stake-keypair.json 1
|
||||
```
|
||||
|
||||
and then delegating that stake to your validator:
|
||||
|
|
|
@ -93,12 +93,8 @@ pub fn pubkeys_sigs_of(matches: &ArgMatches<'_>, name: &str) -> Option<Vec<(Pubk
|
|||
})
|
||||
}
|
||||
|
||||
pub fn amount_of(matches: &ArgMatches<'_>, name: &str, unit: &str) -> Option<u64> {
|
||||
if matches.value_of(unit) == Some("lamports") {
|
||||
value_of(matches, name)
|
||||
} else {
|
||||
value_of(matches, name).map(sol_to_lamports)
|
||||
}
|
||||
pub fn lamports_of_sol(matches: &ArgMatches<'_>, name: &str) -> Option<u64> {
|
||||
value_of(matches, name).map(sol_to_lamports)
|
||||
}
|
||||
|
||||
pub fn derivation_of(matches: &ArgMatches<'_>, name: &str) -> Option<DerivationPath> {
|
||||
|
@ -269,24 +265,21 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_amount_of() {
|
||||
fn test_lamports_of_sol() {
|
||||
let matches = app()
|
||||
.clone()
|
||||
.get_matches_from(vec!["test", "--single", "50", "--unit", "lamports"]);
|
||||
assert_eq!(amount_of(&matches, "single", "unit"), Some(50));
|
||||
assert_eq!(amount_of(&matches, "multiple", "unit"), None);
|
||||
.get_matches_from(vec!["test", "--single", "50"]);
|
||||
assert_eq!(lamports_of_sol(&matches, "single"), Some(50000000000));
|
||||
assert_eq!(lamports_of_sol(&matches, "multiple"), None);
|
||||
let matches = app()
|
||||
.clone()
|
||||
.get_matches_from(vec!["test", "--single", "50", "--unit", "SOL"]);
|
||||
assert_eq!(amount_of(&matches, "single", "unit"), Some(50000000000));
|
||||
.get_matches_from(vec!["test", "--single", "1.5"]);
|
||||
assert_eq!(lamports_of_sol(&matches, "single"), Some(1500000000));
|
||||
assert_eq!(lamports_of_sol(&matches, "multiple"), None);
|
||||
let matches = app()
|
||||
.clone()
|
||||
.get_matches_from(vec!["test", "--single", "1.5", "--unit", "SOL"]);
|
||||
assert_eq!(amount_of(&matches, "single", "unit"), Some(1500000000));
|
||||
let matches = app()
|
||||
.clone()
|
||||
.get_matches_from(vec!["test", "--single", "1.5", "--unit", "lamports"]);
|
||||
assert_eq!(amount_of(&matches, "single", "unit"), None);
|
||||
.get_matches_from(vec!["test", "--single", "0.03"]);
|
||||
assert_eq!(lamports_of_sol(&matches, "single"), Some(30000000));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
160
cli/src/cli.rs
160
cli/src/cli.rs
|
@ -411,7 +411,6 @@ pub enum CliCommand {
|
|||
faucet_host: Option<IpAddr>,
|
||||
faucet_port: u16,
|
||||
lamports: u64,
|
||||
use_lamports_unit: bool,
|
||||
},
|
||||
Balance {
|
||||
pubkey: Option<Pubkey>,
|
||||
|
@ -644,14 +643,12 @@ pub fn parse_command(matches: &ArgMatches<'_>) -> Result<CliCommandInfo, Box<dyn
|
|||
} else {
|
||||
None
|
||||
};
|
||||
let lamports = required_lamports_from(matches, "amount", "unit")?;
|
||||
let use_lamports_unit = matches.value_of("unit") == Some("lamports");
|
||||
let lamports = lamports_of_sol(matches, "amount").unwrap();
|
||||
Ok(CliCommandInfo {
|
||||
command: CliCommand::Airdrop {
|
||||
faucet_host,
|
||||
faucet_port,
|
||||
lamports,
|
||||
use_lamports_unit,
|
||||
},
|
||||
require_keypair: true,
|
||||
})
|
||||
|
@ -684,7 +681,7 @@ pub fn parse_command(matches: &ArgMatches<'_>) -> Result<CliCommandInfo, Box<dyn
|
|||
}
|
||||
},
|
||||
("pay", Some(matches)) => {
|
||||
let lamports = required_lamports_from(matches, "amount", "unit")?;
|
||||
let lamports = lamports_of_sol(matches, "amount").unwrap();
|
||||
let to = pubkey_of(&matches, "to").unwrap();
|
||||
let timestamp = if matches.is_present("timestamp") {
|
||||
// Parse input for serde_json
|
||||
|
@ -768,7 +765,7 @@ pub fn parse_command(matches: &ArgMatches<'_>) -> Result<CliCommandInfo, Box<dyn
|
|||
})
|
||||
}
|
||||
("transfer", Some(matches)) => {
|
||||
let lamports = required_lamports_from(matches, "amount", "unit")?;
|
||||
let lamports = lamports_of_sol(matches, "amount").unwrap();
|
||||
let to = pubkey_of(&matches, "to").unwrap();
|
||||
let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
|
||||
let signers = pubkeys_sigs_of(&matches, SIGNER_ARG.name);
|
||||
|
@ -947,12 +944,11 @@ fn process_airdrop(
|
|||
config: &CliConfig,
|
||||
faucet_addr: &SocketAddr,
|
||||
lamports: u64,
|
||||
use_lamports_unit: bool,
|
||||
) -> ProcessResult {
|
||||
let pubkey = config.pubkey()?;
|
||||
println!(
|
||||
"Requesting airdrop of {} from {}",
|
||||
build_balance_message(lamports, use_lamports_unit, true),
|
||||
build_balance_message(lamports, false, true),
|
||||
faucet_addr
|
||||
);
|
||||
let previous_balance = match rpc_client.retry_get_balance(&pubkey, 5)? {
|
||||
|
@ -971,11 +967,7 @@ fn process_airdrop(
|
|||
.retry_get_balance(&pubkey, 5)?
|
||||
.unwrap_or(previous_balance);
|
||||
|
||||
Ok(build_balance_message(
|
||||
current_balance,
|
||||
use_lamports_unit,
|
||||
true,
|
||||
))
|
||||
Ok(build_balance_message(current_balance, false, true))
|
||||
}
|
||||
|
||||
fn process_balance(
|
||||
|
@ -1858,7 +1850,6 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
|
|||
faucet_host,
|
||||
faucet_port,
|
||||
lamports,
|
||||
use_lamports_unit,
|
||||
} => {
|
||||
let faucet_addr = SocketAddr::new(
|
||||
faucet_host.unwrap_or_else(|| {
|
||||
|
@ -1874,13 +1865,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
|
|||
*faucet_port,
|
||||
);
|
||||
|
||||
process_airdrop(
|
||||
&rpc_client,
|
||||
config,
|
||||
&faucet_addr,
|
||||
*lamports,
|
||||
*use_lamports_unit,
|
||||
)
|
||||
process_airdrop(&rpc_client, config, &faucet_addr, *lamports)
|
||||
}
|
||||
// Check client balance
|
||||
CliCommand::Balance {
|
||||
|
@ -2055,22 +2040,6 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
// If clap arg `name` is_required, and specifies an amount of either lamports or SOL, the only way
|
||||
// `amount_of()` can return None is if `name` is an f64 and `unit`== "lamports". This method
|
||||
// catches that case and converts it to an Error.
|
||||
pub(crate) fn required_lamports_from(
|
||||
matches: &ArgMatches<'_>,
|
||||
name: &str,
|
||||
unit: &str,
|
||||
) -> Result<u64, CliError> {
|
||||
amount_of(matches, name, unit).ok_or_else(|| {
|
||||
CliError::BadParameter(format!(
|
||||
"Lamports cannot be fractional: {}",
|
||||
matches.value_of("amount").unwrap()
|
||||
))
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn build_balance_message(
|
||||
lamports: u64,
|
||||
use_lamports_unit: bool,
|
||||
|
@ -2128,15 +2097,7 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
|
|||
.takes_value(true)
|
||||
.validator(is_amount)
|
||||
.required(true)
|
||||
.help("The airdrop amount to request (default unit SOL)"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("unit")
|
||||
.index(2)
|
||||
.value_name("UNIT")
|
||||
.takes_value(true)
|
||||
.possible_values(&["SOL", "lamports"])
|
||||
.help("Specify unit to use for request and balance display"),
|
||||
.help("The airdrop amount to request, in SOL"),
|
||||
),
|
||||
)
|
||||
.subcommand(
|
||||
|
@ -2245,15 +2206,7 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
|
|||
.takes_value(true)
|
||||
.validator(is_amount)
|
||||
.required(true)
|
||||
.help("The amount to send (default unit SOL)"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("unit")
|
||||
.index(3)
|
||||
.value_name("UNIT")
|
||||
.takes_value(true)
|
||||
.possible_values(&["SOL", "lamports"])
|
||||
.help("Specify unit to use for request"),
|
||||
.help("The amount to send, in SOL"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("timestamp")
|
||||
|
@ -2358,15 +2311,7 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
|
|||
.takes_value(true)
|
||||
.validator(is_amount)
|
||||
.required(true)
|
||||
.help("The amount to send (default unit SOL)"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("unit")
|
||||
.index(3)
|
||||
.value_name("UNIT")
|
||||
.takes_value(true)
|
||||
.possible_values(&["SOL", "lamports"])
|
||||
.help("Specify unit to use for request"),
|
||||
.help("The amount to send, in SOL"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("from")
|
||||
|
@ -2468,15 +2413,14 @@ mod tests {
|
|||
// Test Airdrop Subcommand
|
||||
let test_airdrop = test_commands
|
||||
.clone()
|
||||
.get_matches_from(vec!["test", "airdrop", "50", "lamports"]);
|
||||
.get_matches_from(vec!["test", "airdrop", "50"]);
|
||||
assert_eq!(
|
||||
parse_command(&test_airdrop).unwrap(),
|
||||
CliCommandInfo {
|
||||
command: CliCommand::Airdrop {
|
||||
faucet_host: None,
|
||||
faucet_port: solana_faucet::faucet::FAUCET_PORT,
|
||||
lamports: 50,
|
||||
use_lamports_unit: true,
|
||||
lamports: 50_000_000_000,
|
||||
},
|
||||
require_keypair: true,
|
||||
}
|
||||
|
@ -2624,18 +2568,15 @@ mod tests {
|
|||
);
|
||||
|
||||
// Test Simple Pay Subcommand
|
||||
let test_pay = test_commands.clone().get_matches_from(vec![
|
||||
"test",
|
||||
"pay",
|
||||
&pubkey_string,
|
||||
"50",
|
||||
"lamports",
|
||||
]);
|
||||
let test_pay =
|
||||
test_commands
|
||||
.clone()
|
||||
.get_matches_from(vec!["test", "pay", &pubkey_string, "50"]);
|
||||
assert_eq!(
|
||||
parse_command(&test_pay).unwrap(),
|
||||
CliCommandInfo {
|
||||
command: CliCommand::Pay(PayCommand {
|
||||
lamports: 50,
|
||||
lamports: 50_000_000_000,
|
||||
to: pubkey,
|
||||
..PayCommand::default()
|
||||
}),
|
||||
|
@ -2649,7 +2590,6 @@ mod tests {
|
|||
"pay",
|
||||
&pubkey_string,
|
||||
"50",
|
||||
"lamports",
|
||||
"--require-signature-from",
|
||||
&witness0_string,
|
||||
"--require-signature-from",
|
||||
|
@ -2659,7 +2599,7 @@ mod tests {
|
|||
parse_command(&test_pay_multiple_witnesses).unwrap(),
|
||||
CliCommandInfo {
|
||||
command: CliCommand::Pay(PayCommand {
|
||||
lamports: 50,
|
||||
lamports: 50_000_000_000,
|
||||
to: pubkey,
|
||||
witnesses: Some(vec![witness0, witness1]),
|
||||
..PayCommand::default()
|
||||
|
@ -2672,7 +2612,6 @@ mod tests {
|
|||
"pay",
|
||||
&pubkey_string,
|
||||
"50",
|
||||
"lamports",
|
||||
"--require-signature-from",
|
||||
&witness0_string,
|
||||
]);
|
||||
|
@ -2680,7 +2619,7 @@ mod tests {
|
|||
parse_command(&test_pay_single_witness).unwrap(),
|
||||
CliCommandInfo {
|
||||
command: CliCommand::Pay(PayCommand {
|
||||
lamports: 50,
|
||||
lamports: 50_000_000_000,
|
||||
to: pubkey,
|
||||
witnesses: Some(vec![witness0]),
|
||||
..PayCommand::default()
|
||||
|
@ -2695,7 +2634,6 @@ mod tests {
|
|||
"pay",
|
||||
&pubkey_string,
|
||||
"50",
|
||||
"lamports",
|
||||
"--after",
|
||||
"2018-09-19T17:30:59",
|
||||
"--require-timestamp-from",
|
||||
|
@ -2705,7 +2643,7 @@ mod tests {
|
|||
parse_command(&test_pay_timestamp).unwrap(),
|
||||
CliCommandInfo {
|
||||
command: CliCommand::Pay(PayCommand {
|
||||
lamports: 50,
|
||||
lamports: 50_000_000_000,
|
||||
to: pubkey,
|
||||
timestamp: Some(dt),
|
||||
timestamp_pubkey: Some(witness0),
|
||||
|
@ -2723,7 +2661,6 @@ mod tests {
|
|||
"pay",
|
||||
&pubkey_string,
|
||||
"50",
|
||||
"lamports",
|
||||
"--blockhash",
|
||||
&blockhash_string,
|
||||
"--sign-only",
|
||||
|
@ -2732,7 +2669,7 @@ mod tests {
|
|||
parse_command(&test_pay).unwrap(),
|
||||
CliCommandInfo {
|
||||
command: CliCommand::Pay(PayCommand {
|
||||
lamports: 50,
|
||||
lamports: 50_000_000_000,
|
||||
to: pubkey,
|
||||
blockhash_query: BlockhashQuery::None(blockhash, FeeCalculator::default()),
|
||||
sign_only: true,
|
||||
|
@ -2751,7 +2688,6 @@ mod tests {
|
|||
"pay",
|
||||
&pubkey_string,
|
||||
"50",
|
||||
"lamports",
|
||||
"--blockhash",
|
||||
&blockhash_string,
|
||||
"--signer",
|
||||
|
@ -2761,7 +2697,7 @@ mod tests {
|
|||
parse_command(&test_pay).unwrap(),
|
||||
CliCommandInfo {
|
||||
command: CliCommand::Pay(PayCommand {
|
||||
lamports: 50,
|
||||
lamports: 50_000_000_000,
|
||||
to: pubkey,
|
||||
blockhash_query: BlockhashQuery::FeeCalculator(blockhash),
|
||||
signers: Some(vec![(key1, sig1)]),
|
||||
|
@ -2780,7 +2716,6 @@ mod tests {
|
|||
"pay",
|
||||
&pubkey_string,
|
||||
"50",
|
||||
"lamports",
|
||||
"--blockhash",
|
||||
&blockhash_string,
|
||||
"--signer",
|
||||
|
@ -2792,7 +2727,7 @@ mod tests {
|
|||
parse_command(&test_pay).unwrap(),
|
||||
CliCommandInfo {
|
||||
command: CliCommand::Pay(PayCommand {
|
||||
lamports: 50,
|
||||
lamports: 50_000_000_000,
|
||||
to: pubkey,
|
||||
blockhash_query: BlockhashQuery::FeeCalculator(blockhash),
|
||||
signers: Some(vec![(key1, sig1), (key2, sig2)]),
|
||||
|
@ -2808,7 +2743,6 @@ mod tests {
|
|||
"pay",
|
||||
&pubkey_string,
|
||||
"50",
|
||||
"lamports",
|
||||
"--blockhash",
|
||||
&blockhash_string,
|
||||
]);
|
||||
|
@ -2816,7 +2750,7 @@ mod tests {
|
|||
parse_command(&test_pay).unwrap(),
|
||||
CliCommandInfo {
|
||||
command: CliCommand::Pay(PayCommand {
|
||||
lamports: 50,
|
||||
lamports: 50_000_000_000,
|
||||
to: pubkey,
|
||||
blockhash_query: BlockhashQuery::FeeCalculator(blockhash),
|
||||
..PayCommand::default()
|
||||
|
@ -2833,7 +2767,6 @@ mod tests {
|
|||
"pay",
|
||||
&pubkey_string,
|
||||
"50",
|
||||
"lamports",
|
||||
"--blockhash",
|
||||
&blockhash_string,
|
||||
"--nonce",
|
||||
|
@ -2843,7 +2776,7 @@ mod tests {
|
|||
parse_command(&test_pay).unwrap(),
|
||||
CliCommandInfo {
|
||||
command: CliCommand::Pay(PayCommand {
|
||||
lamports: 50,
|
||||
lamports: 50_000_000_000,
|
||||
to: pubkey,
|
||||
blockhash_query: BlockhashQuery::FeeCalculator(blockhash),
|
||||
nonce_account: Some(pubkey),
|
||||
|
@ -2862,7 +2795,6 @@ mod tests {
|
|||
"pay",
|
||||
&pubkey_string,
|
||||
"50",
|
||||
"lamports",
|
||||
"--blockhash",
|
||||
&blockhash_string,
|
||||
"--nonce",
|
||||
|
@ -2874,7 +2806,7 @@ mod tests {
|
|||
parse_command(&test_pay).unwrap(),
|
||||
CliCommandInfo {
|
||||
command: CliCommand::Pay(PayCommand {
|
||||
lamports: 50,
|
||||
lamports: 50_000_000_000,
|
||||
to: pubkey,
|
||||
blockhash_query: BlockhashQuery::FeeCalculator(blockhash),
|
||||
nonce_account: Some(pubkey),
|
||||
|
@ -2896,7 +2828,6 @@ mod tests {
|
|||
"pay",
|
||||
&pubkey_string,
|
||||
"50",
|
||||
"lamports",
|
||||
"--blockhash",
|
||||
&blockhash_string,
|
||||
"--nonce",
|
||||
|
@ -2910,7 +2841,7 @@ mod tests {
|
|||
parse_command(&test_pay).unwrap(),
|
||||
CliCommandInfo {
|
||||
command: CliCommand::Pay(PayCommand {
|
||||
lamports: 50,
|
||||
lamports: 50_000_000_000,
|
||||
to: pubkey,
|
||||
blockhash_query: BlockhashQuery::FeeCalculator(blockhash),
|
||||
nonce_account: Some(pubkey),
|
||||
|
@ -2934,7 +2865,6 @@ mod tests {
|
|||
"pay",
|
||||
&pubkey_string,
|
||||
"50",
|
||||
"lamports",
|
||||
"--blockhash",
|
||||
&blockhash_string,
|
||||
"--nonce",
|
||||
|
@ -2965,7 +2895,6 @@ mod tests {
|
|||
"pay",
|
||||
&pubkey_string,
|
||||
"50",
|
||||
"lamports",
|
||||
"--after",
|
||||
"2018-09-19T17:30:59",
|
||||
"--require-signature-from",
|
||||
|
@ -2979,7 +2908,7 @@ mod tests {
|
|||
parse_command(&test_pay_multiple_witnesses).unwrap(),
|
||||
CliCommandInfo {
|
||||
command: CliCommand::Pay(PayCommand {
|
||||
lamports: 50,
|
||||
lamports: 50_000_000_000,
|
||||
to: pubkey,
|
||||
timestamp: Some(dt),
|
||||
timestamp_pubkey: Some(witness0),
|
||||
|
@ -3284,7 +3213,6 @@ mod tests {
|
|||
faucet_host: None,
|
||||
faucet_port: 1234,
|
||||
lamports: 50,
|
||||
use_lamports_unit: true,
|
||||
};
|
||||
assert!(process_command(&config).is_ok());
|
||||
|
||||
|
@ -3322,7 +3250,6 @@ mod tests {
|
|||
faucet_host: None,
|
||||
faucet_port: 1234,
|
||||
lamports: 50,
|
||||
use_lamports_unit: true,
|
||||
};
|
||||
assert!(process_command(&config).is_err());
|
||||
|
||||
|
@ -3431,35 +3358,13 @@ mod tests {
|
|||
fn test_parse_transfer_subcommand() {
|
||||
let test_commands = app("test", "desc", "version");
|
||||
|
||||
//Test Transfer Subcommand, lamports
|
||||
//Test Transfer Subcommand, SOL
|
||||
let from_keypair = keypair_from_seed(&[0u8; 32]).unwrap();
|
||||
let from_pubkey = from_keypair.pubkey();
|
||||
let from_string = from_pubkey.to_string();
|
||||
let to_keypair = keypair_from_seed(&[1u8; 32]).unwrap();
|
||||
let to_pubkey = to_keypair.pubkey();
|
||||
let to_string = to_pubkey.to_string();
|
||||
let test_transfer = test_commands
|
||||
.clone()
|
||||
.get_matches_from(vec!["test", "transfer", &to_string, "42", "lamports"]);
|
||||
assert_eq!(
|
||||
parse_command(&test_transfer).unwrap(),
|
||||
CliCommandInfo {
|
||||
command: CliCommand::Transfer {
|
||||
lamports: 42,
|
||||
to: to_pubkey,
|
||||
from: None,
|
||||
sign_only: false,
|
||||
signers: None,
|
||||
blockhash_query: BlockhashQuery::All,
|
||||
nonce_account: None,
|
||||
nonce_authority: None,
|
||||
fee_payer: None,
|
||||
},
|
||||
require_keypair: true,
|
||||
}
|
||||
);
|
||||
|
||||
//Test Transfer Subcommand, SOL
|
||||
let test_transfer = test_commands
|
||||
.clone()
|
||||
.get_matches_from(vec!["test", "transfer", &to_string, "42"]);
|
||||
|
@ -3489,7 +3394,6 @@ mod tests {
|
|||
"transfer",
|
||||
&to_string,
|
||||
"42",
|
||||
"lamports",
|
||||
"--blockhash",
|
||||
&blockhash_string,
|
||||
"--sign-only",
|
||||
|
@ -3498,7 +3402,7 @@ mod tests {
|
|||
parse_command(&test_transfer).unwrap(),
|
||||
CliCommandInfo {
|
||||
command: CliCommand::Transfer {
|
||||
lamports: 42,
|
||||
lamports: 42_000_000_000,
|
||||
to: to_pubkey,
|
||||
from: None,
|
||||
sign_only: true,
|
||||
|
@ -3520,7 +3424,6 @@ mod tests {
|
|||
"transfer",
|
||||
&to_string,
|
||||
"42",
|
||||
"lamports",
|
||||
"--from",
|
||||
&from_string,
|
||||
"--fee-payer",
|
||||
|
@ -3534,7 +3437,7 @@ mod tests {
|
|||
parse_command(&test_transfer).unwrap(),
|
||||
CliCommandInfo {
|
||||
command: CliCommand::Transfer {
|
||||
lamports: 42,
|
||||
lamports: 42_000_000_000,
|
||||
to: to_pubkey,
|
||||
from: Some(from_pubkey.into()),
|
||||
sign_only: false,
|
||||
|
@ -3559,7 +3462,6 @@ mod tests {
|
|||
"transfer",
|
||||
&to_string,
|
||||
"42",
|
||||
"lamports",
|
||||
"--blockhash",
|
||||
&blockhash_string,
|
||||
"--nonce",
|
||||
|
@ -3571,7 +3473,7 @@ mod tests {
|
|||
parse_command(&test_transfer).unwrap(),
|
||||
CliCommandInfo {
|
||||
command: CliCommand::Transfer {
|
||||
lamports: 42,
|
||||
lamports: 42_000_000_000,
|
||||
to: to_pubkey,
|
||||
from: None,
|
||||
sign_only: false,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::cli::{
|
||||
build_balance_message, check_account_for_fee, check_unique_pubkeys,
|
||||
log_instruction_custom_error, required_lamports_from, CliCommand, CliCommandInfo, CliConfig,
|
||||
CliError, ProcessResult, SigningAuthority,
|
||||
log_instruction_custom_error, CliCommand, CliCommandInfo, CliConfig, CliError, ProcessResult,
|
||||
SigningAuthority,
|
||||
};
|
||||
use crate::offline::BLOCKHASH_ARG;
|
||||
use clap::{App, Arg, ArgMatches, SubCommand};
|
||||
|
@ -121,15 +121,7 @@ impl NonceSubCommands for App<'_, '_> {
|
|||
.takes_value(true)
|
||||
.required(true)
|
||||
.validator(is_amount)
|
||||
.help("The amount to load the nonce account with (default unit SOL)"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("unit")
|
||||
.index(3)
|
||||
.value_name("UNIT")
|
||||
.takes_value(true)
|
||||
.possible_values(&["SOL", "lamports"])
|
||||
.help("Specify unit to use for request"),
|
||||
.help("The amount to load the nonce account with, in SOL"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name(NONCE_AUTHORITY_ARG.name)
|
||||
|
@ -216,15 +208,7 @@ impl NonceSubCommands for App<'_, '_> {
|
|||
.takes_value(true)
|
||||
.required(true)
|
||||
.validator(is_amount)
|
||||
.help("The amount to withdraw from the nonce account (default unit SOL)"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("unit")
|
||||
.index(4)
|
||||
.value_name("UNIT")
|
||||
.takes_value(true)
|
||||
.possible_values(&["SOL", "lamports"])
|
||||
.help("Specify unit to use for request"),
|
||||
.help("The amount to withdraw from the nonce account, in SOL"),
|
||||
)
|
||||
.arg(nonce_authority_arg()),
|
||||
)
|
||||
|
@ -250,7 +234,7 @@ pub fn parse_authorize_nonce_account(matches: &ArgMatches<'_>) -> Result<CliComm
|
|||
pub fn parse_nonce_create_account(matches: &ArgMatches<'_>) -> Result<CliCommandInfo, CliError> {
|
||||
let nonce_account = keypair_of(matches, "nonce_account_keypair").unwrap();
|
||||
let seed = matches.value_of("seed").map(|s| s.to_string());
|
||||
let lamports = required_lamports_from(matches, "amount", "unit")?;
|
||||
let lamports = lamports_of_sol(matches, "amount").unwrap();
|
||||
let nonce_authority = pubkey_of(matches, NONCE_AUTHORITY_ARG.name);
|
||||
|
||||
Ok(CliCommandInfo {
|
||||
|
@ -305,7 +289,7 @@ pub fn parse_withdraw_from_nonce_account(
|
|||
) -> Result<CliCommandInfo, CliError> {
|
||||
let nonce_account = pubkey_of(matches, "nonce_account_keypair").unwrap();
|
||||
let destination_account_pubkey = pubkey_of(matches, "destination_account_pubkey").unwrap();
|
||||
let lamports = required_lamports_from(matches, "amount", "unit")?;
|
||||
let lamports = lamports_of_sol(matches, "amount").unwrap();
|
||||
let nonce_authority =
|
||||
SigningAuthority::new_from_matches(&matches, NONCE_AUTHORITY_ARG.name, None)?;
|
||||
|
||||
|
@ -689,7 +673,6 @@ mod tests {
|
|||
"create-nonce-account",
|
||||
&keypair_file,
|
||||
"50",
|
||||
"lamports",
|
||||
]);
|
||||
assert_eq!(
|
||||
parse_command(&test_create_nonce_account).unwrap(),
|
||||
|
@ -698,7 +681,7 @@ mod tests {
|
|||
nonce_account: read_keypair_file(&keypair_file).unwrap().into(),
|
||||
seed: None,
|
||||
nonce_authority: None,
|
||||
lamports: 50,
|
||||
lamports: 50_000_000_000,
|
||||
},
|
||||
require_keypair: true
|
||||
}
|
||||
|
@ -710,7 +693,6 @@ mod tests {
|
|||
"create-nonce-account",
|
||||
&keypair_file,
|
||||
"50",
|
||||
"lamports",
|
||||
"--nonce-authority",
|
||||
&authority_keypair_file,
|
||||
]);
|
||||
|
@ -723,7 +705,7 @@ mod tests {
|
|||
nonce_authority: Some(
|
||||
read_keypair_file(&authority_keypair_file).unwrap().pubkey()
|
||||
),
|
||||
lamports: 50,
|
||||
lamports: 50_000_000_000,
|
||||
},
|
||||
require_keypair: true
|
||||
}
|
||||
|
@ -806,7 +788,6 @@ mod tests {
|
|||
&keypair_file,
|
||||
&nonce_account_string,
|
||||
"42",
|
||||
"lamports",
|
||||
]);
|
||||
assert_eq!(
|
||||
parse_command(&test_withdraw_from_nonce_account).unwrap(),
|
||||
|
@ -815,7 +796,7 @@ mod tests {
|
|||
nonce_account: read_keypair_file(&keypair_file).unwrap().pubkey(),
|
||||
nonce_authority: None,
|
||||
destination_account_pubkey: nonce_account_pubkey,
|
||||
lamports: 42
|
||||
lamports: 42_000_000_000
|
||||
},
|
||||
require_keypair: true
|
||||
}
|
||||
|
@ -827,7 +808,6 @@ mod tests {
|
|||
&keypair_file,
|
||||
&nonce_account_string,
|
||||
"42",
|
||||
"SOL",
|
||||
]);
|
||||
assert_eq!(
|
||||
parse_command(&test_withdraw_from_nonce_account).unwrap(),
|
||||
|
@ -849,7 +829,6 @@ mod tests {
|
|||
&keypair_file,
|
||||
&nonce_account_string,
|
||||
"42",
|
||||
"lamports",
|
||||
"--nonce-authority",
|
||||
&authority_keypair_file,
|
||||
]);
|
||||
|
@ -862,7 +841,7 @@ mod tests {
|
|||
read_keypair_file(&authority_keypair_file).unwrap().into()
|
||||
),
|
||||
destination_account_pubkey: nonce_account_pubkey,
|
||||
lamports: 42
|
||||
lamports: 42_000_000_000
|
||||
},
|
||||
require_keypair: true
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use crate::{
|
||||
cli::{
|
||||
build_balance_message, check_account_for_fee, check_unique_pubkeys, fee_payer_arg,
|
||||
log_instruction_custom_error, nonce_authority_arg, replace_signatures,
|
||||
required_lamports_from, return_signers, CliCommand, CliCommandInfo, CliConfig, CliError,
|
||||
ProcessResult, SigningAuthority, FEE_PAYER_ARG,
|
||||
log_instruction_custom_error, nonce_authority_arg, replace_signatures, return_signers,
|
||||
CliCommand, CliCommandInfo, CliConfig, CliError, ProcessResult, SigningAuthority,
|
||||
FEE_PAYER_ARG,
|
||||
},
|
||||
nonce::{check_nonce_account, nonce_arg, NONCE_ARG, NONCE_AUTHORITY_ARG},
|
||||
offline::*,
|
||||
|
@ -86,15 +86,7 @@ impl StakeSubCommands for App<'_, '_> {
|
|||
.takes_value(true)
|
||||
.validator(is_amount)
|
||||
.required(true)
|
||||
.help("The amount of send to the vote account (default unit SOL)")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("unit")
|
||||
.index(3)
|
||||
.value_name("UNIT")
|
||||
.takes_value(true)
|
||||
.possible_values(&["SOL", "lamports"])
|
||||
.help("Specify unit to use for request")
|
||||
.help("The amount of send to the vote account, in SOL")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("custodian")
|
||||
|
@ -287,15 +279,7 @@ impl StakeSubCommands for App<'_, '_> {
|
|||
.takes_value(true)
|
||||
.validator(is_amount)
|
||||
.required(true)
|
||||
.help("The amount to move into the new stake account (default unit SOL)")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("unit")
|
||||
.index(4)
|
||||
.value_name("UNIT")
|
||||
.takes_value(true)
|
||||
.possible_values(&["SOL", "lamports"])
|
||||
.help("Specify unit to use for request")
|
||||
.help("The amount to move into the new stake account, in unit SOL")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("seed")
|
||||
|
@ -338,15 +322,7 @@ impl StakeSubCommands for App<'_, '_> {
|
|||
.takes_value(true)
|
||||
.validator(is_amount)
|
||||
.required(true)
|
||||
.help("The amount to withdraw from the stake account (default unit SOL)")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("unit")
|
||||
.index(4)
|
||||
.value_name("UNIT")
|
||||
.takes_value(true)
|
||||
.possible_values(&["SOL", "lamports"])
|
||||
.help("Specify unit to use for request")
|
||||
.help("The amount to withdraw from the stake account, in SOL")
|
||||
)
|
||||
.arg(withdraw_authority_arg())
|
||||
.offline_args()
|
||||
|
@ -443,7 +419,7 @@ pub fn parse_stake_create_account(matches: &ArgMatches<'_>) -> Result<CliCommand
|
|||
let custodian = pubkey_of(matches, "custodian").unwrap_or_default();
|
||||
let staker = pubkey_of(matches, STAKE_AUTHORITY_ARG.name);
|
||||
let withdrawer = pubkey_of(matches, WITHDRAW_AUTHORITY_ARG.name);
|
||||
let lamports = required_lamports_from(matches, "amount", "unit")?;
|
||||
let lamports = lamports_of_sol(matches, "amount").unwrap();
|
||||
let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
|
||||
let signers = pubkeys_sigs_of(&matches, SIGNER_ARG.name);
|
||||
let blockhash_query = BlockhashQuery::new_from_matches(matches);
|
||||
|
@ -557,7 +533,7 @@ pub fn parse_stake_authorize(
|
|||
pub fn parse_split_stake(matches: &ArgMatches<'_>) -> Result<CliCommandInfo, CliError> {
|
||||
let stake_account_pubkey = pubkey_of(matches, "stake_account_pubkey").unwrap();
|
||||
let split_stake_account = keypair_of(matches, "split_stake_account").unwrap();
|
||||
let lamports = required_lamports_from(matches, "amount", "unit")?;
|
||||
let lamports = lamports_of_sol(matches, "amount").unwrap();
|
||||
let seed = matches.value_of("seed").map(|s| s.to_string());
|
||||
|
||||
let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
|
||||
|
@ -622,7 +598,7 @@ pub fn parse_stake_deactivate_stake(matches: &ArgMatches<'_>) -> Result<CliComma
|
|||
pub fn parse_stake_withdraw_stake(matches: &ArgMatches<'_>) -> Result<CliCommandInfo, CliError> {
|
||||
let stake_account_pubkey = pubkey_of(matches, "stake_account_pubkey").unwrap();
|
||||
let destination_account_pubkey = pubkey_of(matches, "destination_account_pubkey").unwrap();
|
||||
let lamports = required_lamports_from(matches, "amount", "unit")?;
|
||||
let lamports = lamports_of_sol(matches, "amount").unwrap();
|
||||
let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
|
||||
let signers = pubkeys_sigs_of(&matches, SIGNER_ARG.name);
|
||||
let blockhash_query = BlockhashQuery::new_from_matches(matches);
|
||||
|
@ -1865,7 +1841,6 @@ mod tests {
|
|||
&custodian_string,
|
||||
"--lockup-epoch",
|
||||
"43",
|
||||
"lamports",
|
||||
]);
|
||||
assert_eq!(
|
||||
parse_command(&test_create_stake_account).unwrap(),
|
||||
|
@ -1880,7 +1855,7 @@ mod tests {
|
|||
unix_timestamp: 0,
|
||||
custodian,
|
||||
},
|
||||
lamports: 50,
|
||||
lamports: 50_000_000_000,
|
||||
sign_only: false,
|
||||
signers: None,
|
||||
blockhash_query: BlockhashQuery::All,
|
||||
|
@ -1904,7 +1879,6 @@ mod tests {
|
|||
"create-stake-account",
|
||||
&keypair_file,
|
||||
"50",
|
||||
"lamports",
|
||||
]);
|
||||
|
||||
assert_eq!(
|
||||
|
@ -1916,7 +1890,7 @@ mod tests {
|
|||
staker: None,
|
||||
withdrawer: None,
|
||||
lockup: Lockup::default(),
|
||||
lamports: 50,
|
||||
lamports: 50_000_000_000,
|
||||
sign_only: false,
|
||||
signers: None,
|
||||
blockhash_query: BlockhashQuery::All,
|
||||
|
@ -1944,7 +1918,6 @@ mod tests {
|
|||
"create-stake-account",
|
||||
&keypair_file,
|
||||
"50",
|
||||
"lamports",
|
||||
"--blockhash",
|
||||
&nonce_hash_string,
|
||||
"--nonce",
|
||||
|
@ -1968,7 +1941,7 @@ mod tests {
|
|||
staker: None,
|
||||
withdrawer: None,
|
||||
lockup: Lockup::default(),
|
||||
lamports: 50,
|
||||
lamports: 50_000_000_000,
|
||||
sign_only: false,
|
||||
signers: Some(vec![(offline_pubkey, offline_sig)]),
|
||||
blockhash_query: BlockhashQuery::FeeCalculator(nonce_hash),
|
||||
|
@ -2270,7 +2243,6 @@ mod tests {
|
|||
&stake_account_string,
|
||||
&stake_account_string,
|
||||
"42",
|
||||
"lamports",
|
||||
]);
|
||||
|
||||
assert_eq!(
|
||||
|
@ -2279,7 +2251,7 @@ mod tests {
|
|||
command: CliCommand::WithdrawStake {
|
||||
stake_account_pubkey,
|
||||
destination_account_pubkey: stake_account_pubkey,
|
||||
lamports: 42,
|
||||
lamports: 42_000_000_000,
|
||||
withdraw_authority: None,
|
||||
sign_only: false,
|
||||
signers: None,
|
||||
|
@ -2299,7 +2271,6 @@ mod tests {
|
|||
&stake_account_string,
|
||||
&stake_account_string,
|
||||
"42",
|
||||
"lamports",
|
||||
"--withdraw-authority",
|
||||
&stake_authority_keypair_file,
|
||||
]);
|
||||
|
@ -2310,7 +2281,7 @@ mod tests {
|
|||
command: CliCommand::WithdrawStake {
|
||||
stake_account_pubkey,
|
||||
destination_account_pubkey: stake_account_pubkey,
|
||||
lamports: 42,
|
||||
lamports: 42_000_000_000,
|
||||
withdraw_authority: Some(
|
||||
read_keypair_file(&stake_authority_keypair_file)
|
||||
.unwrap()
|
||||
|
@ -2334,7 +2305,6 @@ mod tests {
|
|||
&stake_account_string,
|
||||
&stake_account_string,
|
||||
"42",
|
||||
"lamports",
|
||||
"--withdraw-authority",
|
||||
&stake_authority_keypair_file,
|
||||
"--blockhash",
|
||||
|
@ -2355,7 +2325,7 @@ mod tests {
|
|||
command: CliCommand::WithdrawStake {
|
||||
stake_account_pubkey,
|
||||
destination_account_pubkey: stake_account_pubkey,
|
||||
lamports: 42,
|
||||
lamports: 42_000_000_000,
|
||||
withdraw_authority: Some(
|
||||
read_keypair_file(&stake_authority_keypair_file)
|
||||
.unwrap()
|
||||
|
@ -2608,7 +2578,6 @@ mod tests {
|
|||
&keypair_file,
|
||||
&split_stake_account_keypair_file,
|
||||
"50",
|
||||
"lamports",
|
||||
]);
|
||||
assert_eq!(
|
||||
parse_command(&test_split_stake_account).unwrap(),
|
||||
|
@ -2625,7 +2594,7 @@ mod tests {
|
|||
.unwrap()
|
||||
.into(),
|
||||
seed: None,
|
||||
lamports: 50,
|
||||
lamports: 50_000_000_000,
|
||||
fee_payer: None,
|
||||
},
|
||||
require_keypair: true
|
||||
|
@ -2654,7 +2623,6 @@ mod tests {
|
|||
&keypair_file,
|
||||
&split_stake_account_keypair_file,
|
||||
"50",
|
||||
"lamports",
|
||||
"--stake-authority",
|
||||
&stake_auth_string,
|
||||
"--blockhash",
|
||||
|
@ -2688,7 +2656,7 @@ mod tests {
|
|||
.unwrap()
|
||||
.into(),
|
||||
seed: None,
|
||||
lamports: 50,
|
||||
lamports: 50_000_000_000,
|
||||
fee_payer: Some(nonce_auth_pubkey.into()),
|
||||
},
|
||||
require_keypair: false,
|
||||
|
|
|
@ -43,7 +43,6 @@ fn test_cli_deploy_program() {
|
|||
faucet_host: None,
|
||||
faucet_port: faucet_addr.port(),
|
||||
lamports: minimum_balance_for_rent_exemption + 1, // min balance for rent exemption + leftover for tx processing
|
||||
use_lamports_unit: true,
|
||||
};
|
||||
process_command(&config).unwrap();
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ fn test_cli_request_airdrop() {
|
|||
faucet_host: None,
|
||||
faucet_port: faucet_addr.port(),
|
||||
lamports: 50,
|
||||
use_lamports_unit: true,
|
||||
};
|
||||
|
||||
let sig_response = process_command(&bob_config);
|
||||
|
|
|
@ -8,7 +8,7 @@ here=$(dirname "$0")
|
|||
# shellcheck source=multinode-demo/common.sh
|
||||
source "$here"/common.sh
|
||||
|
||||
stake_lamports=1000000000 # default number of lamports to assign as stake (1 SOL)
|
||||
stake_sol=1 # default number of SOL to assign as stake (1 SOL)
|
||||
url=http://127.0.0.1:8899 # default RPC url
|
||||
|
||||
usage() {
|
||||
|
@ -18,7 +18,7 @@ usage() {
|
|||
fi
|
||||
cat <<EOF
|
||||
|
||||
usage: $0 [OPTIONS] <lamports to stake ($stake_lamports)>
|
||||
usage: $0 [OPTIONS] <SOL to stake ($stake_sol)>
|
||||
|
||||
Add stake to a validator
|
||||
|
||||
|
@ -75,7 +75,7 @@ if [[ ${#positional_args[@]} -gt 1 ]]; then
|
|||
usage "$@"
|
||||
fi
|
||||
if [[ -n ${positional_args[0]} ]]; then
|
||||
stake_lamports=${positional_args[0]}
|
||||
stake_sol=${positional_args[0]}
|
||||
fi
|
||||
|
||||
config_dir="$SOLANA_CONFIG_DIR/validator$label"
|
||||
|
@ -93,7 +93,7 @@ if [[ -f $stake_keypair_path ]]; then
|
|||
fi
|
||||
|
||||
if ((airdrops_enabled)); then
|
||||
$solana_cli "${common_args[@]}" airdrop "$stake_lamports" lamports
|
||||
$solana_cli "${common_args[@]}" airdrop "$stake_sol"
|
||||
fi
|
||||
|
||||
$solana_keygen new --no-passphrase -so "$stake_keypair_path"
|
||||
|
@ -102,7 +102,7 @@ set -x
|
|||
$solana_cli "${common_args[@]}" \
|
||||
vote-account "$vote_keypair_path"
|
||||
$solana_cli "${common_args[@]}" \
|
||||
create-stake-account "$stake_keypair_path" "$stake_lamports" lamports
|
||||
create-stake-account "$stake_keypair_path" "$stake_sol"
|
||||
$solana_cli "${common_args[@]}" \
|
||||
delegate-stake $maybe_force "$stake_keypair_path" "$vote_keypair_path"
|
||||
$solana_cli "${common_args[@]}" stakes "$stake_keypair_path"
|
||||
|
|
|
@ -8,7 +8,7 @@ source "$here"/common.sh
|
|||
|
||||
args=()
|
||||
airdrops_enabled=1
|
||||
node_lamports=500000000000 # 500 SOL: number of lamports to airdrop the node for transaction fees and vote account rent exemption (ignored if airdrops_enabled=0)
|
||||
node_sol=500 # 500 SOL: number of SOL to airdrop the node for transaction fees and vote account rent exemption (ignored if airdrops_enabled=0)
|
||||
label=
|
||||
identity_keypair_path=
|
||||
voting_keypair_path=
|
||||
|
@ -33,7 +33,7 @@ OPTIONS:
|
|||
--init-complete-file FILE - create this file, if it doesn't already exist, once node initialization is complete
|
||||
--label LABEL - Append the given label to the configuration files, useful when running
|
||||
multiple validators in the same workspace
|
||||
--node-lamports LAMPORTS - Number of lamports this node has been funded from the genesis config (default: $node_lamports)
|
||||
--node-sol SOL - Number of SOL this node has been funded from the genesis config (default: $node_sol)
|
||||
--no-voting - start node without vote signer
|
||||
--rpc-port port - custom RPC port for this node
|
||||
--no-restart - do not restart the node if it exits
|
||||
|
@ -53,8 +53,8 @@ while [[ -n $1 ]]; do
|
|||
elif [[ $1 = --no-restart ]]; then
|
||||
no_restart=1
|
||||
shift
|
||||
elif [[ $1 = --node-lamports ]]; then
|
||||
node_lamports="$2"
|
||||
elif [[ $1 = --node-sol ]]; then
|
||||
node_sol="$2"
|
||||
shift 2
|
||||
elif [[ $1 = --no-airdrop ]]; then
|
||||
airdrops_enabled=0
|
||||
|
@ -251,12 +251,12 @@ wallet() {
|
|||
}
|
||||
|
||||
setup_validator_accounts() {
|
||||
declare node_lamports=$1
|
||||
declare node_sol=$1
|
||||
|
||||
if ! wallet vote-account "$voting_keypair_path"; then
|
||||
if ((airdrops_enabled)); then
|
||||
echo "Adding $node_lamports to validator identity account:"
|
||||
wallet airdrop "$node_lamports" lamports || return $?
|
||||
echo "Adding $node_sol to validator identity account:"
|
||||
wallet airdrop "$node_sol" || return $?
|
||||
fi
|
||||
|
||||
echo "Creating validator vote account"
|
||||
|
@ -271,7 +271,7 @@ setup_validator_accounts() {
|
|||
echo "Validator storage account configured"
|
||||
|
||||
echo "Validator identity account balance:"
|
||||
wallet balance --lamports || return $?
|
||||
wallet balance || return $?
|
||||
|
||||
return 0
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ rpc_url=$($solana_gossip rpc-url --entrypoint "$gossip_entrypoint" --any)
|
|||
[[ -r "$voting_keypair_path" ]] || $solana_keygen new --no-passphrase -so "$voting_keypair_path"
|
||||
[[ -r "$storage_keypair_path" ]] || $solana_keygen new --no-passphrase -so "$storage_keypair_path"
|
||||
|
||||
setup_validator_accounts "$node_lamports"
|
||||
setup_validator_accounts "$node_sol"
|
||||
|
||||
while true; do
|
||||
echo "$PS4$program ${args[*]}"
|
||||
|
|
|
@ -75,7 +75,7 @@ set -x
|
|||
balance=$(solana $maybeKeypair --url "$URL" balance --lamports)
|
||||
if [[ $balance = "0 lamports" ]]; then
|
||||
# shellcheck disable=SC2086 # Don't want to double quote $maybeKeypair
|
||||
solana $maybeKeypair --url "$URL" airdrop 42 lamports
|
||||
solana $maybeKeypair --url "$URL" airdrop 0.000000042
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2086 # Don't want to double quote $maybeKeypair
|
||||
|
|
Loading…
Reference in New Issue