@paimaexample/npm-midnight-proof-server 0.3.126 → 0.3.128

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.
Files changed (2) hide show
  1. package/binary.js +16 -4
  2. package/package.json +1 -1
package/binary.js CHANGED
@@ -4,7 +4,7 @@ const axios = require("axios");
4
4
  const extract = require("extract-zip");
5
5
  const path = require("path");
6
6
 
7
- const CURRENT_BINARY_VERSION = "ledger-4.0.0";
7
+ const CURRENT_BINARY_VERSION = "ledger-6.1.0-alpha.6";
8
8
  const FINAL_BINARY_NAME = "midnight-proof-server";
9
9
 
10
10
  /**
@@ -62,19 +62,31 @@ async function unzipBinary() {
62
62
  fs.mkdirSync(destDir, { recursive: true });
63
63
  }
64
64
  await extract(zipPath, { dir: destDir });
65
+
65
66
  const platform = getPlatform();
66
67
  const extractedBinaryPath = path.join(
67
68
  destDir,
68
- `midnight-proof-server-${platform}`,
69
+ `midnight-proof-server-${platform}-${CURRENT_BINARY_VERSION}`,
69
70
  );
70
71
  const finalBinaryPath = path.join(destDir, FINAL_BINARY_NAME);
71
72
 
72
- if (fs.existsSync(extractedBinaryPath) &&
73
- extractedBinaryPath !== finalBinaryPath) {
73
+ // Rename the extracted file to midnight-proof-server
74
+ if (fs.existsSync(extractedBinaryPath)) {
74
75
  if (fs.existsSync(finalBinaryPath)) {
75
76
  fs.unlinkSync(finalBinaryPath);
76
77
  }
77
78
  fs.renameSync(extractedBinaryPath, finalBinaryPath);
79
+ } else {
80
+ throw new Error(`Extracted binary not found at: ${extractedBinaryPath}`);
81
+ }
82
+
83
+ // Clean up any other extracted files (e.g., readme.md)
84
+ const files = fs.readdirSync(destDir);
85
+ for (const file of files) {
86
+ const filePath = path.join(destDir, file);
87
+ if (filePath !== finalBinaryPath && fs.statSync(filePath).isFile()) {
88
+ fs.unlinkSync(filePath);
89
+ }
78
90
  }
79
91
 
80
92
  if (!fs.existsSync(finalBinaryPath)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paimaexample/npm-midnight-proof-server",
3
- "version": "0.3.126",
3
+ "version": "0.3.128",
4
4
  "description": "A wrapper for the Midnight proof server binary",
5
5
  "main": "index.js",
6
6
  "bin": {