Browse Source

Use environment derived provider in test template

Armani Ferrante 4 years ago
parent
commit
cef682a232
3 changed files with 10 additions and 8 deletions
  1. 3 3
      Cargo.lock
  2. 6 4
      cli/src/main.rs
  3. 1 1
      cli/src/template.rs

+ 3 - 3
Cargo.lock

@@ -2909,9 +2909,9 @@ dependencies = [
 
 [[package]]
 name = "solana-program"
-version = "1.5.5"
+version = "1.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb200f05cb93b01f6e9b2e0d94d240e7e5dfa0b14c4308713b236c01a525a0ef"
+checksum = "7a7df63d84d4ba7f67365d179b9994f2690554f313e219f29810b4583077e066"
 dependencies = [
  "bincode",
  "bs58",
@@ -2929,7 +2929,7 @@ dependencies = [
  "serde",
  "serde_bytes",
  "serde_derive",
- "sha2 0.9.2",
+ "sha2 0.8.2",
  "solana-frozen-abi",
  "solana-frozen-abi-macro",
  "solana-logger",

+ 6 - 4
cli/src/main.rs

@@ -1,6 +1,6 @@
 use crate::config::{find_cargo_toml, read_all_programs, Config, Program};
 use anchor_syn::idl::Idl;
-use anyhow::{anyhow, Result};
+use anyhow::Result;
 use clap::Clap;
 use serde::{Deserialize, Serialize};
 use solana_client::rpc_client::RpcClient;
@@ -394,12 +394,12 @@ fn deploy(url: Option<String>, keypair: Option<String>) -> Result<()> {
         println!("Deployed {} at {}", idl.name, address.to_string());
     }
 
-    run_hosted_deploy(&url, &keypair)?;
+    run_hosted_deploy(&url)?;
 
     Ok(())
 }
 
-fn run_hosted_deploy(url: &str, keypair: &str) -> Result<()> {
+fn run_hosted_deploy(url: &str) -> Result<()> {
     println!("Running deploy script");
 
     let cur_dir = std::env::current_dir()?;
@@ -408,7 +408,7 @@ fn run_hosted_deploy(url: &str, keypair: &str) -> Result<()> {
     std::env::set_current_dir(".anchor")?;
 
     std::fs::write("deploy.js", deploy_script_host_str)?;
-    if let Err(e) = std::process::Command::new("node")
+    if let Err(_e) = std::process::Command::new("node")
         .arg("deploy.js")
         .stdout(Stdio::inherit())
         .stderr(Stdio::inherit())
@@ -416,6 +416,8 @@ fn run_hosted_deploy(url: &str, keypair: &str) -> Result<()> {
     {
         std::process::exit(1);
     }
+
+    println!("Deploy complete.");
     Ok(())
 }
 

+ 1 - 1
cli/src/template.rs

@@ -112,7 +112,7 @@ pub fn mocha(name: &str) -> String {
 describe('{}', () => {{
 
   // Configure the client to use the local cluster.
-  anchor.setProvider(anchor.Provider.local());
+  anchor.setProvider(anchor.Provider.env());
 
   it('Is initialized!', async () => {{
     // Add your test here.