-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update tx new commands to use Address type
Add tests using
- Loading branch information
1 parent
faebd85
commit 10fb1da
Showing
10 changed files
with
192 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
use clap::{command, Parser}; | ||
|
||
use crate::{commands::tx, xdr}; | ||
use crate::{commands::tx, config::address, xdr}; | ||
|
||
#[derive(Parser, Debug, Clone)] | ||
#[group(skip)] | ||
pub struct Cmd { | ||
#[command(flatten)] | ||
pub tx: tx::Args, | ||
/// Muxed Account to merge with, e.g. `GBX...`, 'MBX...' | ||
/// Muxed Account to merge with, e.g. `GBX...`, 'MBX...' or alias | ||
#[arg(long)] | ||
pub account: xdr::MuxedAccount, | ||
pub account: address::Address, | ||
} | ||
|
||
impl From<&Cmd> for xdr::OperationBody { | ||
fn from(cmd: &Cmd) -> Self { | ||
xdr::OperationBody::AccountMerge(cmd.account.clone()) | ||
impl TryFrom<&Cmd> for xdr::OperationBody { | ||
type Error = tx::args::Error; | ||
fn try_from(cmd: &Cmd) -> Result<Self, Self::Error> { | ||
Ok(xdr::OperationBody::AccountMerge( | ||
cmd.tx.reslove_muxed_address(&cmd.account)?, | ||
)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.