Compare commits
3 Commits
3c9c173b92
...
89ea0f17d2
Author | SHA1 | Date |
---|---|---|
Confucian | 89ea0f17d2 | |
czkz | c96846fce2 | |
Confucian | 3a124d6f25 |
|
@ -17,6 +17,7 @@ The minor version will be incremented upon a breaking change and the patch versi
|
|||
### Fixes
|
||||
|
||||
- lang: Eliminate variable allocations that build up stack space for token extension code generation ([#2913](https://github.com/coral-xyz/anchor/pull/2913)).
|
||||
- ts: Fix incorrect `maxSupportedTransactionVersion` in `AnchorProvider.send*()` methods ([#2922](https://github.com/coral-xyz/anchor/pull/2922)).
|
||||
|
||||
### Breaking
|
||||
|
||||
|
|
|
@ -239,6 +239,11 @@ pub enum Command {
|
|||
#[clap(long, action)]
|
||||
force: bool,
|
||||
},
|
||||
/// Remove a existed program.
|
||||
Remove {
|
||||
/// Program name
|
||||
name: String,
|
||||
},
|
||||
/// Commands for interacting with interface definitions.
|
||||
Idl {
|
||||
#[clap(subcommand)]
|
||||
|
@ -681,6 +686,7 @@ fn process_command(opts: Opts) -> Result<()> {
|
|||
template,
|
||||
force,
|
||||
} => new(&opts.cfg_override, solidity, name, template, force),
|
||||
Command::Remove { name } => remove(&opts.cfg_override, name),
|
||||
Command::Build {
|
||||
no_idl,
|
||||
idl,
|
||||
|
@ -1044,6 +1050,41 @@ fn new(
|
|||
})
|
||||
}
|
||||
|
||||
// Remove the program crate in the `programs/<name>` directory.
|
||||
pub fn remove(cfg_override: &ConfigOverride, name: String) -> Result<()> {
|
||||
with_workspace(cfg_override, |cfg| {
|
||||
match cfg.path().parent() {
|
||||
None => {
|
||||
println!("Unable to make new program");
|
||||
}
|
||||
Some(parent) => {
|
||||
std::env::set_current_dir(parent)?;
|
||||
|
||||
let cluster = cfg.provider.cluster.clone();
|
||||
let programs = cfg.programs.entry(cluster).or_default();
|
||||
if programs.contains_key(&name) {
|
||||
// Delete all files within the program folder
|
||||
fs::remove_dir_all(
|
||||
std::env::current_dir()?
|
||||
.join("programs")
|
||||
.join(&name),
|
||||
)?;
|
||||
}
|
||||
|
||||
print!("There");
|
||||
|
||||
programs.remove(&name);
|
||||
|
||||
let toml = cfg.to_string();
|
||||
fs::write("Anchor.toml", toml)?;
|
||||
|
||||
println!("Removed program.");
|
||||
}
|
||||
};
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
/// Array of (path, content) tuple.
|
||||
pub type Files = Vec<(PathBuf, String)>;
|
||||
|
||||
|
|
|
@ -174,8 +174,10 @@ export class AnchorProvider implements Provider {
|
|||
? tx.signatures?.[0] || new Uint8Array()
|
||||
: tx.signature ?? new Uint8Array()
|
||||
);
|
||||
const maxVer = isVersionedTransaction(tx) ? 0 : undefined;
|
||||
const failedTx = await this.connection.getTransaction(txSig, {
|
||||
commitment: "confirmed",
|
||||
maxSupportedTransactionVersion: maxVer,
|
||||
});
|
||||
if (!failedTx) {
|
||||
throw err;
|
||||
|
@ -256,8 +258,10 @@ export class AnchorProvider implements Provider {
|
|||
? tx.signatures?.[0] || new Uint8Array()
|
||||
: tx.signature ?? new Uint8Array()
|
||||
);
|
||||
const maxVer = isVersionedTransaction(tx) ? 0 : undefined;
|
||||
const failedTx = await this.connection.getTransaction(txSig, {
|
||||
commitment: "confirmed",
|
||||
maxSupportedTransactionVersion: maxVer,
|
||||
});
|
||||
if (!failedTx) {
|
||||
throw err;
|
||||
|
|
Loading…
Reference in New Issue