@gearbox-protocol/deploy-tools 3.0.4 → 3.2.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.
Files changed (2) hide show
  1. package/dist/index.mjs +68 -24
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -155463,8 +155463,8 @@ var require_network = __commonJS({
155463
155463
  * Gets a list of all plugins that match %%name%%, with otr without
155464
155464
  * a fragment.
155465
155465
  */
155466
- getPlugins(basename) {
155467
- return this.plugins.filter((p) => p.name.split("#")[0] === basename);
155466
+ getPlugins(basename2) {
155467
+ return this.plugins.filter((p) => p.name.split("#")[0] === basename2);
155468
155468
  }
155469
155469
  /**
155470
155470
  * Create a copy of this Network.
@@ -311042,8 +311042,8 @@ var Network = class _Network {
311042
311042
  * Gets a list of all plugins that match %%name%%, with otr without
311043
311043
  * a fragment.
311044
311044
  */
311045
- getPlugins(basename) {
311046
- return this.plugins.filter((p) => p.name.split("#")[0] === basename);
311045
+ getPlugins(basename2) {
311046
+ return this.plugins.filter((p) => p.name.split("#")[0] === basename2);
311047
311047
  }
311048
311048
  /**
311049
311049
  * Create a copy of this Network.
@@ -316506,7 +316506,7 @@ function compareAudited(a, b3) {
316506
316506
 
316507
316507
  // ../../packages/node/dist/helpers/batches.js
316508
316508
  import { readFile } from "node:fs/promises";
316509
- import { resolve as resolve2 } from "node:path";
316509
+ import { basename, resolve as resolve2 } from "node:path";
316510
316510
  var import_fast_deep_equal = __toESM(require_fast_deep_equal(), 1);
316511
316511
 
316512
316512
  // ../../packages/node/dist/helpers/fs.js
@@ -316654,6 +316654,14 @@ async function loadBatchDir(dir) {
316654
316654
  }
316655
316655
  meta2 = [...meta2, ...metaFile];
316656
316656
  }
316657
+ if (file.includes("_meta/0x")) {
316658
+ const address = basename(file).replace(/\.json$/, "");
316659
+ if (!isAddress2(address)) {
316660
+ throw new Error(`invalid metafile ${file}`);
316661
+ }
316662
+ const metaFile = await readFile(resolve2(dir, file), "utf8").then(json_parse);
316663
+ meta2 = [...meta2, metaFile];
316664
+ }
316657
316665
  if (file.endsWith(".queue.json")) {
316658
316666
  const name = file.replace(".queue.json", "");
316659
316667
  const executeFile = file.replace(".queue.json", ".execute.json");
@@ -316724,26 +316732,53 @@ function normalizeMultisigTx(tx) {
316724
316732
  eta: t.contractInputsValues.eta
316725
316733
  };
316726
316734
  }
316727
- if (!t.contractInputsValues.signature) {
316728
- throw new Error(`missing signature in tx ${t.to}.${t.contractMethod.name}`);
316735
+ if (["queueTransaction", "executeTransaction", "cancelTransaction"].includes(t.contractMethod.name)) {
316736
+ return normalizeTimelockTx(t);
316729
316737
  }
316730
- const sighash = id2(t.contractInputsValues.signature).substring(0, 10);
316731
- const frag = FunctionFragment2.from(t.contractInputsValues.signature);
316732
- const decoded = AbiCoder2.defaultAbiCoder().decode(frag.inputs, t.contractInputsValues.data);
316733
- return {
316734
- target: t.contractInputsValues.target,
316735
- value: t.contractInputsValues.value,
316736
- signature: t.contractInputsValues.signature,
316737
- parameters: frag.inputs.map((input, i) => ({
316738
- name: input.name,
316739
- type: input.type,
316740
- value: decoded[i]
316741
- })),
316742
- data: t.contractInputsValues.data.replace("0x", sighash),
316743
- eta: t.contractInputsValues.eta
316744
- };
316738
+ return normalizeDirectTx(t);
316745
316739
  });
316746
316740
  }
316741
+ function normalizeDirectTx(t) {
316742
+ const frag = FunctionFragment2.from(t.contractMethod);
316743
+ const iFace = new Interface2([frag]);
316744
+ const parameters = t.contractMethod.inputs.map((i) => ({
316745
+ name: i.name,
316746
+ type: i.type,
316747
+ value: t.contractInputsValues[i.name]
316748
+ }));
316749
+ const values = parameters.map((p) => {
316750
+ try {
316751
+ return json_parse(p.value);
316752
+ } catch {
316753
+ return p.value;
316754
+ }
316755
+ });
316756
+ return {
316757
+ target: t.to,
316758
+ value: t.value,
316759
+ signature: frag.format("minimal").replace("function ", ""),
316760
+ parameters,
316761
+ data: iFace.encodeFunctionData(frag, values)
316762
+ // function 4byte signature + data
316763
+ };
316764
+ }
316765
+ function normalizeTimelockTx(t) {
316766
+ const sighash = id2(t.contractInputsValues.signature).substring(0, 10);
316767
+ const frag = FunctionFragment2.from(t.contractInputsValues.signature);
316768
+ const decoded = AbiCoder2.defaultAbiCoder().decode(frag.inputs, t.contractInputsValues.data);
316769
+ return {
316770
+ target: t.contractInputsValues.target,
316771
+ value: t.contractInputsValues.value,
316772
+ signature: t.contractInputsValues.signature,
316773
+ parameters: frag.inputs.map((input, i) => ({
316774
+ name: input.name,
316775
+ type: input.type,
316776
+ value: decoded[i]
316777
+ })),
316778
+ data: t.contractInputsValues.data.replace("0x", sighash),
316779
+ eta: t.contractInputsValues.eta
316780
+ };
316781
+ }
316747
316782
  function updateTitle(update) {
316748
316783
  if (update.format === "batch_pair") {
316749
316784
  const { queue, execute, name } = update;
@@ -324441,7 +324476,16 @@ var UpdateParser = class extends ProviderBase {
324441
324476
  this.logger.info(`[${i + 1}/${total}] processing ${updateTitle(batch)}`);
324442
324477
  const transactions = [];
324443
324478
  for (const tx of batch.transactions) {
324444
- transactions.push(await this.#parseNormalizedTx(tx, meta2));
324479
+ try {
324480
+ transactions.push(await this.#parseNormalizedTx(tx, meta2));
324481
+ } catch (e) {
324482
+ transactions.push({
324483
+ error: `${e}`,
324484
+ to: tx.target,
324485
+ calldata: tx.data,
324486
+ signature: tx.signature
324487
+ });
324488
+ }
324445
324489
  }
324446
324490
  return {
324447
324491
  ...batch,
@@ -325829,7 +325873,7 @@ function zeroLT() {
325829
325873
  }
325830
325874
 
325831
325875
  // package.json
325832
- var version3 = "3.0.3";
325876
+ var version3 = "3.1.0";
325833
325877
 
325834
325878
  // src/index.ts
325835
325879
  var program2 = new Command();
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": "3.0.4",
4
+ "version": "3.2.0",
5
5
  "homepage": "https://gearbox.fi",
6
6
  "keywords": [
7
7
  "gearbox"