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

This commit is contained in:
Pierre 2021-09-13 03:07:42 +10:00 committed by GitHub
parent 2ff6ae09a2
commit bf5cf80c11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -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()

View File

@ -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",
}