From b0f8a983c4ce596c4635c5b3ea52c27a74b23a24 Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Thu, 8 Nov 2018 15:42:20 -0700 Subject: [PATCH] Add the solana-wallet documentation (#1744) * Add the solana-wallet documentation There doesn't seem to be a way to publish bin docs to crates.io. Until there is, we can include CLI documentation is the appendix of the markdown book. * A command to generate all the usage docs Usage: $ scripts/wallet-help.sh >> src/wallet.md --- scripts/wallet-help.sh | 20 +++ src/SUMMARY.md | 1 + src/wallet.md | 353 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 374 insertions(+) create mode 100755 scripts/wallet-help.sh create mode 100644 src/wallet.md diff --git a/scripts/wallet-help.sh b/scripts/wallet-help.sh new file mode 100755 index 000000000..604117eff --- /dev/null +++ b/scripts/wallet-help.sh @@ -0,0 +1,20 @@ +#!/bin/bash -e + +cd "$(dirname "$0")"/.. + +cargo build +export PATH=$PWD/target/debug:$PATH + +echo "\`\`\`manpage" +solana-wallet --help +echo "\`\`\`" +echo "" + +commands=(address airdrop balance cancel confirm deploy get-transaction-count pay send-signature send-timestamp) + +for x in "${commands[@]}"; do + echo "\`\`\`manpage" + solana-wallet "${x}" --help + echo "\`\`\`" + echo "" +done diff --git a/src/SUMMARY.md b/src/SUMMARY.md index c5273b74c..2f20e3237 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -24,4 +24,5 @@ - [Appendix](appendix.md) - [Terminology](terminology.md) - [JSON RPC API](jsonrpc-api.md) + - [solana-wallet CLI](wallet.md) diff --git a/src/wallet.md b/src/wallet.md new file mode 100644 index 000000000..0b47f14da --- /dev/null +++ b/src/wallet.md @@ -0,0 +1,353 @@ +## solana-wallet CLI + +The [solana crate](https://crates.io/crates/solana) is distributed with a command-line interface tool + +### Examples + +#### Get Pubkey + +```sh +// Command +$ solana-wallet address + +// Return + +``` + +#### Airdrop Tokens + +```sh +// Command +$ solana-wallet airdrop 123 + +// Return +"Your balance is: 123" +``` + +#### Get Balance + +```sh +// Command +$ solana-wallet balance + +// Return +"Your balance is: 123" +``` + +#### Confirm Transaction + +```sh +// Command +$ solana-wallet confirm + +// Return +"Confirmed" / "Not found" +``` + +#### Deploy program + +```sh +// Command +$ solana-wallet deploy + +// Return + +``` + +#### Unconditional Immediate Transfer + +```sh +// Command +$ solana-wallet pay 123 + +// Return + +``` + +#### Post-Dated Transfer + +```sh +// Command +$ solana-wallet pay 123 \ + --after 2018-12-24T23:59:00 --require-timestamp-from + +// Return +{signature: , processId: } +``` +*`require-timestamp-from` is optional. If not provided, the transaction will expect a timestamp signed by this wallet's secret key* + +#### Authorized Transfer + +A third party must send a signature to unlock the tokens. +```sh +// Command +$ solana-wallet pay 123 \ + --require-signature-from + +// Return +{signature: , processId: } +``` + +#### Post-Dated and Authorized Transfer + +```sh +// Command +$ solana-wallet pay 123 \ + --after 2018-12-24T23:59 --require-timestamp-from \ + --require-signature-from + +// Return +{signature: , processId: } +``` + +#### Multiple Witnesses + +```sh +// Command +$ solana-wallet pay 123 \ + --require-signature-from \ + --require-signature-from + +// Return +{signature: , processId: } +``` + +#### Cancelable Transfer + +```sh +// Command +$ solana-wallet pay 123 \ + --require-signature-from \ + --cancelable + +// Return +{signature: , processId: } +``` + +#### Cancel Transfer + +```sh +// Command +$ solana-wallet cancel + +// Return + +``` + +#### Send Signature + +```sh +// Command +$ solana-wallet send-signature + +// Return + +``` + +#### Indicate Elapsed Time + +Use the current system time: +```sh +// Command +$ solana-wallet send-timestamp + +// Return + +``` + +Or specify some other arbitrary timestamp: + +```sh +// Command +$ solana-wallet send-timestamp --date 2018-12-24T23:59:00 + +// Return + +``` + +### Usage + +```manpage +solana-wallet 0.11.0 + +USAGE: + solana-wallet [OPTIONS] [SUBCOMMAND] + +FLAGS: + -h, --help Prints help information + -V, --version Prints version information + +OPTIONS: + -k, --keypair /path/to/id.json + -n, --network Rendezvous with the network at this gossip entry point; defaults to 127.0.0.1:8001 + --proxy Address of TLS proxy + --port Optional rpc-port configuration to connect to non-default nodes + --timeout Max seconds to wait to get necessary gossip from the network + +SUBCOMMANDS: + address Get your public key + airdrop Request a batch of tokens + balance Get your balance + cancel Cancel a transfer + confirm Confirm transaction by signature + deploy Deploy a program + get-transaction-count Get current transaction count + help Prints this message or the help of the given subcommand(s) + pay Send a payment + send-signature Send a signature to authorize a transfer + send-timestamp Send a timestamp to unlock a transfer +``` + +```manpage +solana-wallet-address +Get your public key + +USAGE: + solana-wallet address + +FLAGS: + -h, --help Prints help information + -V, --version Prints version information +``` + +```manpage +solana-wallet-airdrop +Request a batch of tokens + +USAGE: + solana-wallet airdrop + +FLAGS: + -h, --help Prints help information + -V, --version Prints version information + +ARGS: + The number of tokens to request +``` + +```manpage +solana-wallet-balance +Get your balance + +USAGE: + solana-wallet balance + +FLAGS: + -h, --help Prints help information + -V, --version Prints version information +``` + +```manpage +solana-wallet-cancel +Cancel a transfer + +USAGE: + solana-wallet cancel + +FLAGS: + -h, --help Prints help information + -V, --version Prints version information + +ARGS: + The process id of the transfer to cancel +``` + +```manpage +solana-wallet-confirm +Confirm transaction by signature + +USAGE: + solana-wallet confirm + +FLAGS: + -h, --help Prints help information + -V, --version Prints version information + +ARGS: + The transaction signature to confirm +``` + +```manpage +solana-wallet-deploy +Deploy a program + +USAGE: + solana-wallet deploy + +FLAGS: + -h, --help Prints help information + -V, --version Prints version information + +ARGS: + /path/to/program.o +``` + +```manpage +solana-wallet-get-transaction-count +Get current transaction count + +USAGE: + solana-wallet get-transaction-count + +FLAGS: + -h, --help Prints help information + -V, --version Prints version information +``` + +```manpage +solana-wallet-pay +Send a payment + +USAGE: + solana-wallet pay [FLAGS] [OPTIONS] + +FLAGS: + --cancelable + -h, --help Prints help information + -V, --version Prints version information + +OPTIONS: + --after A timestamp after which transaction will execute + --require-timestamp-from Require timestamp from this third party + --require-signature-from ... Any third party signatures required to unlock the tokens + +ARGS: + The pubkey of recipient + The number of tokens to send +``` + +```manpage +solana-wallet-send-signature +Send a signature to authorize a transfer + +USAGE: + solana-wallet send-signature + +FLAGS: + -h, --help Prints help information + -V, --version Prints version information + +ARGS: + The pubkey of recipient + The process id of the transfer to authorize +``` + +```manpage +solana-wallet-send-timestamp +Send a timestamp to unlock a transfer + +USAGE: + solana-wallet send-timestamp [OPTIONS] + +FLAGS: + -h, --help Prints help information + -V, --version Prints version information + +OPTIONS: + --date Optional arbitrary timestamp to apply + +ARGS: + The pubkey of recipient + The process id of the transfer to unlock +``` +