Ver Fonte

ts: Use env variable for local wallet (#718)

Pierre há 4 anos atrás
pai
commit
bf5cf80c11
2 ficheiros alterados com 3 adições e 1 exclusões
  1. 1 0
      cli/src/lib.rs
  2. 2 1
      ts/src/provider.ts

+ 1 - 0
cli/src/lib.rs

@@ -1355,6 +1355,7 @@ fn test(
             std::process::Command::new(program)
                 .args(args)
                 .env("ANCHOR_PROVIDER_URL", cfg.provider.cluster.url())
+                .env("ANCHOR_WALLET", cfg.provider.wallet.to_string())
                 .stdout(Stdio::inherit())
                 .stderr(Stdio::inherit())
                 .output()

+ 2 - 1
ts/src/provider.ts

@@ -230,11 +230,12 @@ export class NodeWallet implements Wallet {
   constructor(readonly payer: Keypair) {}
 
   static local(): NodeWallet {
+    const process = require("process");
     const payer = Keypair.fromSecretKey(
       Buffer.from(
         JSON.parse(
           require("fs").readFileSync(
-            require("os").homedir() + "/.config/solana/id.json",
+            process.env.ANCHOR_WALLET,
             {
               encoding: "utf-8",
             }