@gearbox-protocol/deploy-tools 3.1.0 → 3.2.1

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 +45 -18
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -316732,25 +316732,52 @@ function normalizeMultisigTx(tx) {
316732
316732
  eta: t.contractInputsValues.eta
316733
316733
  };
316734
316734
  }
316735
- if (!t.contractInputsValues.signature) {
316736
- 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);
316737
+ }
316738
+ return normalizeDirectTx(t);
316739
+ });
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;
316737
316754
  }
316738
- const sighash = id2(t.contractInputsValues.signature).substring(0, 10);
316739
- const frag = FunctionFragment2.from(t.contractInputsValues.signature);
316740
- const decoded = AbiCoder2.defaultAbiCoder().decode(frag.inputs, t.contractInputsValues.data);
316741
- return {
316742
- target: t.contractInputsValues.target,
316743
- value: t.contractInputsValues.value,
316744
- signature: t.contractInputsValues.signature,
316745
- parameters: frag.inputs.map((input, i) => ({
316746
- name: input.name,
316747
- type: input.type,
316748
- value: decoded[i]
316749
- })),
316750
- data: t.contractInputsValues.data.replace("0x", sighash),
316751
- eta: t.contractInputsValues.eta
316752
- };
316753
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
+ };
316754
316781
  }
316755
316782
  function updateTitle(update) {
316756
316783
  if (update.format === "batch_pair") {
@@ -325846,7 +325873,7 @@ function zeroLT() {
325846
325873
  }
325847
325874
 
325848
325875
  // package.json
325849
- var version3 = "3.0.4";
325876
+ var version3 = "3.2.0";
325850
325877
 
325851
325878
  // src/index.ts
325852
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.1.0",
4
+ "version": "3.2.1",
5
5
  "homepage": "https://gearbox.fi",
6
6
  "keywords": [
7
7
  "gearbox"