Socket
Socket
Sign inDemoInstall

zksync-web3

Package Overview
Dependencies
Maintainers
5
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zksync-web3 - npm Package Compare versions

Comparing version 0.3.4 to 0.3.5

79

build/adapters.js

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

const utils_1 = require("./utils");
const types_1 = require("./types");
function AdapterL1(Base) {

@@ -88,13 +89,15 @@ return class Adapter extends Base {

async deposit(transaction) {
var _a, _b, _c, _d, _e, _f, _g, _h;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
const zksyncContract = await this.getMainContract();
const tx = Object.assign((0, utils_1.layer1TxDefaults)(), transaction);
(_a = tx.to) !== null && _a !== void 0 ? _a : (tx.to = await this.getAddress());
(_b = tx.operatorTip) !== null && _b !== void 0 ? _b : (tx.operatorTip = ethers_1.BigNumber.from(0));
(_c = tx.overrides) !== null && _c !== void 0 ? _c : (tx.overrides = {});
const { ...tx } = transaction;
(_a = tx.opTree) !== null && _a !== void 0 ? _a : (tx.opTree = types_1.PriorityOpTree.Full);
(_b = tx.queueType) !== null && _b !== void 0 ? _b : (tx.queueType = types_1.PriorityQueueType.Deque);
(_c = tx.to) !== null && _c !== void 0 ? _c : (tx.to = await this.getAddress());
(_d = tx.operatorTip) !== null && _d !== void 0 ? _d : (tx.operatorTip = ethers_1.BigNumber.from(0));
(_e = tx.overrides) !== null && _e !== void 0 ? _e : (tx.overrides = {});
const { to, token, amount, queueType, opTree, operatorTip, overrides } = tx;
(_d = overrides.gasPrice) !== null && _d !== void 0 ? _d : (overrides.gasPrice = await this._providerL1().getGasPrice());
(_f = overrides.gasPrice) !== null && _f !== void 0 ? _f : (overrides.gasPrice = await this._providerL1().getGasPrice());
const baseCost = ethers_1.BigNumber.from(await zksyncContract.depositBaseCost(overrides.gasPrice, queueType, opTree));
if ((0, utils_1.isETH)(token)) {
(_e = overrides.value) !== null && _e !== void 0 ? _e : (overrides.value = baseCost.add(operatorTip).add(amount));
(_g = overrides.value) !== null && _g !== void 0 ? _g : (overrides.value = baseCost.add(operatorTip).add(amount));
await (0, utils_1.checkBaseCost)(baseCost, overrides.value);

@@ -107,3 +110,3 @@ return this._providerL2().getPriorityOpResponse(await zksyncContract.depositETH(amount, to, queueType, opTree, {

else {
(_f = overrides.value) !== null && _f !== void 0 ? _f : (overrides.value = baseCost.add(operatorTip));
(_h = overrides.value) !== null && _h !== void 0 ? _h : (overrides.value = baseCost.add(operatorTip));
await (0, utils_1.checkBaseCost)(baseCost, overrides.value);

@@ -119,3 +122,3 @@ let l2ContractCode = await this._providerL2().getCode(token);

}
(_g = overrides.nonce) !== null && _g !== void 0 ? _g : (overrides.nonce = nonce);
(_j = overrides.nonce) !== null && _j !== void 0 ? _j : (overrides.nonce = nonce);
const args = [token, amount, to, queueType, opTree];

@@ -126,3 +129,3 @@ if (overrides.gasLimit == null) {

.catch(() => ethers_1.BigNumber.from(0));
const recommendedGasLimit = (_h = utils_1.RECOMMENDED_GAS_LIMIT.ERC20_DEPOSIT[token]) !== null && _h !== void 0 ? _h : utils_1.RECOMMENDED_GAS_LIMIT.ERC20_DEFAULT_DEPOSIT;
const recommendedGasLimit = (_k = utils_1.RECOMMENDED_GAS_LIMIT.ERC20_DEPOSIT[token]) !== null && _k !== void 0 ? _k : utils_1.RECOMMENDED_GAS_LIMIT.ERC20_DEFAULT_DEPOSIT;
overrides.gasLimit = gasEstimate.gte(recommendedGasLimit) ? gasEstimate : recommendedGasLimit;

@@ -134,11 +137,13 @@ }

async addToken(transaction) {
var _a, _b, _c, _d;
var _a, _b, _c, _d, _e, _f;
const zksyncContract = await this.getMainContract();
const tx = Object.assign((0, utils_1.layer1TxDefaults)(), transaction);
(_a = tx.operatorTip) !== null && _a !== void 0 ? _a : (tx.operatorTip = ethers_1.BigNumber.from(0));
(_b = tx.overrides) !== null && _b !== void 0 ? _b : (tx.overrides = {});
const { ...tx } = transaction;
(_a = tx.opTree) !== null && _a !== void 0 ? _a : (tx.opTree = types_1.PriorityOpTree.Full);
(_b = tx.queueType) !== null && _b !== void 0 ? _b : (tx.queueType = types_1.PriorityQueueType.Deque);
(_c = tx.operatorTip) !== null && _c !== void 0 ? _c : (tx.operatorTip = ethers_1.BigNumber.from(0));
(_d = tx.overrides) !== null && _d !== void 0 ? _d : (tx.overrides = {});
const { token, queueType, opTree, operatorTip, overrides } = tx;
(_c = overrides.gasPrice) !== null && _c !== void 0 ? _c : (overrides.gasPrice = await this._providerL1().getGasPrice());
(_e = overrides.gasPrice) !== null && _e !== void 0 ? _e : (overrides.gasPrice = await this._providerL1().getGasPrice());
const baseCost = ethers_1.BigNumber.from(await zksyncContract.addTokenBaseCost(overrides.gasPrice, queueType, opTree));
(_d = overrides.value) !== null && _d !== void 0 ? _d : (overrides.value = baseCost.add(operatorTip));
(_f = overrides.value) !== null && _f !== void 0 ? _f : (overrides.value = baseCost.add(operatorTip));
await (0, utils_1.checkBaseCost)(baseCost, overrides.value);

@@ -151,11 +156,13 @@ return this._providerL2().getPriorityOpResponse(await zksyncContract.addToken(token, queueType, opTree, {

async requestL1Withdraw(transaction) {
var _a, _b, _c, _d;
var _a, _b, _c, _d, _e, _f;
const zksyncContract = await this.getMainContract();
const tx = Object.assign((0, utils_1.layer1TxDefaults)(), transaction);
(_a = tx.operatorTip) !== null && _a !== void 0 ? _a : (tx.operatorTip = ethers_1.BigNumber.from(0));
(_b = tx.overrides) !== null && _b !== void 0 ? _b : (tx.overrides = {});
const { ...tx } = transaction;
(_a = tx.opTree) !== null && _a !== void 0 ? _a : (tx.opTree = types_1.PriorityOpTree.Full);
(_b = tx.queueType) !== null && _b !== void 0 ? _b : (tx.queueType = types_1.PriorityQueueType.Deque);
(_c = tx.operatorTip) !== null && _c !== void 0 ? _c : (tx.operatorTip = ethers_1.BigNumber.from(0));
(_d = tx.overrides) !== null && _d !== void 0 ? _d : (tx.overrides = {});
const { token, queueType, opTree, operatorTip, overrides, to, amount } = tx;
(_c = overrides.gasPrice) !== null && _c !== void 0 ? _c : (overrides.gasPrice = await this._providerL1().getGasPrice());
(_e = overrides.gasPrice) !== null && _e !== void 0 ? _e : (overrides.gasPrice = await this._providerL1().getGasPrice());
const baseCost = ethers_1.BigNumber.from(await zksyncContract.withdrawBaseCost(overrides.gasPrice, queueType, opTree));
(_d = overrides.value) !== null && _d !== void 0 ? _d : (overrides.value = baseCost.add(operatorTip));
(_f = overrides.value) !== null && _f !== void 0 ? _f : (overrides.value = baseCost.add(operatorTip));
await (0, utils_1.checkBaseCost)(baseCost, overrides.value);

@@ -168,11 +175,13 @@ return this._providerL2().getPriorityOpResponse(await zksyncContract.requestWithdraw(token, amount, to, queueType, opTree, {

async requestL1Execute(transaction) {
var _a, _b, _c, _d;
var _a, _b, _c, _d, _e, _f;
const zksyncContract = await this.getMainContract();
const tx = Object.assign((0, utils_1.layer1TxDefaults)(), transaction);
(_a = tx.operatorTip) !== null && _a !== void 0 ? _a : (tx.operatorTip = ethers_1.BigNumber.from(0));
(_b = tx.overrides) !== null && _b !== void 0 ? _b : (tx.overrides = {});
const { ...tx } = transaction;
(_a = tx.opTree) !== null && _a !== void 0 ? _a : (tx.opTree = types_1.PriorityOpTree.Full);
(_b = tx.queueType) !== null && _b !== void 0 ? _b : (tx.queueType = types_1.PriorityQueueType.Deque);
(_c = tx.operatorTip) !== null && _c !== void 0 ? _c : (tx.operatorTip = ethers_1.BigNumber.from(0));
(_d = tx.overrides) !== null && _d !== void 0 ? _d : (tx.overrides = {});
const { contractAddress, calldata, ergsLimit, queueType, opTree, operatorTip, overrides } = tx;
(_c = overrides.gasPrice) !== null && _c !== void 0 ? _c : (overrides.gasPrice = await this._providerL1().getGasPrice());
(_e = overrides.gasPrice) !== null && _e !== void 0 ? _e : (overrides.gasPrice = await this._providerL1().getGasPrice());
const baseCost = ethers_1.BigNumber.from(await zksyncContract.executeBaseCost(overrides.gasPrice, ergsLimit, ethers_1.ethers.utils.hexDataLength(calldata), queueType, opTree));
(_d = overrides.value) !== null && _d !== void 0 ? _d : (overrides.value = baseCost.add(operatorTip));
(_f = overrides.value) !== null && _f !== void 0 ? _f : (overrides.value = baseCost.add(operatorTip));
await (0, utils_1.checkBaseCost)(baseCost, overrides.value);

@@ -185,11 +194,13 @@ return this._providerL2().getPriorityOpResponse(await zksyncContract.requestExecute(contractAddress, calldata, ergsLimit, queueType, opTree, {

async requestL1DeployContract(transaction) {
var _a, _b, _c, _d;
var _a, _b, _c, _d, _e, _f;
const zksyncContract = await this.getMainContract();
const tx = Object.assign((0, utils_1.layer1TxDefaults)(), transaction);
(_a = tx.operatorTip) !== null && _a !== void 0 ? _a : (tx.operatorTip = ethers_1.BigNumber.from(0));
(_b = tx.overrides) !== null && _b !== void 0 ? _b : (tx.overrides = {});
const { ...tx } = transaction;
(_a = tx.opTree) !== null && _a !== void 0 ? _a : (tx.opTree = types_1.PriorityOpTree.Full);
(_b = tx.queueType) !== null && _b !== void 0 ? _b : (tx.queueType = types_1.PriorityQueueType.Deque);
(_c = tx.operatorTip) !== null && _c !== void 0 ? _c : (tx.operatorTip = ethers_1.BigNumber.from(0));
(_d = tx.overrides) !== null && _d !== void 0 ? _d : (tx.overrides = {});
const { bytecode, calldata, ergsLimit, queueType, opTree, operatorTip, overrides } = tx;
(_c = overrides.gasPrice) !== null && _c !== void 0 ? _c : (overrides.gasPrice = await this._providerL1().getGasPrice());
(_e = overrides.gasPrice) !== null && _e !== void 0 ? _e : (overrides.gasPrice = await this._providerL1().getGasPrice());
const baseCost = ethers_1.BigNumber.from(await zksyncContract.deployContractBaseCost(overrides.gasPrice, ergsLimit, ethers_1.ethers.utils.hexDataLength(bytecode), ethers_1.ethers.utils.hexDataLength(calldata), queueType, opTree));
(_d = overrides.value) !== null && _d !== void 0 ? _d : (overrides.value = baseCost.add(operatorTip));
(_f = overrides.value) !== null && _f !== void 0 ? _f : (overrides.value = baseCost.add(operatorTip));
await (0, utils_1.checkBaseCost)(baseCost, overrides.value);

@@ -196,0 +207,0 @@ return this._providerL2().getPriorityOpResponse(await zksyncContract.requestDeployContract(bytecode, calldata, ergsLimit, queueType, opTree, {

{
"name": "zksync-web3",
"version": "0.3.4",
"version": "0.3.5",
"main": "build/index.js",

@@ -5,0 +5,0 @@ "types": "build/index.d.ts",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc