|
@@ -67,6 +67,9 @@ pub enum Command {
|
|
|
/// Output directory for the IDL.
|
|
|
#[clap(short, long)]
|
|
|
idl: Option<String>,
|
|
|
+ /// Output directory for the TypeScript IDL.
|
|
|
+ #[clap(short = 't', long)]
|
|
|
+ idl_ts: Option<String>,
|
|
|
/// True if the build artifact needs to be deterministic and verifiable.
|
|
|
#[clap(short, long)]
|
|
|
verifiable: bool,
|
|
@@ -314,6 +317,7 @@ pub fn entry(opts: Opts) -> Result<()> {
|
|
|
Command::New { name } => new(&opts.cfg_override, name),
|
|
|
Command::Build {
|
|
|
idl,
|
|
|
+ idl_ts,
|
|
|
verifiable,
|
|
|
program_name,
|
|
|
solana_version,
|
|
@@ -321,6 +325,7 @@ pub fn entry(opts: Opts) -> Result<()> {
|
|
|
} => build(
|
|
|
&opts.cfg_override,
|
|
|
idl,
|
|
|
+ idl_ts,
|
|
|
verifiable,
|
|
|
program_name,
|
|
|
solana_version,
|
|
@@ -513,6 +518,7 @@ fn new_program(name: &str) -> Result<()> {
|
|
|
pub fn build(
|
|
|
cfg_override: &ConfigOverride,
|
|
|
idl: Option<String>,
|
|
|
+ idl_ts: Option<String>,
|
|
|
verifiable: bool,
|
|
|
program_name: Option<String>,
|
|
|
solana_version: Option<String>,
|
|
@@ -530,14 +536,17 @@ pub fn build(
|
|
|
|
|
|
let cargo = Manifest::discover()?;
|
|
|
|
|
|
- fs::create_dir_all(cfg_parent.join("target/idl"))?;
|
|
|
- fs::create_dir_all(cfg_parent.join("target/types"))?;
|
|
|
-
|
|
|
let idl_out = match idl {
|
|
|
Some(idl) => Some(PathBuf::from(idl)),
|
|
|
None => Some(cfg_parent.join("target/idl")),
|
|
|
};
|
|
|
- let idl_ts_out = Some(cfg_parent.join("target/types"));
|
|
|
+ fs::create_dir_all(idl_out.as_ref().unwrap())?;
|
|
|
+
|
|
|
+ let idl_ts_out = match idl_ts {
|
|
|
+ Some(idl_ts) => Some(PathBuf::from(idl_ts)),
|
|
|
+ None => Some(cfg_parent.join("target/types")),
|
|
|
+ };
|
|
|
+ fs::create_dir_all(idl_ts_out.as_ref().unwrap())?;
|
|
|
|
|
|
let solana_version = match solana_version.is_some() {
|
|
|
true => solana_version,
|
|
@@ -940,6 +949,7 @@ fn verify(
|
|
|
build(
|
|
|
cfg_override,
|
|
|
None,
|
|
|
+ None,
|
|
|
true,
|
|
|
None,
|
|
|
match solana_version.is_some() {
|
|
@@ -1457,6 +1467,7 @@ fn test(
|
|
|
build(
|
|
|
cfg_override,
|
|
|
None,
|
|
|
+ None,
|
|
|
false,
|
|
|
None,
|
|
|
None,
|
|
@@ -2364,6 +2375,7 @@ fn publish(
|
|
|
build(
|
|
|
cfg_override,
|
|
|
None,
|
|
|
+ None,
|
|
|
true,
|
|
|
Some(program_name),
|
|
|
cfg.solana_version.clone(),
|
|
@@ -2458,6 +2470,7 @@ fn localnet(
|
|
|
build(
|
|
|
cfg_override,
|
|
|
None,
|
|
|
+ None,
|
|
|
false,
|
|
|
None,
|
|
|
None,
|