forked from aptos-labs/aptos-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod.rs
73 lines (67 loc) · 2.93 KB
/
mod.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright © Aptos Foundation
// SPDX-License-Identifier: Apache-2.0
use crate::common::types::{CliCommand, CliResult};
use clap::Subcommand;
pub mod create;
pub mod create_resource_account;
pub mod derive_resource_account;
pub mod fund;
pub mod key_rotation;
pub mod list;
pub mod multisig_account;
pub mod transfer;
/// Tool for interacting with accounts
///
/// This tool is used to create accounts, get information about the
/// account's resources, and transfer resources between accounts.
#[derive(Debug, Subcommand)]
pub enum AccountTool {
Create(create::CreateAccount),
CreateResourceAccount(create_resource_account::CreateResourceAccount),
DeriveResourceAccountAddress(derive_resource_account::DeriveResourceAccount),
FundWithFaucet(fund::FundWithFaucet),
List(list::ListAccount),
LookupAddress(key_rotation::LookupAddress),
RotateKey(key_rotation::RotateKey),
Transfer(transfer::TransferCoins),
}
impl AccountTool {
pub async fn execute(self) -> CliResult {
match self {
AccountTool::Create(tool) => tool.execute_serialized().await,
AccountTool::CreateResourceAccount(tool) => tool.execute_serialized().await,
AccountTool::DeriveResourceAccountAddress(tool) => tool.execute_serialized().await,
AccountTool::FundWithFaucet(tool) => tool.execute_serialized().await,
AccountTool::List(tool) => tool.execute_serialized().await,
AccountTool::LookupAddress(tool) => tool.execute_serialized().await,
AccountTool::RotateKey(tool) => tool.execute_serialized().await,
AccountTool::Transfer(tool) => tool.execute_serialized().await,
}
}
}
/// Tool for interacting with multisig accounts
#[derive(Debug, Subcommand)]
pub enum MultisigAccountTool {
Approve(multisig_account::Approve),
Create(multisig_account::Create),
CreateTransaction(multisig_account::CreateTransaction),
Execute(multisig_account::Execute),
ExecuteReject(multisig_account::ExecuteReject),
ExecuteWithPayload(multisig_account::ExecuteWithPayload),
Reject(multisig_account::Reject),
VerifyProposal(multisig_account::VerifyProposal),
}
impl MultisigAccountTool {
pub async fn execute(self) -> CliResult {
match self {
MultisigAccountTool::Approve(tool) => tool.execute_serialized().await,
MultisigAccountTool::Create(tool) => tool.execute_serialized().await,
MultisigAccountTool::CreateTransaction(tool) => tool.execute_serialized().await,
MultisigAccountTool::Execute(tool) => tool.execute_serialized().await,
MultisigAccountTool::ExecuteReject(tool) => tool.execute_serialized().await,
MultisigAccountTool::ExecuteWithPayload(tool) => tool.execute_serialized().await,
MultisigAccountTool::Reject(tool) => tool.execute_serialized().await,
MultisigAccountTool::VerifyProposal(tool) => tool.execute_serialized().await,
}
}
}