Socket
Socket
Sign inDemoInstall

@gearbox-protocol/devops

Package Overview
Dependencies
2
Maintainers
7
Versions
45
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.4 to 1.2.0

11

lib/transaction/transaction.d.ts
import { TransactionReceipt } from "@ethersproject/providers";
import { Contract, ContractFactory, ContractTransaction } from "ethers";
import { BigNumberish, Contract, ContractFactory, ContractTransaction } from "ethers";
import { Logger } from "tslog";
import { Verifier } from "../verifier";
export declare function waitForTransaction(transaction: Promise<ContractTransaction>, logger?: Logger): Promise<TransactionReceipt>;
export declare type ContractFactoryConstructor<T extends ContractFactory> = new (...args: any[]) => T;
interface GasFee {
maxFeePerGas?: BigNumberish;
maxPriorityFeePerGas?: BigNumberish;
}
export declare function waitForTransaction(transaction: Promise<ContractTransaction>, logger?: Logger, fee?: GasFee): Promise<TransactionReceipt>;
export declare type ContractFactoryConstructor<T extends ContractFactory> = new (args: any[]) => T;
export declare type ContractConstructor<T extends Contract> = new (...args: any[]) => T;

@@ -14,1 +18,2 @@ export declare function deploy<T extends Contract>(name: string, logger: Logger | undefined, ...args: any[]): Promise<T>;

export declare function deployWithOptions<T extends Contract>(name: string, options: DeployOptions | undefined, ...args: any[]): Promise<T>;
export {};

@@ -5,2 +5,3 @@ "use strict";

const sdk_1 = require("@gearbox-protocol/sdk");
const ethers_1 = require("ethers");
const hardhat_1 = require("hardhat");

@@ -17,3 +18,6 @@ const waitingTime = async () => {

};
async function waitForTransaction(transaction, logger) {
async function waitForTransaction(transaction, logger, fee) {
if (fee) {
await waitForGas(logger, fee);
}
const request = await transaction;

@@ -28,4 +32,31 @@ const txReceipt = await request.wait(await waitingTime());

exports.waitForTransaction = waitForTransaction;
async function waitForGasDeploy(logger, ...args) {
if (args.length > 0 && typeof args[args.length - 1] === "object") {
const gf = args[args.length - 1];
await waitForGas(logger, gf);
}
}
async function waitForGas(logger, fee) {
var _a;
const accounts = await hardhat_1.ethers.getSigners();
const deployer = accounts[0];
if (fee.maxFeePerGas) {
const maxBaseFee = ethers_1.BigNumber.from(fee.maxFeePerGas).sub(fee.maxPriorityFeePerGas || ethers_1.BigNumber.from(0));
while (true) {
const blockData = await ((_a = deployer.provider) === null || _a === void 0 ? void 0 : _a.getBlock("latest"));
if (blockData === null || blockData === void 0 ? void 0 : blockData.baseFeePerGas) {
if (blockData.baseFeePerGas.gt(maxBaseFee.add(2))) {
logger === null || logger === void 0 ? void 0 : logger.debug(`Waiting for cheaper GAS, current: ${blockData.baseFeePerGas}, target: ${maxBaseFee}`);
}
}
else {
logger === null || logger === void 0 ? void 0 : logger.error("Cant get base fee from latest block");
break;
}
}
}
}
async function deploy(name, logger, ...args) {
const artifact = await hardhat_1.ethers.getContractFactory(name);
await waitForGasDeploy(logger, args);
const contract = (await artifact.deploy(...args));

@@ -32,0 +63,0 @@ logger === null || logger === void 0 ? void 0 : logger.debug(`Deploying ${name}...`);

{
"name": "@gearbox-protocol/devops",
"version": "1.1.4",
"version": "1.2.0",
"description": "Gearbox Devops for SC development",

@@ -5,0 +5,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc