Skip to content

Commit

Permalink
Add to CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
thibault-martinez committed Nov 21, 2023
1 parent 8b5c2d1 commit f0ed640
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions cli/src/wallet_cli/completer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const WALLET_COMMANDS: &[&str] = &[
"exit",
"faucet",
"implicit-account-creation-address",
"implicit-account-transition",
"implicit-accounts",
"melt-native-token",
"mint-native-token",
Expand Down
15 changes: 15 additions & 0 deletions cli/src/wallet_cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ pub enum WalletCommand {
},
/// Returns the implicit account creation address of the wallet if it is Ed25519 based.
ImplicitAccountCreationAddress,
/// Transitions an implicit account to an account.
ImplicitAccountTransition {
/// Identifier of the implicit account output.
output_id: OutputId,
},
/// Lists the implicit accounts of the wallet.
ImplicitAccounts,
/// Mint additional native tokens.
Expand Down Expand Up @@ -578,6 +583,13 @@ pub async fn implicit_account_creation_address_command(wallet: &Wallet) -> Resul
Ok(())
}

// `implicit-account-transition` command
pub async fn implicit_account_transition_command(wallet: &Wallet, output_id: OutputId) -> Result<(), Error> {
wallet.implicit_account_transition(&output_id).await?;

Ok(())
}

// `implicit-accounts` command
pub async fn implicit_accounts_command(wallet: &Wallet) -> Result<(), Error> {
print_outputs(wallet.implicit_accounts().await, "Implicit accounts:").await
Expand Down Expand Up @@ -1103,6 +1115,9 @@ pub async fn prompt_internal(
WalletCommand::ImplicitAccountCreationAddress => {
implicit_account_creation_address_command(wallet).await
}
WalletCommand::ImplicitAccountTransition { output_id } => {
implicit_account_transition_command(wallet, output_id).await
}
WalletCommand::ImplicitAccounts => implicit_accounts_command(wallet).await,
WalletCommand::MeltNativeToken { token_id, amount } => {
melt_native_token_command(wallet, token_id, amount).await
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/wallet/operations/transaction/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ where
crate::wallet::Error: From<S::Error>,
crate::client::Error: From<S::Error>,
{
async fn implicit_account_transition(&self, output_id: &OutputId) -> Result<TransactionWithMetadata> {
pub async fn implicit_account_transition(&self, output_id: &OutputId) -> Result<TransactionWithMetadata> {
let implicit_account_data = self.data().await.unspent_outputs.get(output_id).cloned();

let implicit_account = if let Some(implicit_account_data) = &implicit_account_data {
Expand Down

0 comments on commit f0ed640

Please sign in to comment.