@metamask-previews/solana-test-validator-up 0.0.0-preview-9b6bf0851

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,359 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cleanSolanaTestValidatorCache = exports.installSolanaTestValidator = exports.parseSolanaTestValidatorInstallCliOptions = exports.readSolanaTestValidatorInstallOptionsFromPackageJson = exports.getSolanaTestValidatorCacheDirectory = exports.SOLANA_TEST_VALIDATOR_DEFAULT_RELEASE = void 0;
4
+ /* eslint-disable import-x/no-nodejs-modules, no-restricted-globals */
5
+ const node_child_process_1 = require("node:child_process");
6
+ const node_crypto_1 = require("node:crypto");
7
+ const node_fs_1 = require("node:fs");
8
+ const promises_1 = require("node:fs/promises");
9
+ const node_http_1 = require("node:http");
10
+ const node_https_1 = require("node:https");
11
+ const node_os_1 = require("node:os");
12
+ const node_path_1 = require("node:path");
13
+ const promises_2 = require("node:stream/promises");
14
+ const SOLANA_TEST_VALIDATOR_CACHE_NAMESPACE = 'solana-test-validator-up';
15
+ const RELEASE_CACHE_NAMESPACE = 'release';
16
+ exports.SOLANA_TEST_VALIDATOR_DEFAULT_RELEASE = {
17
+ version: 'v3.1.14',
18
+ platforms: {
19
+ 'darwin-arm64': {
20
+ checksum: '54cfc2680bd6426fda04619ee01933f40a649c8056f3a61ba20dc54dd427ebed',
21
+ size: 77158067,
22
+ url: 'https://github.com/anza-xyz/agave/releases/download/v3.1.14/solana-release-aarch64-apple-darwin.tar.bz2',
23
+ },
24
+ 'darwin-x64': {
25
+ checksum: 'e3768ed01daa1e3cfc02af3e3eb396cec2d48a99ecf80cd5d7bdff510f808d1f',
26
+ size: 81239759,
27
+ url: 'https://github.com/anza-xyz/agave/releases/download/v3.1.14/solana-release-x86_64-apple-darwin.tar.bz2',
28
+ },
29
+ 'linux-x64': {
30
+ checksum: '06f97c065cc977cbec2f13ffc9bc9d3b92fef485431fcb370a269de69532ef51',
31
+ size: 215235690,
32
+ url: 'https://github.com/anza-xyz/agave/releases/download/v3.1.14/solana-release-x86_64-unknown-linux-gnu.tar.bz2',
33
+ },
34
+ },
35
+ };
36
+ function getSolanaTestValidatorCacheDirectory({ cwd = process.cwd(), homeDirectory = (0, node_os_1.homedir)(), } = {}) {
37
+ const yarnRcPath = (0, node_path_1.join)(cwd, '.yarnrc.yml');
38
+ try {
39
+ const yarnRc = (0, node_fs_1.readFileSync)(yarnRcPath, 'utf8');
40
+ if (/^\s*enableGlobalCache:\s*true\s*$/mu.test(yarnRc)) {
41
+ return (0, node_path_1.join)(homeDirectory, '.cache', 'metamask');
42
+ }
43
+ }
44
+ catch (error) {
45
+ if (!isFileMissingError(error)) {
46
+ console.warn(`Warning: Error reading ${yarnRcPath}, using local solana-test-validator-up cache:`, error);
47
+ }
48
+ }
49
+ return (0, node_path_1.join)(cwd, '.metamask', 'cache');
50
+ }
51
+ exports.getSolanaTestValidatorCacheDirectory = getSolanaTestValidatorCacheDirectory;
52
+ function readSolanaTestValidatorInstallOptionsFromPackageJson({ cwd = process.cwd(), packageJsonPath = (0, node_path_1.join)(cwd, 'package.json'), } = {}) {
53
+ const packageJson = JSON.parse((0, node_fs_1.readFileSync)(packageJsonPath, 'utf8'));
54
+ const config = packageJson.solanaTestValidatorUp ??
55
+ packageJson.solanatestvalidatorup ??
56
+ packageJson['solana-test-validator-up'];
57
+ const options = {};
58
+ if (config?.binDirectory) {
59
+ options.binDirectory = config.binDirectory;
60
+ }
61
+ if (config?.cacheDirectory) {
62
+ options.cacheDirectory = config.cacheDirectory;
63
+ }
64
+ if (config?.release) {
65
+ options.release = config.release;
66
+ }
67
+ return options;
68
+ }
69
+ exports.readSolanaTestValidatorInstallOptionsFromPackageJson = readSolanaTestValidatorInstallOptionsFromPackageJson;
70
+ function parseSolanaTestValidatorInstallCliOptions(args) {
71
+ const options = {};
72
+ const release = {};
73
+ for (let index = 0; index < args.length; index += 1) {
74
+ const arg = args[index];
75
+ const value = args[index + 1];
76
+ switch (arg) {
77
+ case '--bin-directory':
78
+ options.binDirectory = readCliValue(arg, value);
79
+ index += 1;
80
+ break;
81
+ case '--cache-directory':
82
+ options.cacheDirectory = readCliValue(arg, value);
83
+ index += 1;
84
+ break;
85
+ case '--platform':
86
+ options.platform = readCliValue(arg, value);
87
+ index += 1;
88
+ break;
89
+ case '--release-checksum':
90
+ release.checksum = readCliValue(arg, value);
91
+ index += 1;
92
+ break;
93
+ case '--release-url':
94
+ release.url = readCliValue(arg, value);
95
+ index += 1;
96
+ break;
97
+ default:
98
+ throw new Error(`Unknown solana-test-validator-up install option: ${arg}`);
99
+ }
100
+ }
101
+ if (release.url || release.checksum) {
102
+ options.release = {
103
+ platforms: {
104
+ current: requireCompletePlatformConfig(release, 'Solana release CLI options'),
105
+ },
106
+ };
107
+ }
108
+ return options;
109
+ }
110
+ exports.parseSolanaTestValidatorInstallCliOptions = parseSolanaTestValidatorInstallCliOptions;
111
+ async function installSolanaTestValidator(options = {}, dependencies = {}) {
112
+ const cwd = options.cwd ?? process.cwd();
113
+ const cacheDirectory = options.cacheDirectory ?? getSolanaTestValidatorCacheDirectory({ cwd });
114
+ const binDirectory = options.binDirectory ?? (0, node_path_1.join)(cwd, 'node_modules', '.bin');
115
+ const platformKey = options.platform ?? getPlatformKey();
116
+ const release = options.release ?? exports.SOLANA_TEST_VALIDATOR_DEFAULT_RELEASE;
117
+ const releaseConfig = resolvePlatformConfig(release, platformKey, 'Solana release');
118
+ const releaseResult = await installSolanaRelease({ cacheDirectory, config: releaseConfig }, dependencies);
119
+ const binaryPath = await installExecutableWrapper({
120
+ binDirectory,
121
+ commandName: 'solana-test-validator',
122
+ executablePath: releaseResult.validatorBinary,
123
+ });
124
+ await installExecutableWrapper({
125
+ binDirectory,
126
+ commandName: 'solana',
127
+ executablePath: releaseResult.solanaBinary,
128
+ });
129
+ return {
130
+ binaryPath,
131
+ cacheHit: releaseResult.cacheHit,
132
+ checksum: releaseConfig.checksum,
133
+ solanaBinary: releaseResult.solanaBinary,
134
+ validatorBinary: releaseResult.validatorBinary,
135
+ version: release.version,
136
+ };
137
+ }
138
+ exports.installSolanaTestValidator = installSolanaTestValidator;
139
+ async function cleanSolanaTestValidatorCache(options = {}) {
140
+ const cwd = options.cwd ?? process.cwd();
141
+ const cacheDirectory = options.cacheDirectory ?? getSolanaTestValidatorCacheDirectory({ cwd });
142
+ await (0, promises_1.rm)((0, node_path_1.join)(cacheDirectory, SOLANA_TEST_VALIDATOR_CACHE_NAMESPACE), {
143
+ force: true,
144
+ recursive: true,
145
+ });
146
+ }
147
+ exports.cleanSolanaTestValidatorCache = cleanSolanaTestValidatorCache;
148
+ async function installSolanaRelease({ cacheDirectory, config, }, dependencies) {
149
+ const cacheKey = getCacheKey(config);
150
+ const cacheRoot = (0, node_path_1.join)(cacheDirectory, SOLANA_TEST_VALIDATOR_CACHE_NAMESPACE, RELEASE_CACHE_NAMESPACE, cacheKey);
151
+ const checksumPath = (0, node_path_1.join)(cacheRoot, '.source-checksum');
152
+ const cached = findSolanaBinaries(cacheRoot);
153
+ if (cached &&
154
+ (0, node_fs_1.existsSync)(checksumPath) &&
155
+ (0, node_fs_1.readFileSync)(checksumPath, 'utf8') === config.checksum) {
156
+ return { cacheHit: true, ...cached };
157
+ }
158
+ const tempRoot = `${cacheRoot}.downloading`;
159
+ const archivePath = (0, node_path_1.join)(tempRoot, 'solana-release.tar.bz2');
160
+ const downloadFile = dependencies.downloadFile ?? downloadFileFromUrl;
161
+ const extractArchive = dependencies.extractArchive ?? extractTarBz2Archive;
162
+ await (0, promises_1.rm)(tempRoot, { force: true, recursive: true });
163
+ await (0, promises_1.rm)(cacheRoot, { force: true, recursive: true });
164
+ await (0, promises_1.mkdir)(tempRoot, { recursive: true });
165
+ try {
166
+ await downloadFile(config.url, archivePath);
167
+ await verifyFileChecksum(archivePath, config.checksum, 'Downloaded Solana release');
168
+ await extractArchive(archivePath, tempRoot);
169
+ const binaries = findSolanaBinaries(tempRoot);
170
+ if (!binaries) {
171
+ throw new Error('Solana release archive did not contain bin/solana-test-validator and bin/solana.');
172
+ }
173
+ await (0, promises_1.writeFile)(checksumPath.replace(cacheRoot, tempRoot), config.checksum);
174
+ await (0, promises_1.mkdir)((0, node_path_1.dirname)(cacheRoot), { recursive: true });
175
+ await (0, promises_1.rename)(tempRoot, cacheRoot);
176
+ return {
177
+ cacheHit: false,
178
+ solanaBinary: binaries.solanaBinary.replace(tempRoot, cacheRoot),
179
+ validatorBinary: binaries.validatorBinary.replace(tempRoot, cacheRoot),
180
+ };
181
+ }
182
+ catch (error) {
183
+ await (0, promises_1.rm)(tempRoot, { force: true, recursive: true });
184
+ await (0, promises_1.rm)(cacheRoot, { force: true, recursive: true });
185
+ throw error;
186
+ }
187
+ }
188
+ async function installExecutableWrapper({ binDirectory, commandName, executablePath, }) {
189
+ const binaryPath = (0, node_path_1.join)(binDirectory, commandName);
190
+ const relativeExecutablePath = (0, node_path_1.relative)(binDirectory, executablePath);
191
+ await (0, promises_1.mkdir)(binDirectory, { recursive: true });
192
+ await (0, promises_1.unlink)(binaryPath).catch((error) => {
193
+ if (!isFileMissingError(error)) {
194
+ throw error;
195
+ }
196
+ });
197
+ await (0, promises_1.writeFile)(binaryPath, `#!/usr/bin/env node
198
+ const { spawnSync } = require('node:child_process');
199
+ const path = require('node:path');
200
+
201
+ const executablePath = path.resolve(__dirname, ${JSON.stringify(relativeExecutablePath)});
202
+ const result = spawnSync(executablePath, process.argv.slice(2), {
203
+ stdio: 'inherit',
204
+ });
205
+
206
+ if (result.error) {
207
+ console.error(result.error.message);
208
+ process.exit(1);
209
+ }
210
+
211
+ if (result.signal) {
212
+ process.kill(process.pid, result.signal);
213
+ }
214
+
215
+ process.exit(result.status ?? 0);
216
+ `);
217
+ await (0, promises_1.chmod)(binaryPath, 0o755);
218
+ return binaryPath;
219
+ }
220
+ function findSolanaBinaries(root) {
221
+ const validatorBinary = findExecutable(root, 'solana-test-validator');
222
+ const solanaBinary = findExecutable(root, 'solana');
223
+ if (!validatorBinary || !solanaBinary) {
224
+ return undefined;
225
+ }
226
+ return { solanaBinary, validatorBinary };
227
+ }
228
+ function findExecutable(root, name) {
229
+ if (!(0, node_fs_1.existsSync)(root)) {
230
+ return undefined;
231
+ }
232
+ for (const entry of (0, node_fs_1.readdirSync)(root)) {
233
+ const entryPath = (0, node_path_1.join)(root, entry);
234
+ const stat = (0, node_fs_1.statSync)(entryPath);
235
+ if (stat.isDirectory()) {
236
+ const found = findExecutable(entryPath, name);
237
+ if (found) {
238
+ return found;
239
+ }
240
+ }
241
+ else if (entry === name) {
242
+ return entryPath;
243
+ }
244
+ }
245
+ return undefined;
246
+ }
247
+ function resolvePlatformConfig(config, platform, label) {
248
+ const platformConfig = config.platforms[platform] ?? config.platforms.current;
249
+ if (!platformConfig) {
250
+ throw new Error(`No ${label} is configured for ${platform}.`);
251
+ }
252
+ return platformConfig;
253
+ }
254
+ function requireCompletePlatformConfig(config, label) {
255
+ if (!config.url || !config.checksum) {
256
+ throw new Error(`${label} require both a URL and a checksum.`);
257
+ }
258
+ return {
259
+ checksum: config.checksum,
260
+ url: config.url,
261
+ };
262
+ }
263
+ function getCacheKey(config) {
264
+ return (0, node_crypto_1.createHash)('sha256')
265
+ .update(`${config.url}:${config.checksum}`)
266
+ .digest('hex');
267
+ }
268
+ async function verifyFileChecksum(filePath, expectedChecksum, label) {
269
+ const checksum = (0, node_crypto_1.createHash)('sha256')
270
+ .update(await (0, promises_1.readFile)(filePath))
271
+ .digest('hex');
272
+ if (checksum !== expectedChecksum) {
273
+ throw new Error(`${label} checksum mismatch. Expected ${expectedChecksum}, got ${checksum}.`);
274
+ }
275
+ }
276
+ async function downloadFileFromUrl(url, destination) {
277
+ await (0, promises_1.mkdir)((0, node_path_1.dirname)(destination), { recursive: true });
278
+ await (0, promises_2.pipeline)(await openDownloadStream(new URL(url)), (0, node_fs_1.createWriteStream)(destination));
279
+ }
280
+ async function openDownloadStream(url, redirectsRemaining = 5) {
281
+ const request = url.protocol === 'http:' ? node_http_1.request : node_https_1.request;
282
+ return await new Promise((resolvePromise, rejectPromise) => {
283
+ const req = request(url, (response) => {
284
+ const { headers, statusCode, statusMessage } = response;
285
+ if (statusCode &&
286
+ statusCode >= 300 &&
287
+ statusCode < 400 &&
288
+ headers.location) {
289
+ response.resume();
290
+ if (redirectsRemaining <= 0) {
291
+ rejectPromise(new Error(`Too many redirects downloading ${url}`));
292
+ return;
293
+ }
294
+ openDownloadStream(new URL(headers.location, url), redirectsRemaining - 1)
295
+ .then(resolvePromise)
296
+ .catch(rejectPromise);
297
+ return;
298
+ }
299
+ if (!statusCode || statusCode < 200 || statusCode >= 300) {
300
+ response.resume();
301
+ rejectPromise(new Error(`Request to ${url} failed with ${statusCode ?? 'unknown'} ${statusMessage ?? ''}`.trim()));
302
+ return;
303
+ }
304
+ resolvePromise(response);
305
+ });
306
+ req.on('error', rejectPromise);
307
+ req.end();
308
+ });
309
+ }
310
+ async function extractTarBz2Archive(archivePath, destination) {
311
+ await runCommand('tar', ['-xjf', archivePath, '-C', destination]);
312
+ }
313
+ async function runCommand(command, args) {
314
+ await new Promise((resolvePromise, rejectPromise) => {
315
+ const child = (0, node_child_process_1.spawn)(command, args, {
316
+ shell: false,
317
+ stdio: ['ignore', 'ignore', 'pipe'],
318
+ });
319
+ let stderr = '';
320
+ child.stderr.on('data', (chunk) => {
321
+ stderr += chunk.toString();
322
+ });
323
+ child.on('error', rejectPromise);
324
+ child.on('close', (code) => {
325
+ if (code === 0) {
326
+ resolvePromise();
327
+ return;
328
+ }
329
+ rejectPromise(new Error(`${command} ${args.join(' ')} failed with code ${code}: ${stderr}`));
330
+ });
331
+ });
332
+ }
333
+ function getPlatformKey() {
334
+ const platform = (0, node_os_1.platform)();
335
+ const arch = (0, node_os_1.arch)();
336
+ if (platform === 'darwin' && arch === 'arm64') {
337
+ return 'darwin-arm64';
338
+ }
339
+ if (platform === 'darwin' && arch === 'x64') {
340
+ return 'darwin-x64';
341
+ }
342
+ if (platform === 'linux' && arch === 'x64') {
343
+ return 'linux-x64';
344
+ }
345
+ return `${platform}-${arch}`;
346
+ }
347
+ function readCliValue(arg, value) {
348
+ if (!value || value.startsWith('--')) {
349
+ throw new Error(`${arg} requires a value.`);
350
+ }
351
+ return value;
352
+ }
353
+ function isFileMissingError(error) {
354
+ return (typeof error === 'object' &&
355
+ error !== null &&
356
+ Object.prototype.hasOwnProperty.call(error, 'code') &&
357
+ error.code === 'ENOENT');
358
+ }
359
+ //# sourceMappingURL=install.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.cjs","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACtE,2DAA2C;AAC3C,6CAAyC;AACzC,qCAMiB;AACjB,+CAQ0B;AAC1B,yCAAmD;AACnD,2CAAqD;AACrD,qCAA0E;AAC1E,yCAAoD;AACpD,mDAAgD;AAEhD,MAAM,qCAAqC,GAAG,0BAA0B,CAAC;AACzE,MAAM,uBAAuB,GAAG,SAAS,CAAC;AAiD7B,QAAA,qCAAqC,GAChD;IACE,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE;QACT,cAAc,EAAE;YACd,QAAQ,EACN,kEAAkE;YACpE,IAAI,EAAE,QAAU;YAChB,GAAG,EAAE,yGAAyG;SAC/G;QACD,YAAY,EAAE;YACZ,QAAQ,EACN,kEAAkE;YACpE,IAAI,EAAE,QAAU;YAChB,GAAG,EAAE,wGAAwG;SAC9G;QACD,WAAW,EAAE;YACX,QAAQ,EACN,kEAAkE;YACpE,IAAI,EAAE,SAAW;YACjB,GAAG,EAAE,6GAA6G;SACnH;KACF;CACF,CAAC;AAEJ,SAAgB,oCAAoC,CAAC,EACnD,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,EACnB,aAAa,GAAG,IAAA,iBAAO,GAAE,MAIvB,EAAE;IACJ,MAAM,UAAU,GAAG,IAAA,gBAAI,EAAC,GAAG,EAAE,aAAa,CAAC,CAAC;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AM,IAAI,GAAG,IAAA,cAAM,GAAE,CAAC;IAEtB,IAAI,QAAQ,KAAK,QAAQ,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QAC9C,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,IAAI,QAAQ,KAAK,QAAQ,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QAC5C,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,IAAI,QAAQ,KAAK,OAAO,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QAC3C,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,OAAO,GAAG,QAAQ,IAAI,IAAI,EAAE,CAAC;AAC/B,CAAC;AAED,SAAS,YAAY,CAAC,GAAW,EAAE,KAAyB;IAC1D,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,oBAAoB,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAc;IACxC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC;QAClD,KAA+B,CAAC,IAAI,KAAK,QAAQ,CACnD,CAAC;AACJ,CAAC","sourcesContent":["/* eslint-disable import-x/no-nodejs-modules, no-restricted-globals */\nimport { spawn } from 'node:child_process';\nimport { createHash } from 'node:crypto';\nimport {\n createWriteStream,\n existsSync,\n readdirSync,\n readFileSync,\n statSync,\n} from 'node:fs';\nimport {\n chmod,\n mkdir,\n readFile,\n rename,\n rm,\n unlink,\n writeFile,\n} from 'node:fs/promises';\nimport { request as requestHttp } from 'node:http';\nimport { request as requestHttps } from 'node:https';\nimport { arch as osArch, homedir, platform as osPlatform } from 'node:os';\nimport { dirname, join, relative } from 'node:path';\nimport { pipeline } from 'node:stream/promises';\n\nconst SOLANA_TEST_VALIDATOR_CACHE_NAMESPACE = 'solana-test-validator-up';\nconst RELEASE_CACHE_NAMESPACE = 'release';\n\nexport type SolanaTestValidatorArtifactConfig = {\n platforms: Record<\n string,\n SolanaTestValidatorArtifactPlatformConfig | undefined\n >;\n version?: string;\n};\n\nexport type SolanaTestValidatorArtifactPlatformConfig = {\n checksum: string;\n size?: number;\n url: string;\n};\n\nexport type SolanaTestValidatorInstallOptions = {\n binDirectory?: string;\n cacheDirectory?: string;\n cwd?: string;\n platform?: string;\n release?: SolanaTestValidatorArtifactConfig;\n};\n\nexport type SolanaTestValidatorInstallResult = {\n binaryPath: string;\n cacheHit: boolean;\n checksum: string;\n solanaBinary: string;\n validatorBinary: string;\n version?: string;\n};\n\nexport type SolanaTestValidatorInstallDependencies = {\n downloadFile?: (url: string, destination: string) => Promise<void>;\n extractArchive?: (archivePath: string, destination: string) => Promise<void>;\n};\n\ntype SolanaTestValidatorPackageJson = {\n 'solana-test-validator-up'?: SolanaTestValidatorPackageJsonConfig;\n solanaTestValidatorUp?: SolanaTestValidatorPackageJsonConfig;\n solanatestvalidatorup?: SolanaTestValidatorPackageJsonConfig;\n};\n\ntype SolanaTestValidatorPackageJsonConfig = Pick<\n SolanaTestValidatorInstallOptions,\n 'binDirectory' | 'cacheDirectory' | 'release'\n>;\n\nexport const SOLANA_TEST_VALIDATOR_DEFAULT_RELEASE: SolanaTestValidatorArtifactConfig =\n {\n version: 'v3.1.14',\n platforms: {\n 'darwin-arm64': {\n checksum:\n '54cfc2680bd6426fda04619ee01933f40a649c8056f3a61ba20dc54dd427ebed',\n size: 77_158_067,\n url: 'https://github.com/anza-xyz/agave/releases/download/v3.1.14/solana-release-aarch64-apple-darwin.tar.bz2',\n },\n 'darwin-x64': {\n checksum:\n 'e3768ed01daa1e3cfc02af3e3eb396cec2d48a99ecf80cd5d7bdff510f808d1f',\n size: 81_239_759,\n url: 'https://github.com/anza-xyz/agave/releases/download/v3.1.14/solana-release-x86_64-apple-darwin.tar.bz2',\n },\n 'linux-x64': {\n checksum:\n '06f97c065cc977cbec2f13ffc9bc9d3b92fef485431fcb370a269de69532ef51',\n size: 215_235_690,\n url: 'https://github.com/anza-xyz/agave/releases/download/v3.1.14/solana-release-x86_64-unknown-linux-gnu.tar.bz2',\n },\n },\n };\n\nexport function getSolanaTestValidatorCacheDirectory({\n cwd = process.cwd(),\n homeDirectory = homedir(),\n}: {\n cwd?: string;\n homeDirectory?: string;\n} = {}): string {\n const yarnRcPath = join(cwd, '.yarnrc.yml');\n\n try {\n const yarnRc = readFileSync(yarnRcPath, 'utf8');\n if (/^\\s*enableGlobalCache:\\s*true\\s*$/mu.test(yarnRc)) {\n return join(homeDirectory, '.cache', 'metamask');\n }\n } catch (error) {\n if (!isFileMissingError(error)) {\n console.warn(\n `Warning: Error reading ${yarnRcPath}, using local solana-test-validator-up cache:`,\n error,\n );\n }\n }\n\n return join(cwd, '.metamask', 'cache');\n}\n\nexport function readSolanaTestValidatorInstallOptionsFromPackageJson({\n cwd = process.cwd(),\n packageJsonPath = join(cwd, 'package.json'),\n}: {\n cwd?: string;\n packageJsonPath?: string;\n} = {}): SolanaTestValidatorInstallOptions {\n const packageJson = JSON.parse(\n readFileSync(packageJsonPath, 'utf8'),\n ) as SolanaTestValidatorPackageJson;\n const config =\n packageJson.solanaTestValidatorUp ??\n packageJson.solanatestvalidatorup ??\n packageJson['solana-test-validator-up'];\n const options: SolanaTestValidatorInstallOptions = {};\n\n if (config?.binDirectory) {\n options.binDirectory = config.binDirectory;\n }\n if (config?.cacheDirectory) {\n options.cacheDirectory = config.cacheDirectory;\n }\n if (config?.release) {\n options.release = config.release;\n }\n\n return options;\n}\n\nexport function parseSolanaTestValidatorInstallCliOptions(\n args: string[],\n): SolanaTestValidatorInstallOptions {\n const options: SolanaTestValidatorInstallOptions = {};\n const release: Partial<SolanaTestValidatorArtifactPlatformConfig> = {};\n\n for (let index = 0; index < args.length; index += 1) {\n const arg = args[index];\n const value = args[index + 1];\n\n switch (arg) {\n case '--bin-directory':\n options.binDirectory = readCliValue(arg, value);\n index += 1;\n break;\n case '--cache-directory':\n options.cacheDirectory = readCliValue(arg, value);\n index += 1;\n break;\n case '--platform':\n options.platform = readCliValue(arg, value);\n index += 1;\n break;\n case '--release-checksum':\n release.checksum = readCliValue(arg, value);\n index += 1;\n break;\n case '--release-url':\n release.url = readCliValue(arg, value);\n index += 1;\n break;\n default:\n throw new Error(\n `Unknown solana-test-validator-up install option: ${arg}`,\n );\n }\n }\n\n if (release.url || release.checksum) {\n options.release = {\n platforms: {\n current: requireCompletePlatformConfig(\n release,\n 'Solana release CLI options',\n ),\n },\n };\n }\n\n return options;\n}\n\nexport async function installSolanaTestValidator(\n options: SolanaTestValidatorInstallOptions = {},\n dependencies: SolanaTestValidatorInstallDependencies = {},\n): Promise<SolanaTestValidatorInstallResult> {\n const cwd = options.cwd ?? process.cwd();\n const cacheDirectory =\n options.cacheDirectory ?? getSolanaTestValidatorCacheDirectory({ cwd });\n const binDirectory =\n options.binDirectory ?? join(cwd, 'node_modules', '.bin');\n const platformKey = options.platform ?? getPlatformKey();\n const release = options.release ?? SOLANA_TEST_VALIDATOR_DEFAULT_RELEASE;\n const releaseConfig = resolvePlatformConfig(\n release,\n platformKey,\n 'Solana release',\n );\n const releaseResult = await installSolanaRelease(\n { cacheDirectory, config: releaseConfig },\n dependencies,\n );\n const binaryPath = await installExecutableWrapper({\n binDirectory,\n commandName: 'solana-test-validator',\n executablePath: releaseResult.validatorBinary,\n });\n await installExecutableWrapper({\n binDirectory,\n commandName: 'solana',\n executablePath: releaseResult.solanaBinary,\n });\n\n return {\n binaryPath,\n cacheHit: releaseResult.cacheHit,\n checksum: releaseConfig.checksum,\n solanaBinary: releaseResult.solanaBinary,\n validatorBinary: releaseResult.validatorBinary,\n version: release.version,\n };\n}\n\nexport async function cleanSolanaTestValidatorCache(\n options: Pick<\n SolanaTestValidatorInstallOptions,\n 'cacheDirectory' | 'cwd'\n > = {},\n): Promise<void> {\n const cwd = options.cwd ?? process.cwd();\n const cacheDirectory =\n options.cacheDirectory ?? getSolanaTestValidatorCacheDirectory({ cwd });\n\n await rm(join(cacheDirectory, SOLANA_TEST_VALIDATOR_CACHE_NAMESPACE), {\n force: true,\n recursive: true,\n });\n}\n\nasync function installSolanaRelease(\n {\n cacheDirectory,\n config,\n }: {\n cacheDirectory: string;\n config: SolanaTestValidatorArtifactPlatformConfig;\n },\n dependencies: SolanaTestValidatorInstallDependencies,\n): Promise<{\n cacheHit: boolean;\n solanaBinary: string;\n validatorBinary: string;\n}> {\n const cacheKey = getCacheKey(config);\n const cacheRoot = join(\n cacheDirectory,\n SOLANA_TEST_VALIDATOR_CACHE_NAMESPACE,\n RELEASE_CACHE_NAMESPACE,\n cacheKey,\n );\n const checksumPath = join(cacheRoot, '.source-checksum');\n const cached = findSolanaBinaries(cacheRoot);\n\n if (\n cached &&\n existsSync(checksumPath) &&\n readFileSync(checksumPath, 'utf8') === config.checksum\n ) {\n return { cacheHit: true, ...cached };\n }\n\n const tempRoot = `${cacheRoot}.downloading`;\n const archivePath = join(tempRoot, 'solana-release.tar.bz2');\n const downloadFile = dependencies.downloadFile ?? downloadFileFromUrl;\n const extractArchive = dependencies.extractArchive ?? extractTarBz2Archive;\n\n await rm(tempRoot, { force: true, recursive: true });\n await rm(cacheRoot, { force: true, recursive: true });\n await mkdir(tempRoot, { recursive: true });\n\n try {\n await downloadFile(config.url, archivePath);\n await verifyFileChecksum(\n archivePath,\n config.checksum,\n 'Downloaded Solana release',\n );\n await extractArchive(archivePath, tempRoot);\n\n const binaries = findSolanaBinaries(tempRoot);\n if (!binaries) {\n throw new Error(\n 'Solana release archive did not contain bin/solana-test-validator and bin/solana.',\n );\n }\n\n await writeFile(checksumPath.replace(cacheRoot, tempRoot), config.checksum);\n await mkdir(dirname(cacheRoot), { recursive: true });\n await rename(tempRoot, cacheRoot);\n\n return {\n cacheHit: false,\n solanaBinary: binaries.solanaBinary.replace(tempRoot, cacheRoot),\n validatorBinary: binaries.validatorBinary.replace(tempRoot, cacheRoot),\n };\n } catch (error) {\n await rm(tempRoot, { force: true, recursive: true });\n await rm(cacheRoot, { force: true, recursive: true });\n throw error;\n }\n}\n\nasync function installExecutableWrapper({\n binDirectory,\n commandName,\n executablePath,\n}: {\n binDirectory: string;\n commandName: string;\n executablePath: string;\n}): Promise<string> {\n const binaryPath = join(binDirectory, commandName);\n const relativeExecutablePath = relative(binDirectory, executablePath);\n\n await mkdir(binDirectory, { recursive: true });\n await unlink(binaryPath).catch((error) => {\n if (!isFileMissingError(error)) {\n throw error;\n }\n });\n await writeFile(\n binaryPath,\n `#!/usr/bin/env node\nconst { spawnSync } = require('node:child_process');\nconst path = require('node:path');\n\nconst executablePath = path.resolve(__dirname, ${JSON.stringify(relativeExecutablePath)});\nconst result = spawnSync(executablePath, process.argv.slice(2), {\n stdio: 'inherit',\n});\n\nif (result.error) {\n console.error(result.error.message);\n process.exit(1);\n}\n\nif (result.signal) {\n process.kill(process.pid, result.signal);\n}\n\nprocess.exit(result.status ?? 0);\n`,\n );\n await chmod(binaryPath, 0o755);\n\n return binaryPath;\n}\n\nfunction findSolanaBinaries(\n root: string,\n): { solanaBinary: string; validatorBinary: string } | undefined {\n const validatorBinary = findExecutable(root, 'solana-test-validator');\n const solanaBinary = findExecutable(root, 'solana');\n\n if (!validatorBinary || !solanaBinary) {\n return undefined;\n }\n\n return { solanaBinary, validatorBinary };\n}\n\nfunction findExecutable(root: string, name: string): string | undefined {\n if (!existsSync(root)) {\n return undefined;\n }\n\n for (const entry of readdirSync(root)) {\n const entryPath = join(root, entry);\n const stat = statSync(entryPath);\n if (stat.isDirectory()) {\n const found = findExecutable(entryPath, name);\n if (found) {\n return found;\n }\n } else if (entry === name) {\n return entryPath;\n }\n }\n\n return undefined;\n}\n\nfunction resolvePlatformConfig(\n config: SolanaTestValidatorArtifactConfig,\n platform: string,\n label: string,\n): SolanaTestValidatorArtifactPlatformConfig {\n const platformConfig = config.platforms[platform] ?? config.platforms.current;\n\n if (!platformConfig) {\n throw new Error(`No ${label} is configured for ${platform}.`);\n }\n\n return platformConfig;\n}\n\nfunction requireCompletePlatformConfig(\n config: Partial<SolanaTestValidatorArtifactPlatformConfig>,\n label: string,\n): SolanaTestValidatorArtifactPlatformConfig {\n if (!config.url || !config.checksum) {\n throw new Error(`${label} require both a URL and a checksum.`);\n }\n\n return {\n checksum: config.checksum,\n url: config.url,\n };\n}\n\nfunction getCacheKey(\n config: SolanaTestValidatorArtifactPlatformConfig,\n): string {\n return createHash('sha256')\n .update(`${config.url}:${config.checksum}`)\n .digest('hex');\n}\n\nasync function verifyFileChecksum(\n filePath: string,\n expectedChecksum: string,\n label: string,\n): Promise<void> {\n const checksum = createHash('sha256')\n .update(await readFile(filePath))\n .digest('hex');\n\n if (checksum !== expectedChecksum) {\n throw new Error(\n `${label} checksum mismatch. Expected ${expectedChecksum}, got ${checksum}.`,\n );\n }\n}\n\nasync function downloadFileFromUrl(\n url: string,\n destination: string,\n): Promise<void> {\n await mkdir(dirname(destination), { recursive: true });\n await pipeline(\n await openDownloadStream(new URL(url)),\n createWriteStream(destination),\n );\n}\n\nasync function openDownloadStream(\n url: URL,\n redirectsRemaining = 5,\n): Promise<NodeJS.ReadableStream> {\n const request = url.protocol === 'http:' ? requestHttp : requestHttps;\n\n return await new Promise((resolvePromise, rejectPromise) => {\n const req = request(url, (response) => {\n const { headers, statusCode, statusMessage } = response;\n\n if (\n statusCode &&\n statusCode >= 300 &&\n statusCode < 400 &&\n headers.location\n ) {\n response.resume();\n if (redirectsRemaining <= 0) {\n rejectPromise(new Error(`Too many redirects downloading ${url}`));\n return;\n }\n\n openDownloadStream(\n new URL(headers.location, url),\n redirectsRemaining - 1,\n )\n .then(resolvePromise)\n .catch(rejectPromise);\n return;\n }\n\n if (!statusCode || statusCode < 200 || statusCode >= 300) {\n response.resume();\n rejectPromise(\n new Error(\n `Request to ${url} failed with ${statusCode ?? 'unknown'} ${\n statusMessage ?? ''\n }`.trim(),\n ),\n );\n return;\n }\n\n resolvePromise(response);\n });\n\n req.on('error', rejectPromise);\n req.end();\n });\n}\n\nasync function extractTarBz2Archive(\n archivePath: string,\n destination: string,\n): Promise<void> {\n await runCommand('tar', ['-xjf', archivePath, '-C', destination]);\n}\n\nasync function runCommand(command: string, args: string[]): Promise<void> {\n await new Promise<void>((resolvePromise, rejectPromise) => {\n const child = spawn(command, args, {\n shell: false,\n stdio: ['ignore', 'ignore', 'pipe'],\n });\n let stderr = '';\n\n child.stderr.on('data', (chunk) => {\n stderr += chunk.toString();\n });\n child.on('error', rejectPromise);\n child.on('close', (code) => {\n if (code === 0) {\n resolvePromise();\n return;\n }\n rejectPromise(\n new Error(\n `${command} ${args.join(' ')} failed with code ${code}: ${stderr}`,\n ),\n );\n });\n });\n}\n\nfunction getPlatformKey(): string {\n const platform = osPlatform();\n const arch = osArch();\n\n if (platform === 'darwin' && arch === 'arm64') {\n return 'darwin-arm64';\n }\n if (platform === 'darwin' && arch === 'x64') {\n return 'darwin-x64';\n }\n if (platform === 'linux' && arch === 'x64') {\n return 'linux-x64';\n }\n\n return `${platform}-${arch}`;\n}\n\nfunction readCliValue(arg: string, value: string | undefined): string {\n if (!value || value.startsWith('--')) {\n throw new Error(`${arg} requires a value.`);\n }\n\n return value;\n}\n\nfunction isFileMissingError(error: unknown): boolean {\n return (\n typeof error === 'object' &&\n error !== null &&\n Object.prototype.hasOwnProperty.call(error, 'code') &&\n (error as NodeJS.ErrnoException).code === 'ENOENT'\n );\n}\n"]}
@@ -0,0 +1,41 @@
1
+ export type SolanaTestValidatorArtifactConfig = {
2
+ platforms: Record<string, SolanaTestValidatorArtifactPlatformConfig | undefined>;
3
+ version?: string;
4
+ };
5
+ export type SolanaTestValidatorArtifactPlatformConfig = {
6
+ checksum: string;
7
+ size?: number;
8
+ url: string;
9
+ };
10
+ export type SolanaTestValidatorInstallOptions = {
11
+ binDirectory?: string;
12
+ cacheDirectory?: string;
13
+ cwd?: string;
14
+ platform?: string;
15
+ release?: SolanaTestValidatorArtifactConfig;
16
+ };
17
+ export type SolanaTestValidatorInstallResult = {
18
+ binaryPath: string;
19
+ cacheHit: boolean;
20
+ checksum: string;
21
+ solanaBinary: string;
22
+ validatorBinary: string;
23
+ version?: string;
24
+ };
25
+ export type SolanaTestValidatorInstallDependencies = {
26
+ downloadFile?: (url: string, destination: string) => Promise<void>;
27
+ extractArchive?: (archivePath: string, destination: string) => Promise<void>;
28
+ };
29
+ export declare const SOLANA_TEST_VALIDATOR_DEFAULT_RELEASE: SolanaTestValidatorArtifactConfig;
30
+ export declare function getSolanaTestValidatorCacheDirectory({ cwd, homeDirectory, }?: {
31
+ cwd?: string;
32
+ homeDirectory?: string;
33
+ }): string;
34
+ export declare function readSolanaTestValidatorInstallOptionsFromPackageJson({ cwd, packageJsonPath, }?: {
35
+ cwd?: string;
36
+ packageJsonPath?: string;
37
+ }): SolanaTestValidatorInstallOptions;
38
+ export declare function parseSolanaTestValidatorInstallCliOptions(args: string[]): SolanaTestValidatorInstallOptions;
39
+ export declare function installSolanaTestValidator(options?: SolanaTestValidatorInstallOptions, dependencies?: SolanaTestValidatorInstallDependencies): Promise<SolanaTestValidatorInstallResult>;
40
+ export declare function cleanSolanaTestValidatorCache(options?: Pick<SolanaTestValidatorInstallOptions, 'cacheDirectory' | 'cwd'>): Promise<void>;
41
+ //# sourceMappingURL=install.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.d.cts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AA4BA,MAAM,MAAM,iCAAiC,GAAG;IAC9C,SAAS,EAAE,MAAM,CACf,MAAM,EACN,yCAAyC,GAAG,SAAS,CACtD,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,yCAAyC,GAAG;IACtD,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM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GAAE,iCAAsC,EAC/C,YAAY,GAAE,sCAA2C,GACxD,OAAO,CAAC,gCAAgC,CAAC,CAoC3C;AAED,wBAAsB,6BAA6B,CACjD,OAAO,GAAE,IAAI,CACX,iCAAiC,EACjC,gBAAgB,GAAG,KAAK,CACpB,GACL,OAAO,CAAC,IAAI,CAAC,CASf"}
@@ -0,0 +1,41 @@
1
+ export type SolanaTestValidatorArtifactConfig = {
2
+ platforms: Record<string, SolanaTestValidatorArtifactPlatformConfig | undefined>;
3
+ version?: string;
4
+ };
5
+ export type SolanaTestValidatorArtifactPlatformConfig = {
6
+ checksum: string;
7
+ size?: number;
8
+ url: string;
9
+ };
10
+ export type SolanaTestValidatorInstallOptions = {
11
+ binDirectory?: string;
12
+ cacheDirectory?: string;
13
+ cwd?: string;
14
+ platform?: string;
15
+ release?: SolanaTestValidatorArtifactConfig;
16
+ };
17
+ export type SolanaTestValidatorInstallResult = {
18
+ binaryPath: string;
19
+ cacheHit: boolean;
20
+ checksum: string;
21
+ solanaBinary: string;
22
+ validatorBinary: string;
23
+ version?: string;
24
+ };
25
+ export type SolanaTestValidatorInstallDependencies = {
26
+ downloadFile?: (url: string, destination: string) => Promise<void>;
27
+ extractArchive?: (archivePath: string, destination: string) => Promise<void>;
28
+ };
29
+ export declare const SOLANA_TEST_VALIDATOR_DEFAULT_RELEASE: SolanaTestValidatorArtifactConfig;
30
+ export declare function getSolanaTestValidatorCacheDirectory({ cwd, homeDirectory, }?: {
31
+ cwd?: string;
32
+ homeDirectory?: string;
33
+ }): string;
34
+ export declare function readSolanaTestValidatorInstallOptionsFromPackageJson({ cwd, packageJsonPath, }?: {
35
+ cwd?: string;
36
+ packageJsonPath?: string;
37
+ }): SolanaTestValidatorInstallOptions;
38
+ export declare function parseSolanaTestValidatorInstallCliOptions(args: string[]): SolanaTestValidatorInstallOptions;
39
+ export declare function installSolanaTestValidator(options?: SolanaTestValidatorInstallOptions, dependencies?: SolanaTestValidatorInstallDependencies): Promise<SolanaTestValidatorInstallResult>;
40
+ export declare function cleanSolanaTestValidatorCache(options?: Pick<SolanaTestValidatorInstallOptions, 'cacheDirectory' | 'cwd'>): Promise<void>;
41
+ //# sourceMappingURL=install.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.d.mts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AA4BA,MAAM,MAAM,iCAAiC,GAAG;IAC9C,SAAS,EAAE,MAAM,CACf,MAAM,EACN,yCAAyC,GAAG,SAAS,CACtD,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,yCAAyC,GAAG;IACtD,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,iCAAiC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG;IACnD,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9E,CAAC;A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