-
Notifications
You must be signed in to change notification settings - Fork 514
Expand file tree
/
Copy pathprepare.mjs
More file actions
34 lines (29 loc) · 876 Bytes
/
prepare.mjs
File metadata and controls
34 lines (29 loc) · 876 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env zx
import { mkdir, rm } from "node:fs/promises";
import { join } from "node:path";
import { $ } from "zx";
const programs = [
{
id: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s",
name: "token_metadata.so",
},
];
const outputDir = "tests/fixtures";
const overwrite = true;
try {
for (const program of programs) {
const { id, name } = program;
const outputFile = join(outputDir, name);
await $`solana config set -um`;
try {
await mkdir(outputDir, { recursive: true });
if (overwrite) await rm(outputFile, { force: true });
await $`solana program dump ${id} ${outputFile}`;
console.log(`Program ${id} dumped to ${outputFile}`);
} catch (error) {
console.error(`Error dumping ${id}: ${error.message}`);
}
}
} catch (error) {
console.error(`Error preparing programs: ${error.message}`);
}