Skip to content

Commit

Permalink
fix: handle SAC spec
Browse files Browse the repository at this point in the history
Wasm files have metadata that isn't currently used by typebindings. However, we were creating a higher level Spec (not just  `Vec<ScSpecEntry>`), from the raw bytes of the XDR.
  • Loading branch information
willemneal authored and gitbutler-client committed Dec 13, 2024
1 parent faf0d01 commit d3b9ee0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/soroban-cli/src/commands/contract/bindings/typescript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ pub enum Error {
FailedToGetFileName(PathBuf),
#[error(transparent)]
WasmOrContract(#[from] wasm_or_contract::Error),
#[error(transparent)]
Xdr(#[from] crate::xdr::Error),
}

#[async_trait::async_trait]
Expand All @@ -62,9 +64,9 @@ impl NetworkRunnable for Cmd {
wasm_or_contract::fetch_wasm(&self.wasm_or_hash_or_contract_id, &print).await?;

let spec = if let Some(spec) = spec {
Spec::new(&spec)?
Spec::new(&spec)?.spec
} else {
Spec::new(&soroban_sdk::token::StellarAssetSpec::spec_xdr())?
soroban_spec::read::parse_raw(&soroban_sdk::token::StellarAssetSpec::spec_xdr())?
};

if self.output_dir.is_file() {
Expand Down Expand Up @@ -94,7 +96,7 @@ impl NetworkRunnable for Cmd {
contract_address.as_deref(),
network.as_ref().map(|n| n.rpc_url.as_ref()),
network.as_ref().map(|n| n.network_passphrase.as_ref()),
&spec.spec,
&spec,
)?;
print.checkln("Generated!");
print.infoln(format!(
Expand Down

0 comments on commit d3b9ee0

Please sign in to comment.