@gearbox-protocol/deploy-tools 5.38.0 → 5.38.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.mjs +39 -26
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -433449,21 +433449,31 @@ var iDegenNftv2Abi2 = parseAbi([
433449
433449
  // ../../node_modules/@gearbox-protocol/sdk/dist/esm/dev/claimFromFaucet.js
433450
433450
  var faucetAbi = parseAbi([
433451
433451
  "function minAmountUSD() external view returns (uint256)",
433452
+ "function claim() external",
433452
433453
  "function claim(uint256 amountUSD) external"
433453
433454
  ]);
433454
433455
  async function claimFromFaucet(opts) {
433455
- const { anvil, faucet, claimer, role, amountUSD, logger: logger2 } = opts;
433456
+ const {
433457
+ publicClient,
433458
+ wallet,
433459
+ faucet,
433460
+ claimer,
433461
+ role,
433462
+ amountUSD,
433463
+ logger: logger2,
433464
+ gasMultiplier = 10n
433465
+ } = opts;
433456
433466
  let toClaimUSD;
433457
- if (typeof amountUSD === "function") {
433458
- toClaimUSD = await readContract(anvil, {
433467
+ if (typeof amountUSD === "bigint") {
433468
+ toClaimUSD = amountUSD;
433469
+ } else if (typeof amountUSD === "function") {
433470
+ toClaimUSD = await readContract(publicClient, {
433459
433471
  address: faucet,
433460
433472
  abi: faucetAbi,
433461
433473
  functionName: "minAmountUSD"
433462
433474
  });
433463
433475
  logger2?.debug(`faucet min amount USD: ${toClaimUSD}`);
433464
433476
  toClaimUSD = amountUSD(toClaimUSD);
433465
- } else {
433466
- toClaimUSD = amountUSD;
433467
433477
  }
433468
433478
  if (toClaimUSD === 0n) {
433469
433479
  logger2?.debug("amount is 0, skipping claim");
@@ -433471,28 +433481,26 @@ async function claimFromFaucet(opts) {
433471
433481
  }
433472
433482
  const [usr, amnt] = [
433473
433483
  [role, claimer.address].filter(Boolean).join(" "),
433474
- formatBN(toClaimUSD, 8)
433484
+ toClaimUSD ? formatBN(toClaimUSD, 8) : "default amount"
433475
433485
  ];
433476
433486
  logger2?.debug(`${usr} claiming ${amnt} USD from faucet`);
433477
- const hash2 = await anvil.writeContract({
433487
+ const gas = await publicClient.estimateContractGas({
433478
433488
  account: claimer,
433479
433489
  address: faucet,
433480
- abi: [
433481
- {
433482
- type: "function",
433483
- inputs: [
433484
- { name: "amountUSD", internalType: "uint256", type: "uint256" }
433485
- ],
433486
- name: "claim",
433487
- outputs: [],
433488
- stateMutability: "nonpayable"
433489
- }
433490
- ],
433490
+ abi: faucetAbi,
433491
433491
  functionName: "claim",
433492
- args: [toClaimUSD],
433493
- chain: anvil.chain
433492
+ args: toClaimUSD ? [toClaimUSD] : []
433494
433493
  });
433495
- const receipt = await anvil.waitForTransactionReceipt({
433494
+ const hash2 = await wallet.writeContract({
433495
+ account: claimer,
433496
+ address: faucet,
433497
+ abi: faucetAbi,
433498
+ functionName: "claim",
433499
+ args: toClaimUSD ? [toClaimUSD] : [],
433500
+ chain: wallet.chain,
433501
+ gas: gas * gasMultiplier
433502
+ });
433503
+ const receipt = await publicClient.waitForTransactionReceipt({
433496
433504
  hash: hash2
433497
433505
  });
433498
433506
  if (receipt.status === "reverted") {
@@ -433912,7 +433920,8 @@ var AccountOpener = class extends SDKConstruct {
433912
433920
  }
433913
433921
  async #claimFromFaucet(claimer, role, amountUSD) {
433914
433922
  await claimFromFaucet({
433915
- anvil: this.#anvil,
433923
+ publicClient: this.#anvil,
433924
+ wallet: this.#anvil,
433916
433925
  faucet: this.faucet,
433917
433926
  claimer,
433918
433927
  role,
@@ -445190,7 +445199,10 @@ function openAccounts() {
445190
445199
  });
445191
445200
  const faucetAddr = await migrateFaucet(sdk);
445192
445201
  log_default.debug(`faucet address: ${faucetAddr}`);
445193
- const anvil = createAnvilClient({ transport: http(anvilUrl) });
445202
+ const anvil = createAnvilClient({
445203
+ transport: http(anvilUrl),
445204
+ chain: sdk.provider.chain
445205
+ });
445194
445206
  const automine = await anvil.getAutomine();
445195
445207
  await anvil.setBlockTimestampInterval({ interval: 0 });
445196
445208
  log_default.debug(`setting block timestamp interval, automine: ${automine}`);
@@ -445356,7 +445368,8 @@ async function distributeExtraTokens(anvil, faucet, tokens, accounts) {
445356
445368
  value: parseEther("100")
445357
445369
  });
445358
445370
  await claimFromFaucet({
445359
- anvil,
445371
+ publicClient: anvil,
445372
+ wallet: anvil,
445360
445373
  faucet,
445361
445374
  amountUSD: (minAmountUSD) => minAmountUSD * BigInt(accounts.length),
445362
445375
  claimer: borrower,
@@ -445451,7 +445464,7 @@ function getRenderer(opts) {
445451
445464
  var package_default = {
445452
445465
  name: "@gearbox-protocol/deploy-tools",
445453
445466
  description: "Gearbox deploy tools",
445454
- version: "5.38.0",
445467
+ version: "5.38.2",
445455
445468
  homepage: "https://gearbox.fi",
445456
445469
  keywords: [
445457
445470
  "gearbox"
@@ -445491,7 +445504,7 @@ var package_default = {
445491
445504
  "@gearbox-protocol/deploy-tools-node": "0.0.0",
445492
445505
  "@gearbox-protocol/deploy-tools-shared": "0.0.0",
445493
445506
  "@gearbox-protocol/deploy-tools-types": "0.0.0",
445494
- "@gearbox-protocol/sdk": "8.6.2",
445507
+ "@gearbox-protocol/sdk": "8.6.3",
445495
445508
  "@gearbox-protocol/sdk-gov": "2.37.0",
445496
445509
  "@types/lodash-es": "^4.17.12",
445497
445510
  "@types/node": "^24.0.14",
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.38.0",
4
+ "version": "5.38.2",
5
5
  "homepage": "https://gearbox.fi",
6
6
  "keywords": [
7
7
  "gearbox"
@@ -41,7 +41,7 @@
41
41
  "@gearbox-protocol/deploy-tools-node": "0.0.0",
42
42
  "@gearbox-protocol/deploy-tools-shared": "0.0.0",
43
43
  "@gearbox-protocol/deploy-tools-types": "0.0.0",
44
- "@gearbox-protocol/sdk": "8.6.2",
44
+ "@gearbox-protocol/sdk": "8.6.3",
45
45
  "@gearbox-protocol/sdk-gov": "2.37.0",
46
46
  "@types/lodash-es": "^4.17.12",
47
47
  "@types/node": "^24.0.14",