ts: Use env variable for local wallet (#718)
This commit is contained in:
parent
2ff6ae09a2
commit
bf5cf80c11
|
@ -1355,6 +1355,7 @@ fn test(
|
||||||
std::process::Command::new(program)
|
std::process::Command::new(program)
|
||||||
.args(args)
|
.args(args)
|
||||||
.env("ANCHOR_PROVIDER_URL", cfg.provider.cluster.url())
|
.env("ANCHOR_PROVIDER_URL", cfg.provider.cluster.url())
|
||||||
|
.env("ANCHOR_WALLET", cfg.provider.wallet.to_string())
|
||||||
.stdout(Stdio::inherit())
|
.stdout(Stdio::inherit())
|
||||||
.stderr(Stdio::inherit())
|
.stderr(Stdio::inherit())
|
||||||
.output()
|
.output()
|
||||||
|
|
|
@ -230,11 +230,12 @@ export class NodeWallet implements Wallet {
|
||||||
constructor(readonly payer: Keypair) {}
|
constructor(readonly payer: Keypair) {}
|
||||||
|
|
||||||
static local(): NodeWallet {
|
static local(): NodeWallet {
|
||||||
|
const process = require("process");
|
||||||
const payer = Keypair.fromSecretKey(
|
const payer = Keypair.fromSecretKey(
|
||||||
Buffer.from(
|
Buffer.from(
|
||||||
JSON.parse(
|
JSON.parse(
|
||||||
require("fs").readFileSync(
|
require("fs").readFileSync(
|
||||||
require("os").homedir() + "/.config/solana/id.json",
|
process.env.ANCHOR_WALLET,
|
||||||
{
|
{
|
||||||
encoding: "utf-8",
|
encoding: "utf-8",
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue