@gearbox-protocol/deploy-tools 1.6.0-next.1 → 1.6.0-next.2

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/dist/index.js +357 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -71,6 +71,338 @@ var __privateMethod = (obj, member, method) => {
71
71
  };
72
72
  var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
73
73
 
74
+ // ../../node_modules/dotenv/package.json
75
+ var require_package = __commonJS({
76
+ "../../node_modules/dotenv/package.json"(exports2, module2) {
77
+ module2.exports = {
78
+ name: "dotenv",
79
+ version: "16.3.1",
80
+ description: "Loads environment variables from .env file",
81
+ main: "lib/main.js",
82
+ types: "lib/main.d.ts",
83
+ exports: {
84
+ ".": {
85
+ types: "./lib/main.d.ts",
86
+ require: "./lib/main.js",
87
+ default: "./lib/main.js"
88
+ },
89
+ "./config": "./config.js",
90
+ "./config.js": "./config.js",
91
+ "./lib/env-options": "./lib/env-options.js",
92
+ "./lib/env-options.js": "./lib/env-options.js",
93
+ "./lib/cli-options": "./lib/cli-options.js",
94
+ "./lib/cli-options.js": "./lib/cli-options.js",
95
+ "./package.json": "./package.json"
96
+ },
97
+ scripts: {
98
+ "dts-check": "tsc --project tests/types/tsconfig.json",
99
+ lint: "standard",
100
+ "lint-readme": "standard-markdown",
101
+ pretest: "npm run lint && npm run dts-check",
102
+ test: "tap tests/*.js --100 -Rspec",
103
+ prerelease: "npm test",
104
+ release: "standard-version"
105
+ },
106
+ repository: {
107
+ type: "git",
108
+ url: "git://github.com/motdotla/dotenv.git"
109
+ },
110
+ funding: "https://github.com/motdotla/dotenv?sponsor=1",
111
+ keywords: [
112
+ "dotenv",
113
+ "env",
114
+ ".env",
115
+ "environment",
116
+ "variables",
117
+ "config",
118
+ "settings"
119
+ ],
120
+ readmeFilename: "README.md",
121
+ license: "BSD-2-Clause",
122
+ devDependencies: {
123
+ "@definitelytyped/dtslint": "^0.0.133",
124
+ "@types/node": "^18.11.3",
125
+ decache: "^4.6.1",
126
+ sinon: "^14.0.1",
127
+ standard: "^17.0.0",
128
+ "standard-markdown": "^7.1.0",
129
+ "standard-version": "^9.5.0",
130
+ tap: "^16.3.0",
131
+ tar: "^6.1.11",
132
+ typescript: "^4.8.4"
133
+ },
134
+ engines: {
135
+ node: ">=12"
136
+ },
137
+ browser: {
138
+ fs: false
139
+ }
140
+ };
141
+ }
142
+ });
143
+
144
+ // ../../node_modules/dotenv/lib/main.js
145
+ var require_main = __commonJS({
146
+ "../../node_modules/dotenv/lib/main.js"(exports2, module2) {
147
+ var fs = require("fs");
148
+ var path = require("path");
149
+ var os = require("os");
150
+ var crypto4 = require("crypto");
151
+ var packageJson = require_package();
152
+ var version2 = packageJson.version;
153
+ var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
154
+ function parse3(src) {
155
+ const obj = {};
156
+ let lines = src.toString();
157
+ lines = lines.replace(/\r\n?/mg, "\n");
158
+ let match;
159
+ while ((match = LINE.exec(lines)) != null) {
160
+ const key = match[1];
161
+ let value = match[2] || "";
162
+ value = value.trim();
163
+ const maybeQuote = value[0];
164
+ value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
165
+ if (maybeQuote === '"') {
166
+ value = value.replace(/\\n/g, "\n");
167
+ value = value.replace(/\\r/g, "\r");
168
+ }
169
+ obj[key] = value;
170
+ }
171
+ return obj;
172
+ }
173
+ function _parseVault(options) {
174
+ const vaultPath = _vaultPath(options);
175
+ const result = DotenvModule.configDotenv({ path: vaultPath });
176
+ if (!result.parsed) {
177
+ throw new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
178
+ }
179
+ const keys = _dotenvKey(options).split(",");
180
+ const length = keys.length;
181
+ let decrypted;
182
+ for (let i = 0; i < length; i++) {
183
+ try {
184
+ const key = keys[i].trim();
185
+ const attrs = _instructions(result, key);
186
+ decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
187
+ break;
188
+ } catch (error) {
189
+ if (i + 1 >= length) {
190
+ throw error;
191
+ }
192
+ }
193
+ }
194
+ return DotenvModule.parse(decrypted);
195
+ }
196
+ function _log(message) {
197
+ console.log(`[dotenv@${version2}][INFO] ${message}`);
198
+ }
199
+ function _warn(message) {
200
+ console.log(`[dotenv@${version2}][WARN] ${message}`);
201
+ }
202
+ function _debug(message) {
203
+ console.log(`[dotenv@${version2}][DEBUG] ${message}`);
204
+ }
205
+ function _dotenvKey(options) {
206
+ if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
207
+ return options.DOTENV_KEY;
208
+ }
209
+ if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
210
+ return process.env.DOTENV_KEY;
211
+ }
212
+ return "";
213
+ }
214
+ function _instructions(result, dotenvKey) {
215
+ let uri;
216
+ try {
217
+ uri = new URL(dotenvKey);
218
+ } catch (error) {
219
+ if (error.code === "ERR_INVALID_URL") {
220
+ throw new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=development");
221
+ }
222
+ throw error;
223
+ }
224
+ const key = uri.password;
225
+ if (!key) {
226
+ throw new Error("INVALID_DOTENV_KEY: Missing key part");
227
+ }
228
+ const environment = uri.searchParams.get("environment");
229
+ if (!environment) {
230
+ throw new Error("INVALID_DOTENV_KEY: Missing environment part");
231
+ }
232
+ const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
233
+ const ciphertext = result.parsed[environmentKey];
234
+ if (!ciphertext) {
235
+ throw new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
236
+ }
237
+ return { ciphertext, key };
238
+ }
239
+ function _vaultPath(options) {
240
+ let dotenvPath = path.resolve(process.cwd(), ".env");
241
+ if (options && options.path && options.path.length > 0) {
242
+ dotenvPath = options.path;
243
+ }
244
+ return dotenvPath.endsWith(".vault") ? dotenvPath : `${dotenvPath}.vault`;
245
+ }
246
+ function _resolveHome(envPath) {
247
+ return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath;
248
+ }
249
+ function _configVault(options) {
250
+ _log("Loading env from encrypted .env.vault");
251
+ const parsed = DotenvModule._parseVault(options);
252
+ let processEnv = process.env;
253
+ if (options && options.processEnv != null) {
254
+ processEnv = options.processEnv;
255
+ }
256
+ DotenvModule.populate(processEnv, parsed, options);
257
+ return { parsed };
258
+ }
259
+ function configDotenv(options) {
260
+ let dotenvPath = path.resolve(process.cwd(), ".env");
261
+ let encoding = "utf8";
262
+ const debug = Boolean(options && options.debug);
263
+ if (options) {
264
+ if (options.path != null) {
265
+ dotenvPath = _resolveHome(options.path);
266
+ }
267
+ if (options.encoding != null) {
268
+ encoding = options.encoding;
269
+ }
270
+ }
271
+ try {
272
+ const parsed = DotenvModule.parse(fs.readFileSync(dotenvPath, { encoding }));
273
+ let processEnv = process.env;
274
+ if (options && options.processEnv != null) {
275
+ processEnv = options.processEnv;
276
+ }
277
+ DotenvModule.populate(processEnv, parsed, options);
278
+ return { parsed };
279
+ } catch (e) {
280
+ if (debug) {
281
+ _debug(`Failed to load ${dotenvPath} ${e.message}`);
282
+ }
283
+ return { error: e };
284
+ }
285
+ }
286
+ function config(options) {
287
+ const vaultPath = _vaultPath(options);
288
+ if (_dotenvKey(options).length === 0) {
289
+ return DotenvModule.configDotenv(options);
290
+ }
291
+ if (!fs.existsSync(vaultPath)) {
292
+ _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
293
+ return DotenvModule.configDotenv(options);
294
+ }
295
+ return DotenvModule._configVault(options);
296
+ }
297
+ function decrypt(encrypted, keyStr) {
298
+ const key = Buffer.from(keyStr.slice(-64), "hex");
299
+ let ciphertext = Buffer.from(encrypted, "base64");
300
+ const nonce = ciphertext.slice(0, 12);
301
+ const authTag = ciphertext.slice(-16);
302
+ ciphertext = ciphertext.slice(12, -16);
303
+ try {
304
+ const aesgcm = crypto4.createDecipheriv("aes-256-gcm", key, nonce);
305
+ aesgcm.setAuthTag(authTag);
306
+ return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
307
+ } catch (error) {
308
+ const isRange = error instanceof RangeError;
309
+ const invalidKeyLength = error.message === "Invalid key length";
310
+ const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
311
+ if (isRange || invalidKeyLength) {
312
+ const msg = "INVALID_DOTENV_KEY: It must be 64 characters long (or more)";
313
+ throw new Error(msg);
314
+ } else if (decryptionFailed) {
315
+ const msg = "DECRYPTION_FAILED: Please check your DOTENV_KEY";
316
+ throw new Error(msg);
317
+ } else {
318
+ console.error("Error: ", error.code);
319
+ console.error("Error: ", error.message);
320
+ throw error;
321
+ }
322
+ }
323
+ }
324
+ function populate(processEnv, parsed, options = {}) {
325
+ const debug = Boolean(options && options.debug);
326
+ const override = Boolean(options && options.override);
327
+ if (typeof parsed !== "object") {
328
+ throw new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
329
+ }
330
+ for (const key of Object.keys(parsed)) {
331
+ if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
332
+ if (override === true) {
333
+ processEnv[key] = parsed[key];
334
+ }
335
+ if (debug) {
336
+ if (override === true) {
337
+ _debug(`"${key}" is already defined and WAS overwritten`);
338
+ } else {
339
+ _debug(`"${key}" is already defined and was NOT overwritten`);
340
+ }
341
+ }
342
+ } else {
343
+ processEnv[key] = parsed[key];
344
+ }
345
+ }
346
+ }
347
+ var DotenvModule = {
348
+ configDotenv,
349
+ _configVault,
350
+ _parseVault,
351
+ config,
352
+ decrypt,
353
+ parse: parse3,
354
+ populate
355
+ };
356
+ module2.exports.configDotenv = DotenvModule.configDotenv;
357
+ module2.exports._configVault = DotenvModule._configVault;
358
+ module2.exports._parseVault = DotenvModule._parseVault;
359
+ module2.exports.config = DotenvModule.config;
360
+ module2.exports.decrypt = DotenvModule.decrypt;
361
+ module2.exports.parse = DotenvModule.parse;
362
+ module2.exports.populate = DotenvModule.populate;
363
+ module2.exports = DotenvModule;
364
+ }
365
+ });
366
+
367
+ // ../../node_modules/dotenv/lib/env-options.js
368
+ var require_env_options = __commonJS({
369
+ "../../node_modules/dotenv/lib/env-options.js"(exports2, module2) {
370
+ var options = {};
371
+ if (process.env.DOTENV_CONFIG_ENCODING != null) {
372
+ options.encoding = process.env.DOTENV_CONFIG_ENCODING;
373
+ }
374
+ if (process.env.DOTENV_CONFIG_PATH != null) {
375
+ options.path = process.env.DOTENV_CONFIG_PATH;
376
+ }
377
+ if (process.env.DOTENV_CONFIG_DEBUG != null) {
378
+ options.debug = process.env.DOTENV_CONFIG_DEBUG;
379
+ }
380
+ if (process.env.DOTENV_CONFIG_OVERRIDE != null) {
381
+ options.override = process.env.DOTENV_CONFIG_OVERRIDE;
382
+ }
383
+ if (process.env.DOTENV_CONFIG_DOTENV_KEY != null) {
384
+ options.DOTENV_KEY = process.env.DOTENV_CONFIG_DOTENV_KEY;
385
+ }
386
+ module2.exports = options;
387
+ }
388
+ });
389
+
390
+ // ../../node_modules/dotenv/lib/cli-options.js
391
+ var require_cli_options = __commonJS({
392
+ "../../node_modules/dotenv/lib/cli-options.js"(exports2, module2) {
393
+ var re = /^dotenv_config_(encoding|path|debug|override|DOTENV_KEY)=(.+)$/;
394
+ module2.exports = function optionMatcher(args) {
395
+ return args.reduce(function(acc, cur) {
396
+ const matches = cur.match(re);
397
+ if (matches) {
398
+ acc[matches[1]] = matches[2];
399
+ }
400
+ return acc;
401
+ }, {});
402
+ };
403
+ }
404
+ });
405
+
74
406
  // ../../node_modules/commander/lib/error.js
75
407
  var require_error = __commonJS({
76
408
  "../../node_modules/commander/lib/error.js"(exports2) {
@@ -14478,7 +14810,7 @@ var require_lib15 = __commonJS({
14478
14810
  });
14479
14811
 
14480
14812
  // ../../node_modules/elliptic/package.json
14481
- var require_package = __commonJS({
14813
+ var require_package2 = __commonJS({
14482
14814
  "../../node_modules/elliptic/package.json"(exports2, module2) {
14483
14815
  module2.exports = {
14484
14816
  name: "elliptic",
@@ -22448,7 +22780,7 @@ var require_elliptic = __commonJS({
22448
22780
  "../../node_modules/elliptic/lib/elliptic.js"(exports2) {
22449
22781
  "use strict";
22450
22782
  var elliptic = exports2;
22451
- elliptic.version = require_package().version;
22783
+ elliptic.version = require_package2().version;
22452
22784
  elliptic.utils = require_utils2();
22453
22785
  elliptic.rand = require_brorand();
22454
22786
  elliptic.curve = require_curve();
@@ -202875,7 +203207,7 @@ var require_bytecode = __commonJS({
202875
203207
  });
202876
203208
 
202877
203209
  // ../../node_modules/@ethereum-sourcify/bytecode-utils/build/main/index.js
202878
- var require_main = __commonJS({
203210
+ var require_main2 = __commonJS({
202879
203211
  "../../node_modules/@ethereum-sourcify/bytecode-utils/build/main/index.js"(exports2) {
202880
203212
  "use strict";
202881
203213
  var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
@@ -205218,7 +205550,7 @@ var require_utils9 = __commonJS({
205218
205550
  };
205219
205551
  Object.defineProperty(exports2, "__esModule", { value: true });
205220
205552
  exports2.clearCli = exports2.major = exports2.stringifyAudits = exports2.extractAbiEncodedConstructorArguments = exports2.doesContainMetadataHash = exports2.stringifyInvalidAndMissing = exports2.extractFilesFromJSON = exports2.decodeBatchTx = exports2.txType = exports2.getTransactionsToExecute = exports2.warpTime = exports2.waitForBlock = exports2.stopImpersonate = exports2.impersonate = void 0;
205221
- var bytecode_utils_1 = require_main();
205553
+ var bytecode_utils_1 = require_main2();
205222
205554
  var ethers_1 = require_lib254();
205223
205555
  var sortedUniqBy_1 = __importDefault2(require_sortedUniqBy());
205224
205556
  var p_retry_1 = __importDefault2(require_p_retry());
@@ -332828,7 +333160,7 @@ var require_CheckedContract = __commonJS({
332828
333160
  var solidityCompiler_1 = require_solidityCompiler();
332829
333161
  var utils_1 = require_utils31();
332830
333162
  var validation_1 = require_validation3();
332831
- var bytecode_utils_1 = require_main();
333163
+ var bytecode_utils_1 = require_main2();
332832
333164
  var ipfsHash_1 = require_ipfsHash();
332833
333165
  var swarmHash_1 = require_swarmHash();
332834
333166
  var logger_1 = require_logger();
@@ -343266,7 +343598,7 @@ var require_verification = __commonJS({
343266
343598
  };
343267
343599
  Object.defineProperty(exports2, "__esModule", { value: true });
343268
343600
  exports2.calculateCreate2Address = exports2.replaceImmutableReferences = exports2.checkCallProtectionAndReplaceAddress = exports2.addLibraryAddresses = exports2.matchWithCreationTx = exports2.matchWithDeployedBytecode = exports2.verifyCreate2 = exports2.verifyDeployed = void 0;
343269
- var bytecode_utils_1 = require_main();
343601
+ var bytecode_utils_1 = require_main2();
343270
343602
  var ethers_1 = require_lib262();
343271
343603
  var bytes_1 = require_lib224();
343272
343604
  var bignumber_1 = require_lib225();
@@ -343693,7 +344025,7 @@ var require_types20 = __commonJS({
343693
344025
  });
343694
344026
 
343695
344027
  // ../../node_modules/@ethereum-sourcify/lib-sourcify/build/main/index.js
343696
- var require_main2 = __commonJS({
344028
+ var require_main3 = __commonJS({
343697
344029
  "../../node_modules/@ethereum-sourcify/lib-sourcify/build/main/index.js"(exports2) {
343698
344030
  "use strict";
343699
344031
  var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
@@ -343797,8 +344129,8 @@ var require_Create2FactoryParser = __commonJS({
343797
344129
  return mod && mod.__esModule ? mod : { "default": mod };
343798
344130
  };
343799
344131
  Object.defineProperty(exports2, "__esModule", { value: true });
343800
- var bytecode_utils_1 = require_main();
343801
- var lib_sourcify_1 = require_main2();
344132
+ var bytecode_utils_1 = require_main2();
344133
+ var lib_sourcify_1 = require_main3();
343802
344134
  var abi_1 = require_lib235();
343803
344135
  var ethers_1 = require_lib254();
343804
344136
  var container_1 = require_container();
@@ -349443,7 +349775,7 @@ var require_urlencoded = __commonJS({
349443
349775
  });
349444
349776
 
349445
349777
  // ../../node_modules/@fastify/busboy/lib/main.js
349446
- var require_main3 = __commonJS({
349778
+ var require_main4 = __commonJS({
349447
349779
  "../../node_modules/@fastify/busboy/lib/main.js"(exports2, module2) {
349448
349780
  "use strict";
349449
349781
  var WritableStream = require("stream").Writable;
@@ -351344,7 +351676,7 @@ var require_formdata = __commonJS({
351344
351676
  var require_body = __commonJS({
351345
351677
  "../../node_modules/undici/lib/fetch/body.js"(exports2, module2) {
351346
351678
  "use strict";
351347
- var Busboy = require_main3();
351679
+ var Busboy = require_main4();
351348
351680
  var util = require_util4();
351349
351681
  var {
351350
351682
  ReadableStreamFrom,
@@ -364833,12 +365165,12 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
364833
365165
  });
364834
365166
 
364835
365167
  // package.json
364836
- var require_package2 = __commonJS({
365168
+ var require_package3 = __commonJS({
364837
365169
  "package.json"(exports2, module2) {
364838
365170
  module2.exports = {
364839
365171
  name: "@gearbox-protocol/deploy-tools",
364840
365172
  description: "Gearbox deploy tools",
364841
- version: "1.5.1",
365173
+ version: "1.6.0-next.1",
364842
365174
  homepage: "https://gearbox.fi",
364843
365175
  keywords: [
364844
365176
  "gearbox"
@@ -364922,6 +365254,17 @@ var require_package2 = __commonJS({
364922
365254
  }
364923
365255
  });
364924
365256
 
365257
+ // ../../node_modules/dotenv/config.js
365258
+ (function() {
365259
+ require_main().config(
365260
+ Object.assign(
365261
+ {},
365262
+ require_env_options(),
365263
+ require_cli_options()(process.argv)
365264
+ )
365265
+ );
365266
+ })();
365267
+
364925
365268
  // ../../node_modules/commander/esm.mjs
364926
365269
  var import_index = __toESM(require_commander(), 1);
364927
365270
  var {
@@ -365029,7 +365372,7 @@ function verifyEtherscan() {
365029
365372
 
365030
365373
  // src/index.ts
365031
365374
  var program2 = new Command();
365032
- program2.name("deploy-tools").description("gearbox deploy tools").version(require_package2().version);
365375
+ program2.name("deploy-tools").description("gearbox deploy tools").version(require_package3().version);
365033
365376
  program2.addCommand(copyMultisig());
365034
365377
  program2.addCommand(addressTree());
365035
365378
  program2.addCommand(verifyEtherscan());
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/deploy-tools",
3
3
  "description": "Gearbox deploy tools",
4
- "version": "1.6.0-next.1",
4
+ "version": "1.6.0-next.2",
5
5
  "homepage": "https://gearbox.fi",
6
6
  "keywords": [
7
7
  "gearbox"