Skip to content

Commit

Permalink
Merge pull request #3 from octopus-network/doc-add-clean-up-docs
Browse files Browse the repository at this point in the history
docs: add clean up command docs
  • Loading branch information
hsxyl authored Sep 16, 2022
2 parents 4103889 + 64faf02 commit 80a1a25
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
30 changes: 24 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,42 @@ You can run oct-cli in command and finish some functions interactively, eg:

![](./docs/example.gif)

After the interactive program is executed, the command line parameters will be printed, and next time you can skip the interaction and use the command line directly.

## Anchor upgrade
## Deploy or Upgrade

```shell
USAGE:
oct-cli anchor-upgrade [SUBCOMMAND]
oct-cli deploy-or-upgrade [SUBCOMMAND]

FLAGS:
-h, --help Prints help information

SUBCOMMANDS:
mainnet Provide data for the server https://rpc.mainnet.near.org
testnet Provide data for the server https://rpc.testnet.near.org

mainnet
testnet
```
**example**
1. How to upgrade anchor contract from v2.1.0 to v2.2.0 in account: anchorxsb.testnet:
```shell
./oct-cli anchor-upgrade testnet select-private manual-select-accounts --account-ids anchorxsb.testnet upgrade /Users/xushenbao/project/blockchian/octopus/oct-cli-rs/res/appchain_anchor_v2.0.0.wasm new '{"appchain_id": "appchain_id", "appchain_registry": "appchain_registry", "oct_token": "oct_token"}'
oct-cli deploy-or-upgrade testnet select-rpc block-pi select-accounts manual-select-accounts --account-ids anchorxsb.testnet upgrade /Users/xushenbao/project/blockchian/octopus/oct-cli-rs/res/appchain_anchor_v2.1.0.wasm migrate_state {}
```

## Clean up states

```shell
USAGE:
oct-cli clean-state [SUBCOMMAND]

FLAGS:
-h, --help Prints help information

SUBCOMMANDS:
mainnet
testnet
```
**example**
1. Clean up `anchorxsb.testnet`:
```shell
oct-cli clean-state testnet select-rpc block-pi select-accounts manual-select-accounts --account-ids anchorxsb.testnet clean-state y
```
2 changes: 0 additions & 2 deletions src/commands/clean_state_command/select_env/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ pub mod select_rpc;
#[interactive_clap(context = ())]
///Select NEAR environment
pub enum SelectEnv {
/// Provide data for the server https://rpc.testnet.near.org
#[strum_discriminants(strum(message = "Testnet"))]
Testnet(self::env::Env),
/// Provide data for the server https://rpc.mainnet.near.org
#[strum_discriminants(strum(message = "Mainnet"))]
Mainnet(self::env::Env),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ pub mod clean;
pub enum SelectAccounts {
#[strum_discriminants(strum(message = "Input accounts need to upgrade(eg: a.testnet,b.testnet,c.testnet),make sure you have been login these accounts in this system"))]
ManualSelectAccounts(self::manual_select_accounts::ManualSelectAccounts),
/// Provide data for the server https://rpc.mainnet.near.org
#[strum_discriminants(strum(message = "Select all accounts located in ~/.near-credentials"))]
DefaultDirectory(self::default_directory::DefaultDirectory),
#[strum_discriminants(strum(message = "Select all accounts located in custom directory."))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ pub mod upgrade;
pub enum SelectAccounts {
#[strum_discriminants(strum(message = "Input accounts(eg: a.testnet,b.testnet,c.testnet),make sure you have been login these accounts in this system"))]
ManualSelectAccounts(self::manual_select_accounts::ManualSelectAccounts),
/// Provide data for the server https://rpc.mainnet.near.org
#[strum_discriminants(strum(message = "Select all accounts located in ~/.near-credentials"))]
DefaultDirectory(self::default_directory::DefaultDirectory),
#[strum_discriminants(strum(message = "Select all accounts located in custom directory."))]
Expand Down
2 changes: 1 addition & 1 deletion src/near/contracts/clean_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl<'s> CleanStateContract<'s> {
let result = self.client.view_state(signer.account_id.clone(), None, None).await?;
let keys = result.values.iter().map(|e| e.key.clone()).collect_vec();

println!("Read account state before clean up: {:?}", result);
println!("Read account state keys before clean up: \n---\n {:?} \n---\n", keys);

self.client.call(
signer,
Expand Down

0 comments on commit 80a1a25

Please sign in to comment.