Add fee-payer option to docs (#9230)

automerge
This commit is contained in:
Greg Fitzgerald 2020-04-01 11:38:55 -06:00 committed by GitHub
parent 352de7929b
commit 492b7d5ef9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 27 deletions

View File

@ -33,11 +33,13 @@ want to perform an action on the stake account you create next.
Now, create a stake account: Now, create a stake account:
```bash ```bash
solana create-stake-account --from <KEYPAIR> stake-account.json <AMOUNT> --stake-authority <KEYPAIR> --withdraw-authority <KEYPAIR> solana create-stake-account --from <KEYPAIR> stake-account.json <AMOUNT> \
--stake-authority <KEYPAIR> --withdraw-authority <KEYPAIR> \
--fee-payer <KEYPAIR>
``` ```
`<AMOUNT>` tokens are transferred from the account at `<KEYPAIR>` to a new `<AMOUNT>` tokens are transferred from the account at the "from" `<KEYPAIR>` to
stake account at the public key of stake-account.json. a new stake account at the public key of stake-account.json.
The stake-account.json file can now be discarded. To authorize additional The stake-account.json file can now be discarded. To authorize additional
actions, you will use the `--stake-authority` or `withdraw-authority` keypair, actions, you will use the `--stake-authority` or `withdraw-authority` keypair,
@ -72,7 +74,9 @@ Stake and withdraw authorities can be set when creating an account via the
run: run:
```bash ```bash
solana stake-authorize <STAKE_ACCOUNT_ADDRESS> --stake-authority <KEYPAIR> --new-stake-authority <PUBKEY> solana stake-authorize <STAKE_ACCOUNT_ADDRESS> \
--stake-authority <KEYPAIR> --new-stake-authority <PUBKEY> \
--fee-payer <KEYPAIR>
``` ```
This will use the existing stake authority `<KEYPAIR>` to authorize a new stake This will use the existing stake authority `<KEYPAIR>` to authorize a new stake
@ -87,7 +91,8 @@ addresses can be cumbersome. Fortunately, you can derive stake addresses using
the `--seed` option: the `--seed` option:
```bash ```bash
solana create-stake-account --from <KEYPAIR> <STAKE_ACCOUNT_KEYPAIR> --seed <STRING> <AMOUNT> --stake-authority <PUBKEY> --withdraw-authority <PUBKEY> solana create-stake-account --from <KEYPAIR> <STAKE_ACCOUNT_KEYPAIR> --seed <STRING> <AMOUNT> \
--stake-authority <PUBKEY> --withdraw-authority <PUBKEY> --fee-payer <KEYPAIR>
``` ```
`<STRING>` is an arbitrary string up to 32 bytes, but will typically be a `<STRING>` is an arbitrary string up to 32 bytes, but will typically be a
@ -122,12 +127,13 @@ is the vote account address. Choose a validator and use its vote account
address in `solana delegate-stake`: address in `solana delegate-stake`:
```bash ```bash
solana delegate-stake --stake-authority <KEYPAIR> <STAKE_ACCOUNT_ADDRESS> <VOTE_ACCOUNT_ADDRESS> solana delegate-stake --stake-authority <KEYPAIR> <STAKE_ACCOUNT_ADDRESS> <VOTE_ACCOUNT_ADDRESS> \
--fee-payer <KEYPAIR>
``` ```
`<KEYPAIR>` authorizes the operation on the account with address The stake authority `<KEYPAIR>` authorizes the operation on the account with
`<STAKE_ACCOUNT_ADDRESS>`. The stake is delegated to the vote account with address `<STAKE_ACCOUNT_ADDRESS>`. The stake is delegated to the vote account
address `<VOTE_ACCOUNT_ADDRESS>`. with address `<VOTE_ACCOUNT_ADDRESS>`.
After delegating stake, use `solana stake-account` to observe the changes After delegating stake, use `solana stake-account` to observe the changes
to the stake account: to the stake account:
@ -155,11 +161,12 @@ Once delegated, you can undelegate stake with the `solana deactivate-stake`
command: command:
```bash ```bash
solana deactivate-stake --stake-authority <KEYPAIR> <STAKE_ACCOUNT_ADDRESS> solana deactivate-stake --stake-authority <KEYPAIR> <STAKE_ACCOUNT_ADDRESS> \
--fee-payer <KEYPAIR>
``` ```
`<KEYPAIR>` authorizes the operation on the account with address The stake authority `<KEYPAIR>` authorizes the operation on the account
`<STAKE_ACCOUNT_ADDRESS>`. with address `<STAKE_ACCOUNT_ADDRESS>`.
Note that stake takes several epochs to "cool down". Attempts to delegate stake Note that stake takes several epochs to "cool down". Attempts to delegate stake
in the cool down period will fail. in the cool down period will fail.
@ -169,12 +176,13 @@ in the cool down period will fail.
Transfer tokens out of a stake account with the `solana withdraw-stake` command: Transfer tokens out of a stake account with the `solana withdraw-stake` command:
```bash ```bash
solana withdraw-stake --withdraw-authority <KEYPAIR> <STAKE_ACCOUNT_ADDRESS> <RECIPIENT_ADDRESS> <AMOUNT> solana withdraw-stake --withdraw-authority <KEYPAIR> <STAKE_ACCOUNT_ADDRESS> <RECIPIENT_ADDRESS> <AMOUNT> \
--fee-payer <KEYPAIR>
``` ```
`<STAKE_ACCOUNT_ADDRESS>` is the existing stake account, `<KEYPAIR>` is the `<STAKE_ACCOUNT_ADDRESS>` is the existing stake account, the stake authority
withdraw authority, and `<AMOUNT>` is the number of tokens to transfer to `<KEYPAIR>` is the withdraw authority, and `<AMOUNT>` is the number of tokens
`<RECIPIENT_ADDRESS>`. to transfer to `<RECIPIENT_ADDRESS>`.
## Split Stake ## Split Stake
@ -184,12 +192,14 @@ currently staked, cooling down, or locked up. To transfer tokens from an
existing stake account to a new one, use the `solana split-stake` command: existing stake account to a new one, use the `solana split-stake` command:
```bash ```bash
solana split-stake --stake-authority <KEYPAIR> <STAKE_ACCOUNT_ADDRESS> <NEW_STAKE_ACCOUNT_KEYPAIR> <AMOUNT> solana split-stake --stake-authority <KEYPAIR> <STAKE_ACCOUNT_ADDRESS> <NEW_STAKE_ACCOUNT_KEYPAIR> <AMOUNT> \
--fee-payer <KEYPAIR>
``` ```
`<STAKE_ACCOUNT_ADDRESS>` is the existing stake account, `<KEYPAIR>` is the `<STAKE_ACCOUNT_ADDRESS>` is the existing stake account, the stake authority
stake authority, `<NEW_STAKE_ACCOUNT_KEYPAIR>` is the keypair for the new account, `<KEYPAIR>` is the stake authority, `<NEW_STAKE_ACCOUNT_KEYPAIR>` is the
and `<AMOUNT>` is the number of tokens to transfer to the new account. keypair for the new account, and `<AMOUNT>` is the number of tokens to transfer
to the new account.
To split a stake account into a derived account address, use the `--seed` To split a stake account into a derived account address, use the `--seed`
option. See option. See

View File

@ -16,7 +16,8 @@ Create and fund a derived stake account at the stake authority public key:
```bash ```bash
solana-stake-accounts new <FUNDING_KEYPAIR> <BASE_KEYPAIR> <AMOUNT> \ solana-stake-accounts new <FUNDING_KEYPAIR> <BASE_KEYPAIR> <AMOUNT> \
--stake-authority <PUBKEY> --withdraw-authority <PUBKEY> --stake-authority <PUBKEY> --withdraw-authority <PUBKEY> \
--fee-payer <KEYPAIR>
``` ```
### Count accounts ### Count accounts
@ -51,7 +52,7 @@ Set new authorities on each derived stake account:
solana-stake-accounts authorize <BASE_PUBKEY> \ solana-stake-accounts authorize <BASE_PUBKEY> \
--stake-authority <KEYPAIR> --withdraw-authority <KEYPAIR> \ --stake-authority <KEYPAIR> --withdraw-authority <KEYPAIR> \
--new-stake-authority <PUBKEY> --new-withdraw-authority <PUBKEY> \ --new-stake-authority <PUBKEY> --new-withdraw-authority <PUBKEY> \
--num-accounts <NUMBER> --num-accounts <NUMBER> --fee-payer <KEYPAIR>
``` ```
### Relocate stake accounts ### Relocate stake accounts
@ -60,7 +61,8 @@ Relocate stake accounts:
```bash ```bash
solana-stake-accounts rebase <BASE_PUBKEY> <NEW_BASE_KEYPAIR> \ solana-stake-accounts rebase <BASE_PUBKEY> <NEW_BASE_KEYPAIR> \
--stake-authority <KEYPAIR> --num-accounts <NUMBER> --stake-authority <KEYPAIR> --num-accounts <NUMBER> \
--fee-payer <KEYPAIR>
``` ```
To atomically rebase and authorize each stake account, use the 'move' To atomically rebase and authorize each stake account, use the 'move'
@ -70,5 +72,5 @@ command:
solana-stake-accounts move <BASE_PUBKEY> <NEW_BASE_KEYPAIR> \ solana-stake-accounts move <BASE_PUBKEY> <NEW_BASE_KEYPAIR> \
--stake-authority <KEYPAIR> --withdraw-authority <KEYPAIR> \ --stake-authority <KEYPAIR> --withdraw-authority <KEYPAIR> \
--new-stake-authority <PUBKEY> --new-withdraw-authority <PUBKEY> \ --new-stake-authority <PUBKEY> --new-withdraw-authority <PUBKEY> \
--num-accounts <NUMBER> --num-accounts <NUMBER> --fee-payer <KEYPAIR>
``` ```

View File

@ -84,10 +84,10 @@ pubkey: GKvqsuNcnwWqPzzuhLmGi4rzzh55FhJtGizkhHaEJqiV
``` ```
```bash ```bash
solana transfer --from <SENDER_KEYPAIR> <RECIPIENT_ACCOUNT_ADDRESS> 5 --url http://devnet.solana.com solana transfer --from <KEYPAIR> <RECIPIENT_ACCOUNT_ADDRESS> 5--url http://devnet.solana.com --fee-payer <KEYPAIR>
``` ```
where you replace `<SENDER_KEYPAIR>` with the path to a keypair in your wallet, where you replace `<KEYPAIR>` with the path to a keypair in your wallet,
and replace `<RECIPIENT_ACCOUNT_ADDRESS>` with the output of `solana-keygen new` above. and replace `<RECIPIENT_ACCOUNT_ADDRESS>` with the output of `solana-keygen new` above.
Confirm the updated balances with `solana balance`: Confirm the updated balances with `solana balance`:
@ -107,7 +107,7 @@ tokens to transfer. Once you have that collected, you can transfer tokens
with the `solana transfer` command: with the `solana transfer` command:
```bash ```bash
solana transfer --from <SENDER_KEYPAIR> <RECIPIENT_ACCOUNT_ADDRESS> <AMOUNT> solana transfer --from <KEYPAIR> <RECIPIENT_ACCOUNT_ADDRESS> <AMOUNT> --fee-payer <KEYPAIR>
``` ```
Confirm the updated balances with `solana balance`: Confirm the updated balances with `solana balance`: