Skip to content

Commit

Permalink
Add support for contract id alias on `stellar contract bindings types…
Browse files Browse the repository at this point in the history
…cript`. (#1403)
  • Loading branch information
fnando authored Jun 25, 2024
1 parent 257c236 commit 675f5d6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cmd/soroban-cli/src/commands/contract/bindings/typescript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ pub enum Error {
CannotParseContractId(String, DecodeError),
#[error(transparent)]
UtilsError(#[from] get_spec::Error),
#[error(transparent)]
Config(#[from] config::Error),
}

#[async_trait::async_trait]
Expand All @@ -87,8 +89,15 @@ impl NetworkRunnable for Cmd {
let wasm: wasm::Args = wasm.into();
wasm.parse()?.spec
} else {
let contract_id = soroban_spec_tools::utils::contract_id_from_str(&self.contract_id)
.map_err(|e| Error::CannotParseContractId(self.contract_id.clone(), e))?;
let network = config.map_or_else(
|| self.network.get(&self.locator).map_err(Error::from),
|c| c.get_network().map_err(Error::from),
)?;

let contract_id = self
.locator
.resolve_contract_id(&self.contract_id, &network.network_passphrase)?;

get_remote_contract_spec(
&contract_id,
&self.locator,
Expand Down

0 comments on commit 675f5d6

Please sign in to comment.