Skip to content
Draft

Shank #381

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions addons/svm/core/src/codec/anchor.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{path::PathBuf, str::FromStr};
use std::path::PathBuf;

use crate::{codec::validate_program_so, typing::anchor::types as anchor_types};

Expand Down Expand Up @@ -87,14 +87,22 @@ impl AnchorProgramArtifacts {
None
};

let program_id = Pubkey::from_str(&idl_ref.idl.address).map_err(|e| {
let program_id = idl_ref.get_program_pubkey().map_err(|e| {
format!(
"invalid anchor program idl at location {}: {}",
&idl_path.to_str().unwrap_or(""),
e
)
})?;
Ok(Self { idl: idl_ref.idl, bin, keypair, program_id })

let idl = idl_ref.as_anchor().ok_or_else(|| {
format!(
"expected Anchor IDL at location {}, but found a different IDL format",
&idl_path.to_str().unwrap_or("")
)
})?.clone();

Ok(Self { idl, bin, keypair, program_id })
}

pub fn to_value(&self) -> Result<Value, String> {
Expand Down
Loading