MCPcopy Create free account
hub / github.com/Bonfida/dex-v4 / deployProgram

Function deployProgram

js/tests/utils/validator.ts:45–93  ·  view source on GitHub ↗
(
  payerKeyFile: string,
  compile: boolean,
  compileFlag?: string,
  testBpf?: boolean
)

Source from the content-addressed store, hash-verified

43// Deploys the agnostic order book program. Fees are paid with the fee payer
44// whose key is in the given key file.
45export function deployProgram(
46 payerKeyFile: string,
47 compile: boolean,
48 compileFlag?: string,
49 testBpf?: boolean
50): PublicKey {
51 const programDirectory = path.join(
52 path.dirname(__filename),
53 "../../../program"
54 );
55 const programSo = path.join(
56 programDirectory,
57 `target/deploy/${programName}.so`
58 );
59 const keyfile = path.join(
60 path.dirname(programSo),
61 `${programName}-keypair.json`
62 );
63 let compileCmd = "cargo build-bpf";
64 if (compileFlag) {
65 compileCmd += ` --features ${compileFlag}`;
66 }
67 if (compile) {
68 execSync(compileCmd, {
69 cwd: programDirectory,
70 });
71 }
72 if (testBpf) {
73 execSync("cargo test-bpf", {
74 cwd: programDirectory,
75 });
76 }
77
78 const bytes = readFileSync(keyfile, "utf-8");
79 const keypair = Keypair.fromSecretKey(Uint8Array.from(JSON.parse(bytes)));
80 execSync(
81 [
82 "solana program deploy",
83 programSo,
84 "--program-id",
85 keyfile,
86 `-u ${DEVNET_URL}`,
87 "-k",
88 payerKeyFile,
89 "--commitment finalized",
90 ].join(" ")
91 );
92 return keypair.publicKey;
93}
94
95// Funds the given account. Sleeps until the connection is ready.
96export async function airdropPayer(

Callers

nothing calls this directly

Calls 2

fromMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected