@gearbox-protocol/deploy-tools 5.10.8 → 5.10.10

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 +58 -19
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -405585,6 +405585,7 @@ var AccountOpener = class extends SDKConstruct {
405585
405585
  transport: service.sdk.provider.transport
405586
405586
  });
405587
405587
  this.#faucet = options.faucet ?? service.sdk.addressProvider.getAddress("FAUCET");
405588
+ this.#borrower = options.borrower;
405588
405589
  }
405589
405590
  get borrower() {
405590
405591
  if (!this.#borrower) {
@@ -405694,17 +405695,27 @@ var AccountOpener = class extends SDKConstruct {
405694
405695
  );
405695
405696
  }
405696
405697
  logger2?.debug("prepared open account transaction");
405697
- const hash2 = await sendRawTx(this.#anvil, {
405698
- tx,
405699
- account: borrower
405700
- });
405701
- logger2?.debug(`send transaction ${hash2}`);
405698
+ let hash2;
405699
+ try {
405700
+ hash2 = await sendRawTx(this.#anvil, {
405701
+ tx,
405702
+ account: borrower
405703
+ });
405704
+ logger2?.debug(`send transaction ${hash2}`);
405705
+ } catch (e) {
405706
+ return {
405707
+ input,
405708
+ error: `${e}`,
405709
+ rawTx: tx
405710
+ };
405711
+ }
405702
405712
  const receipt = await this.#anvil.waitForTransactionReceipt({ hash: hash2 });
405703
405713
  if (receipt.status === "reverted") {
405704
405714
  return {
405705
405715
  input,
405706
405716
  error: `open credit account tx reverted`,
405707
- txHash: hash2
405717
+ txHash: hash2,
405718
+ rawTx: tx
405708
405719
  };
405709
405720
  }
405710
405721
  logger2?.info(`opened credit account ${index2}/${total}`);
@@ -405730,6 +405741,7 @@ var AccountOpener = class extends SDKConstruct {
405730
405741
  return {
405731
405742
  input,
405732
405743
  txHash: hash2,
405744
+ rawTx: tx,
405733
405745
  account
405734
405746
  };
405735
405747
  }
@@ -413946,9 +413958,17 @@ function openAccounts() {
413946
413958
  }
413947
413959
  }
413948
413960
  );
413961
+ const borrowerKey = generatePrivateKey();
413962
+ const borrower = privateKeyToAccount(borrowerKey);
413963
+ await anvil.setBalance({
413964
+ address: borrower.address,
413965
+ value: parseEther("100")
413966
+ });
413967
+ log_default.debug(`borrower address: ${borrower.address}`);
413949
413968
  const accService = new CreditAccountsService(sdkExample2.sdk);
413950
413969
  const accountOpener = new AccountOpener(accService, {
413951
- faucet: faucetAddr
413970
+ faucet: faucetAddr,
413971
+ borrower
413952
413972
  });
413953
413973
  try {
413954
413974
  let accounts = [
@@ -414011,13 +414031,14 @@ function openAccounts() {
414011
414031
  json_stringify(results),
414012
414032
  "utf-8"
414013
414033
  );
414014
- for (const r of results) {
414015
- if (!!r.txHash && !r.account) {
414016
- await runCast(
414017
- r.txHash,
414018
- ["run", "--rpc-url", anvilUrl, r.txHash],
414019
- destDir
414020
- );
414034
+ for (let i = 0; i < results.length; i++) {
414035
+ const r = results[i];
414036
+ if (!r.account) {
414037
+ await runCast(r, i + 1, {
414038
+ anvilUrl,
414039
+ destDir,
414040
+ privateKey: borrowerKey
414041
+ });
414021
414042
  }
414022
414043
  }
414023
414044
  } catch (e) {
@@ -414026,14 +414047,32 @@ function openAccounts() {
414026
414047
  log_default.info("done");
414027
414048
  });
414028
414049
  }
414029
- async function runCast(hash2, args, destDir) {
414050
+ async function runCast(result, index2, opts) {
414051
+ const { txHash, rawTx } = result;
414052
+ const { anvilUrl, destDir, privateKey } = opts;
414053
+ if (!txHash || !rawTx) {
414054
+ return;
414055
+ }
414056
+ const id = txHash ? txHash : `account_${index2}`;
414057
+ const args = txHash ? ["run", "--rpc-url", anvilUrl, txHash] : [
414058
+ "call",
414059
+ "--trace",
414060
+ "--rpc-url",
414061
+ anvilUrl,
414062
+ "--private-key",
414063
+ privateKey,
414064
+ rawTx.to,
414065
+ rawTx.callData
414066
+ ];
414067
+ const argsStr = args.join(" ").replace(privateKey, "<pk>");
414068
+ log_default.debug(`running cast ${argsStr}`);
414030
414069
  try {
414031
- const traceFile = path9.resolve(destDir, `${hash2}.trace`);
414070
+ const traceFile = path9.resolve(destDir, `${id}.trace`);
414032
414071
  const cast = spawnSync3("cast", args, { encoding: "utf-8" });
414033
414072
  await writeFile6(traceFile, cast.output.join(""), "utf-8");
414034
414073
  log_default.debug(`saved trace file: ${traceFile}`);
414035
414074
  } catch (e) {
414036
- log_default.warn(`failed to save trace of cast ${args.join(" ")}: ${e}`);
414075
+ log_default.warn(`failed to save trace: ${e}`);
414037
414076
  }
414038
414077
  }
414039
414078
 
@@ -414084,7 +414123,7 @@ function getRenderer(opts) {
414084
414123
  var package_default = {
414085
414124
  name: "@gearbox-protocol/deploy-tools",
414086
414125
  description: "Gearbox deploy tools",
414087
- version: "5.10.8",
414126
+ version: "5.10.10",
414088
414127
  homepage: "https://gearbox.fi",
414089
414128
  keywords: [
414090
414129
  "gearbox"
@@ -414127,7 +414166,7 @@ var package_default = {
414127
414166
  "@gearbox-protocol/deploy-tools-node": "0.0.0",
414128
414167
  "@gearbox-protocol/deploy-tools-shared": "0.0.0",
414129
414168
  "@gearbox-protocol/deploy-tools-types": "0.0.0",
414130
- "@gearbox-protocol/sdk": "3.0.0-vfour.241",
414169
+ "@gearbox-protocol/sdk": "3.0.0-vfour.242",
414131
414170
  "@gearbox-protocol/sdk-gov": "^2.34.1",
414132
414171
  "@types/lodash-es": "^4.17.12",
414133
414172
  "@types/node": "^22.13.1",
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": "5.10.8",
4
+ "version": "5.10.10",
5
5
  "homepage": "https://gearbox.fi",
6
6
  "keywords": [
7
7
  "gearbox"
@@ -44,7 +44,7 @@
44
44
  "@gearbox-protocol/deploy-tools-node": "0.0.0",
45
45
  "@gearbox-protocol/deploy-tools-shared": "0.0.0",
46
46
  "@gearbox-protocol/deploy-tools-types": "0.0.0",
47
- "@gearbox-protocol/sdk": "3.0.0-vfour.241",
47
+ "@gearbox-protocol/sdk": "3.0.0-vfour.242",
48
48
  "@gearbox-protocol/sdk-gov": "^2.34.1",
49
49
  "@types/lodash-es": "^4.17.12",
50
50
  "@types/node": "^22.13.1",