@stacks/rendezvous 0.4.1 → 0.5.0

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.
package/dist/app.js CHANGED
@@ -9,11 +9,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  step((generator = generator.apply(thisArg, _arguments || [])).next());
10
10
  });
11
11
  };
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
12
15
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.getManifestFileName = void 0;
16
+ exports.tryParseRemoteDataSettings = exports.getManifestFileName = exports.invalidRemoteDataErrorMessage = exports.noRemoteData = void 0;
14
17
  exports.main = main;
15
18
  const path_1 = require("path");
16
19
  const events_1 = require("events");
20
+ const toml_1 = __importDefault(require("toml"));
17
21
  const property_1 = require("./property");
18
22
  const invariant_1 = require("./invariant");
19
23
  const shared_1 = require("./shared");
@@ -25,6 +29,16 @@ const dialer_1 = require("./dialer");
25
29
  const logger = (log, logLevel = "log") => {
26
30
  console[logLevel](log);
27
31
  };
32
+ /**
33
+ * The object used to initialize an empty simnet session with, when no remote
34
+ * data is enabled in the `Clarinet.toml` file.
35
+ */
36
+ exports.noRemoteData = {
37
+ enabled: false,
38
+ api_url: "",
39
+ initial_height: 1,
40
+ };
41
+ exports.invalidRemoteDataErrorMessage = `Remote data settings not properly setup in Clarinet.toml! To use remote data, please provide the "api_url", "initial_height", and "enabled" fields under the "repl.remote_data" section in the Clarinet.toml file.`;
28
42
  /**
29
43
  * Gets the manifest file name for a Clarinet project.
30
44
  * If a custom manifest exists (`Clarinet-<contract-name>.toml`), it is used.
@@ -41,6 +55,22 @@ const getManifestFileName = (manifestDir, targetContractName) => {
41
55
  return "Clarinet.toml";
42
56
  };
43
57
  exports.getManifestFileName = getManifestFileName;
58
+ const tryParseRemoteDataSettings = (manifestPath, radio) => {
59
+ var _a, _b;
60
+ const clarinetToml = toml_1.default.parse((0, fs_1.readFileSync)((0, path_1.resolve)(manifestPath), "utf-8"));
61
+ const remoteDataUserSettings = (_b = (_a = clarinetToml.repl) === null || _a === void 0 ? void 0 : _a["remote_data"]) !== null && _b !== void 0 ? _b : undefined;
62
+ if (remoteDataUserSettings !== undefined &&
63
+ (!(remoteDataUserSettings === null || remoteDataUserSettings === void 0 ? void 0 : remoteDataUserSettings["api_url"]) ||
64
+ !(remoteDataUserSettings === null || remoteDataUserSettings === void 0 ? void 0 : remoteDataUserSettings["enabled"]) ||
65
+ !(remoteDataUserSettings === null || remoteDataUserSettings === void 0 ? void 0 : remoteDataUserSettings["initial_height"]))) {
66
+ throw new Error(exports.invalidRemoteDataErrorMessage);
67
+ }
68
+ if (remoteDataUserSettings) {
69
+ radio.emit("logMessage", (0, ansicolor_1.yellow)("\nUsing remote data. Setting up the environment can take up to a minute..."));
70
+ }
71
+ return remoteDataUserSettings || exports.noRemoteData;
72
+ };
73
+ exports.tryParseRemoteDataSettings = tryParseRemoteDataSettings;
44
74
  const helpMessage = `
45
75
  rv v${package_json_1.version}
46
76
 
@@ -130,7 +160,8 @@ function main() {
130
160
  if (dialerRegistry !== undefined) {
131
161
  dialerRegistry.registerDialers();
132
162
  }
133
- const simnet = yield (0, citizen_1.issueFirstClassCitizenship)(manifestDir, manifestPath, sutContractName);
163
+ const remoteDataSettings = (0, exports.tryParseRemoteDataSettings)(manifestPath, radio);
164
+ const simnet = yield (0, citizen_1.issueFirstClassCitizenship)(manifestDir, manifestPath, remoteDataSettings, sutContractName);
134
165
  /**
135
166
  * The list of contract IDs for the SUT contract names, as per the simnet.
136
167
  */
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/citizen.js CHANGED
@@ -29,11 +29,12 @@ const transactions_1 = require("@stacks/transactions");
29
29
  *
30
30
  * @param manifestDir The relative path to the manifest directory.
31
31
  * @param manifestPath The absolute path to the manifest file.
32
+ * @param remoteDataSettings The remote data settings.
32
33
  * @param sutContractName The target contract name.
33
34
  * @returns The initialized simnet instance with all contracts deployed, with
34
35
  * the test contract treated as a first-class citizen of the target contract.
35
36
  */
36
- const issueFirstClassCitizenship = (manifestDir, manifestPath, sutContractName) => __awaiter(void 0, void 0, void 0, function* () {
37
+ const issueFirstClassCitizenship = (manifestDir, manifestPath, remoteDataSettings, sutContractName) => __awaiter(void 0, void 0, void 0, function* () {
37
38
  // Initialize the simnet, to generate the simnet plan and instance. The empty
38
39
  // session will be set up, and contracts will be deployed in the correct
39
40
  // order based on the simnet plan a few lines below.
@@ -47,7 +48,7 @@ const issueFirstClassCitizenship = (manifestDir, manifestPath, sutContractName)
47
48
  const balanceHex = simnet.runSnippet(`(stx-get-balance '${address})`);
48
49
  return [address, (0, transactions_1.cvToValue)((0, transactions_1.hexToCV)(balanceHex))];
49
50
  }));
50
- yield simnet.initEmptySession();
51
+ yield simnet.initEmptySession(remoteDataSettings);
51
52
  simnetAddresses.forEach((address) => {
52
53
  simnet.mintSTX(address, balancesMap.get(address));
53
54
  });
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stacks/rendezvous",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Meet your contract's vulnerabilities head-on.",
5
5
  "main": "app.js",
6
6
  "bin": {
@@ -30,14 +30,15 @@
30
30
  "url": "https://github.com/stacks-network/rendezvous.git"
31
31
  },
32
32
  "dependencies": {
33
- "@hirosystems/clarinet-sdk": "2.12.0",
33
+ "@hirosystems/clarinet-sdk": "2.14.0",
34
34
  "@stacks/transactions": "^6.16.1",
35
35
  "ansicolor": "^2.0.3",
36
36
  "fast-check": "^3.20.0",
37
+ "toml": "^3.0.0",
37
38
  "yaml": "^2.6.1"
38
39
  },
39
40
  "devDependencies": {
40
- "@hirosystems/clarinet-sdk-wasm": "2.12.0",
41
+ "@hirosystems/clarinet-sdk-wasm": "2.14.0",
41
42
  "@types/jest": "^29.5.12",
42
43
  "jest": "^29.7.0",
43
44
  "ts-jest": "^29.2.5",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stacks/rendezvous",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Meet your contract's vulnerabilities head-on.",
5
5
  "main": "app.js",
6
6
  "bin": {
@@ -30,14 +30,15 @@
30
30
  "url": "https://github.com/stacks-network/rendezvous.git"
31
31
  },
32
32
  "dependencies": {
33
- "@hirosystems/clarinet-sdk": "2.12.0",
33
+ "@hirosystems/clarinet-sdk": "2.14.0",
34
34
  "@stacks/transactions": "^6.16.1",
35
35
  "ansicolor": "^2.0.3",
36
36
  "fast-check": "^3.20.0",
37
+ "toml": "^3.0.0",
37
38
  "yaml": "^2.6.1"
38
39
  },
39
40
  "devDependencies": {
40
- "@hirosystems/clarinet-sdk-wasm": "2.12.0",
41
+ "@hirosystems/clarinet-sdk-wasm": "2.14.0",
41
42
  "@types/jest": "^29.5.12",
42
43
  "jest": "^29.7.0",
43
44
  "ts-jest": "^29.2.5",