Skip to content

Commit

Permalink
Save contract id.
Browse files Browse the repository at this point in the history
  • Loading branch information
fnando committed Jan 13, 2025
1 parent 587eea6 commit 5aa80ee
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cmd/soroban-cli/src/commands/contract/deploy/asset.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::config::locator;
use crate::xdr::{
Asset, ContractDataDurability, ContractExecutable, ContractIdPreimage, CreateContractArgs,
Error as XdrError, Hash, HostFunction, InvokeHostFunctionOp, LedgerKey::ContractData,
Expand Down Expand Up @@ -41,6 +42,8 @@ pub enum Error {
Network(#[from] network::Error),
#[error(transparent)]
Builder(#[from] builder::Error),
#[error(transparent)]
Locator(#[from] locator::Error),
}

impl From<Infallible> for Error {
Expand Down Expand Up @@ -75,6 +78,16 @@ impl Cmd {
match res {
TxnEnvelopeResult::TxnEnvelope(tx) => println!("{}", tx.to_xdr_base64(Limits::none())?),
TxnEnvelopeResult::Res(contract) => {
let network = self.config.get_network()?;

if let Some(alias) = self.alias.clone() {
self.config.locator.save_contract_id(
&network.network_passphrase,
&contract,
&alias,
)?;
}

println!("{contract}");
}
}
Expand Down

0 comments on commit 5aa80ee

Please sign in to comment.