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.15.4 to 0.15.5

build/abi/ContractDeployer.json

224

abi/IZkSync.json

@@ -185,21 +185,2 @@ {

"internalType": "address",
"name": "oldAllowList",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newAllowList",
"type": "address"
}
],
"name": "NewAllowList",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "oldGovernor",

@@ -223,40 +204,2 @@ "type": "address"

"indexed": true,
"internalType": "bytes32",
"name": "previousBytecodeHash",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "newBytecodeHash",
"type": "bytes32"
}
],
"name": "NewL2BootloaderBytecodeHash",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "previousBytecodeHash",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "newBytecodeHash",
"type": "bytes32"
}
],
"name": "NewL2DefaultAccountBytecodeHash",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",

@@ -419,74 +362,2 @@ "name": "oldPendingGovernor",

"indexed": true,
"internalType": "address",
"name": "oldVerifier",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newVerifier",
"type": "address"
}
],
"name": "NewVerifier",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"components": [
{
"internalType": "bytes32",
"name": "recursionNodeLevelVkHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "recursionLeafLevelVkHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "recursionCircuitsSetVksHash",
"type": "bytes32"
}
],
"indexed": false,
"internalType": "struct VerifierParams",
"name": "oldVerifierParams",
"type": "tuple"
},
{
"components": [
{
"internalType": "bytes32",
"name": "recursionNodeLevelVkHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "recursionLeafLevelVkHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "recursionCircuitsSetVksHash",
"type": "bytes32"
}
],
"indexed": false,
"internalType": "struct VerifierParams",
"name": "newVerifierParams",
"type": "tuple"
}
],
"name": "NewVerifierParams",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",

@@ -1129,2 +1000,15 @@ "name": "proposalId",

"inputs": [],
"name": "getProtocolVersion",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getSecurityCouncil",

@@ -1867,41 +1751,2 @@ "outputs": [

{
"internalType": "contract IAllowList",
"name": "_newAllowList",
"type": "address"
}
],
"name": "setAllowList",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "_l2BootloaderBytecodeHash",
"type": "bytes32"
}
],
"name": "setL2BootloaderBytecodeHash",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "_l2DefaultAccountBytecodeHash",
"type": "bytes32"
}
],
"name": "setL2DefaultAccountBytecodeHash",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",

@@ -1964,45 +1809,2 @@ "name": "_newPendingGovernor",

{
"internalType": "contract Verifier",
"name": "_newVerifier",
"type": "address"
}
],
"name": "setVerifier",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "bytes32",
"name": "recursionNodeLevelVkHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "recursionLeafLevelVkHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "recursionCircuitsSetVksHash",
"type": "bytes32"
}
],
"internalType": "struct VerifierParams",
"name": "_newVerifierParams",
"type": "tuple"
}
],
"name": "setVerifierParams",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",

@@ -2009,0 +1811,0 @@ "name": "_blockNumber",

@@ -1,4 +0,4 @@

import { BigNumber, BigNumberish, BytesLike, ethers } from 'ethers';
import { Provider } from './provider';
import { Address, BalancesMap, BlockTag, Eip712Meta, FullDepositFee, PriorityOpResponse, TransactionResponse } from './types';
import { BigNumber, BigNumberish, BytesLike, ethers } from "ethers";
import { Provider } from "./provider";
import { Address, BalancesMap, BlockTag, Eip712Meta, FullDepositFee, PriorityOpResponse, TransactionResponse } from "./types";
type Constructor<T = {}> = new (...args: any[]) => T;

@@ -5,0 +5,0 @@ interface TxSender {

@@ -10,9 +10,9 @@ "use strict";

_providerL2() {
throw new Error('Must be implemented by the derived class!');
throw new Error("Must be implemented by the derived class!");
}
_providerL1() {
throw new Error('Must be implemented by the derived class!');
throw new Error("Must be implemented by the derived class!");
}
_signerL1() {
throw new Error('Must be implemented by the derived class!');
throw new Error("Must be implemented by the derived class!");
}

@@ -27,3 +27,3 @@ async getMainContract() {

erc20: typechain_1.IL1BridgeFactory.connect(addresses.erc20L1, this._signerL1()),
weth: typechain_1.IL1BridgeFactory.connect(addresses.wethL1, this._signerL1())
weth: typechain_1.IL1BridgeFactory.connect(addresses.wethL1, this._signerL1()),
};

@@ -37,3 +37,3 @@ }

else {
const erc20contract = typechain_1.IERC20MetadataFactory.connect(token, this._providerL1());
const erc20contract = typechain_1.IERC20Factory.connect(token, this._providerL1());
return await erc20contract.balanceOf(await this.getAddress());

@@ -45,3 +45,7 @@ }

const bridgeContracts = await this.getL1BridgeContracts();
const l2WethToken = await bridgeContracts.weth.l2TokenAddress(token);
let l2WethToken = ethers_1.ethers.constants.AddressZero;
try {
l2WethToken = await bridgeContracts.weth.l2TokenAddress(token);
}
catch (e) { }
// If the token is Wrapped Ether, return allowance to its own bridge, otherwise to the default ERC20 bridge.

@@ -53,4 +57,6 @@ bridgeAddress =

}
const erc20contract = typechain_1.IERC20MetadataFactory.connect(token, this._providerL1());
return await erc20contract.allowance(await this.getAddress(), bridgeAddress, { blockTag });
const erc20contract = typechain_1.IERC20Factory.connect(token, this._providerL1());
return await erc20contract.allowance(await this.getAddress(), bridgeAddress, {
blockTag,
});
}

@@ -62,7 +68,10 @@ async l2TokenAddress(token) {

const bridgeContracts = await this.getL1BridgeContracts();
const l2WethToken = await bridgeContracts.weth.l2TokenAddress(token);
// If the token is Wrapped Ether, return its L2 token address.
if (l2WethToken != ethers_1.ethers.constants.AddressZero) {
return l2WethToken;
try {
const l2WethToken = await bridgeContracts.weth.l2TokenAddress(token);
// If the token is Wrapped Ether, return its L2 token address.
if (l2WethToken != ethers_1.ethers.constants.AddressZero) {
return l2WethToken;
}
}
catch (e) { }
return await bridgeContracts.erc20.l2TokenAddress(token);

@@ -75,6 +84,10 @@ }

let bridgeAddress = overrides === null || overrides === void 0 ? void 0 : overrides.bridgeAddress;
const erc20contract = typechain_1.IERC20MetadataFactory.connect(token, this._signerL1());
const erc20contract = typechain_1.IERC20Factory.connect(token, this._signerL1());
if (bridgeAddress == null) {
const bridgeContracts = await this.getL1BridgeContracts();
const l2WethToken = await bridgeContracts.weth.l2TokenAddress(token);
let l2WethToken = ethers_1.ethers.constants.AddressZero;
try {
l2WethToken = await bridgeContracts.weth.l2TokenAddress(token);
}
catch (e) { }
// If the token is Wrapped Ether, return corresponding bridge, otherwise return default ERC20 bridge

@@ -114,3 +127,7 @@ bridgeAddress =

if (transaction.approveERC20) {
const l2WethToken = await bridgeContracts.weth.l2TokenAddress(transaction.token);
let l2WethToken = ethers_1.ethers.constants.AddressZero;
try {
l2WethToken = await bridgeContracts.weth.l2TokenAddress(transaction.token);
}
catch (e) { }
// If the token is Wrapped Ether, use its bridge.

@@ -120,3 +137,5 @@ const proposedBridge = l2WethToken != ethers_1.ethers.constants.AddressZero

: bridgeContracts.erc20.address;
const bridgeAddress = transaction.bridgeAddress ? transaction.bridgeAddress : proposedBridge;
const bridgeAddress = transaction.bridgeAddress
? transaction.bridgeAddress
: proposedBridge;
// We only request the allowance if the current one is not enough.

@@ -127,3 +146,3 @@ const allowance = await this.getAllowanceL1(transaction.token, bridgeAddress);

bridgeAddress,
...transaction.approveOverrides
...transaction.approveOverrides,
});

@@ -163,3 +182,3 @@ await approveTx.wait();

const customBridgeData = ((_e = tx.customBridgeData) !== null && _e !== void 0 ? _e : bridgeContracts.weth.address == tx.bridgeAddress)
? '0x'
? "0x"
: await (0, utils_1.getERC20DefaultBridgeData)(tx.token, this._providerL1());

@@ -182,3 +201,3 @@ const bridge = typechain_1.IL1BridgeFactory.connect(tx.bridgeAddress, this._signerL1());

contractAddress: to,
calldata: '0x',
calldata: "0x",
l2Value: amount,

@@ -188,3 +207,3 @@ // For some reason typescript can not deduce that we've already set the

l2GasLimit: tx.l2GasLimit,
...tx
...tx,
};

@@ -194,14 +213,13 @@ }

let refundRecipient = (_j = tx.refundRecipient) !== null && _j !== void 0 ? _j : ethers_1.ethers.constants.AddressZero;
const args = [
to,
token,
amount,
tx.l2GasLimit,
tx.gasPerPubdataByte,
refundRecipient
];
const args = [to, token, amount, tx.l2GasLimit, tx.gasPerPubdataByte, refundRecipient];
(_k = overrides.value) !== null && _k !== void 0 ? _k : (overrides.value = baseCost.add(operatorTip));
await (0, utils_1.checkBaseCost)(baseCost, overrides.value);
const l2WethToken = await bridgeContracts.weth.l2TokenAddress(tx.token);
const bridge = l2WethToken != ethers_1.ethers.constants.AddressZero ? bridgeContracts.weth : bridgeContracts.erc20;
let l2WethToken = ethers_1.ethers.constants.AddressZero;
try {
l2WethToken = await bridgeContracts.weth.l2TokenAddress(tx.token);
}
catch (e) { }
const bridge = l2WethToken != ethers_1.ethers.constants.AddressZero
? bridgeContracts.weth
: bridgeContracts.erc20;
return await bridge.populateTransaction.deposit(...args, overrides);

@@ -215,3 +233,3 @@ }

// It is assumed that the L2 fee for the transaction does not depend on its value.
const dummyAmount = '1';
const dummyAmount = "1";
const { ...tx } = transaction;

@@ -224,7 +242,7 @@ const zksyncContract = await this.getMainContract();

(_c = tx.gasPerPubdataByte) !== null && _c !== void 0 ? _c : (tx.gasPerPubdataByte = utils_1.REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT);
let l2GasLimit;
let l2GasLimit = null;
if (tx.bridgeAddress != null) {
const bridgeContracts = await this.getL1BridgeContracts();
const customBridgeData = ((_d = tx.customBridgeData) !== null && _d !== void 0 ? _d : bridgeContracts.weth.address == tx.bridgeAddress)
? '0x'
? "0x"
: await (0, utils_1.getERC20DefaultBridgeData)(tx.token, this._providerL1());

@@ -240,3 +258,3 @@ let bridge = typechain_1.IL1BridgeFactory.connect(tx.bridgeAddress, this._signerL1());

const selfBalanceETH = await this.getBalanceL1();
// We could 0 in, because the final fee will anyway be bigger than
// We could use 0, because the final fee will anyway be bigger than
if (baseCost.gte(selfBalanceETH.add(dummyAmount))) {

@@ -252,3 +270,3 @@ const recommendedETHBalance = ethers_1.BigNumber.from(tx.token == utils_1.ETH_ADDRESS

// For ETH token the value that the user passes to the estimation is the one which has the
// value for the L2 comission substracted.
// value for the L2 commission substracted.
let amountForEstimate;

@@ -261,3 +279,3 @@ if ((0, utils_1.isETH)(tx.token)) {

if ((await this.getAllowanceL1(tx.token)) < amountForEstimate) {
throw new Error('Not enough allowance to cover the deposit');
throw new Error("Not enough allowance to cover the deposit");
}

@@ -276,3 +294,3 @@ }

overrides: estimationOverrides,
l2GasLimit
l2GasLimit,
});

@@ -282,3 +300,3 @@ const fullCost = {

l1GasLimit,
l2GasLimit
l2GasLimit,
};

@@ -298,6 +316,6 @@ if (tx.overrides.gasPrice) {

const log = receipt.logs.filter((log) => log.address == utils_1.L1_MESSENGER_ADDRESS &&
log.topics[0] == ethers_1.ethers.utils.id('L1MessageSent(address,bytes32,bytes)'))[index];
log.topics[0] == ethers_1.ethers.utils.id("L1MessageSent(address,bytes32,bytes)"))[index];
return {
log,
l1BatchTxId: receipt.l1BatchTxIndex
l1BatchTxId: receipt.l1BatchTxIndex,
};

@@ -312,3 +330,3 @@ }

l2ToL1LogIndex,
l2ToL1Log
l2ToL1Log,
};

@@ -321,3 +339,3 @@ }

const proof = await this._providerL2().getLogProof(withdrawalHash, l2ToL1LogIndex);
const message = ethers_1.ethers.utils.defaultAbiCoder.decode(['bytes'], log.data)[0];
const message = ethers_1.ethers.utils.defaultAbiCoder.decode(["bytes"], log.data)[0];
return {

@@ -329,7 +347,7 @@ l1BatchNumber: log.l1BatchNumber,

sender,
proof: proof.proof
proof: proof.proof,
};
}
async finalizeWithdrawal(withdrawalHash, index = 0, overrides) {
const { l1BatchNumber, l2MessageIndex, l2TxNumberInBlock, message, sender, proof } = await this.finalizeWithdrawalParams(withdrawalHash, index);
const { l1BatchNumber, l2MessageIndex, l2TxNumberInBlock, message, sender, proof, } = await this.finalizeWithdrawalParams(withdrawalHash, index);
if ((0, utils_1.isETH)(sender)) {

@@ -370,6 +388,7 @@ const withdrawTo = ethers_1.ethers.utils.hexDataSlice(message, 4, 24);

const receipt = await this._providerL2().getTransactionReceipt(ethers_1.ethers.utils.hexlify(depositHash));
const successL2ToL1LogIndex = receipt.l2ToL1Logs.findIndex((l2ToL1log) => l2ToL1log.sender == utils_1.BOOTLOADER_FORMAL_ADDRESS && l2ToL1log.key == depositHash);
const successL2ToL1LogIndex = receipt.l2ToL1Logs.findIndex((l2ToL1log) => l2ToL1log.sender == utils_1.BOOTLOADER_FORMAL_ADDRESS &&
l2ToL1log.key == depositHash);
const successL2ToL1Log = receipt.l2ToL1Logs[successL2ToL1LogIndex];
if (successL2ToL1Log.value != ethers_1.ethers.constants.HashZero) {
throw new Error('Cannot claim successful deposit');
throw new Error("Cannot claim successful deposit");
}

@@ -382,5 +401,5 @@ const tx = await this._providerL2().getTransaction(ethers_1.ethers.utils.hexlify(depositHash));

const l2Bridge = typechain_1.IL2BridgeFactory.connect(l2BridgeAddress, this._providerL2());
const calldata = l2Bridge.interface.decodeFunctionData('finalizeDeposit', tx.data);
const calldata = l2Bridge.interface.decodeFunctionData("finalizeDeposit", tx.data);
const proof = await this._providerL2().getLogProof(depositHash, successL2ToL1LogIndex);
return await l1Bridge.claimFailedDeposit(calldata['_l1Sender'], calldata['_l1Token'], depositHash, receipt.l1BatchNumber, proof.id, receipt.l1BatchTxIndex, proof.proof, overrides !== null && overrides !== void 0 ? overrides : {});
return await l1Bridge.claimFailedDeposit(calldata["_l1Sender"], calldata["_l1Token"], depositHash, receipt.l1BatchNumber, proof.id, receipt.l1BatchTxIndex, proof.proof, overrides !== null && overrides !== void 0 ? overrides : {});
}

@@ -409,3 +428,3 @@ async requestExecute(transaction) {

(_g = tx.l2GasLimit) !== null && _g !== void 0 ? _g : (tx.l2GasLimit = await this._providerL2().estimateL1ToL2Execute(transaction));
const { contractAddress, l2Value, calldata, l2GasLimit, factoryDeps, operatorTip, overrides, gasPerPubdataByte, refundRecipient } = tx;
const { contractAddress, l2Value, calldata, l2GasLimit, factoryDeps, operatorTip, overrides, gasPerPubdataByte, refundRecipient, } = tx;
await insertGasPrice(this._providerL1(), overrides);

@@ -416,3 +435,3 @@ const gasPriceForEstimation = overrides.maxFeePerGas || overrides.gasPrice;

gasPerPubdataByte,
gasLimit: l2GasLimit
gasLimit: l2GasLimit,
});

@@ -429,8 +448,8 @@ (_h = overrides.value) !== null && _h !== void 0 ? _h : (overrides.value = baseCost.add(operatorTip).add(l2Value));

_providerL2() {
throw new Error('Must be implemented by the derived class!');
throw new Error("Must be implemented by the derived class!");
}
_signerL2() {
throw new Error('Must be implemented by the derived class!');
throw new Error("Must be implemented by the derived class!");
}
async getBalance(token, blockTag = 'committed') {
async getBalance(token, blockTag = "committed") {
return await this._providerL2().getBalance(await this.getAddress(), blockTag, token);

@@ -445,3 +464,3 @@ }

erc20: typechain_1.IL2BridgeFactory.connect(addresses.erc20L2, this._signerL2()),
weth: typechain_1.IL2BridgeFactory.connect(addresses.wethL2, this._signerL2())
weth: typechain_1.IL2BridgeFactory.connect(addresses.wethL2, this._signerL2()),
};

@@ -459,3 +478,3 @@ }

from: await this.getAddress(),
...transaction
...transaction,
});

@@ -468,3 +487,3 @@ const txResponse = await this.sendTransaction(withdrawTx);

from: await this.getAddress(),
...transaction
...transaction,
});

@@ -484,8 +503,7 @@ const txResponse = await this.sendTransaction(transferTx);

const baseFee = l1FeeData.lastBaseFeePerGas || l1FeeData.gasPrice;
// ethers.js by default uses multiplcation by 2, but since the price for the L2 part
// ethers.js by default uses multiplication by 2, but since the price for the L2 part
// will depend on the L1 part, doubling base fee is typically too much.
const maxFeePerGas = baseFee.mul(3).div(2).add(l1FeeData.maxPriorityFeePerGas);
overrides.maxFeePerGas = maxFeePerGas;
overrides.maxFeePerGas = baseFee.mul(3).div(2).add(l1FeeData.maxPriorityFeePerGas);
overrides.maxPriorityFeePerGas = l1FeeData.maxPriorityFeePerGas;
}
}

@@ -1,6 +0,6 @@

import { Wallet } from './wallet';
import { Signer } from './signer';
import { Contract, ContractInterface, ethers } from 'ethers';
import { DeploymentType } from './types';
export { Contract } from 'ethers';
import { Wallet } from "./wallet";
import { Signer } from "./signer";
import { Contract, ContractInterface, ethers } from "ethers";
import { DeploymentType } from "./types";
export { Contract } from "ethers";
export declare class ContractFactory extends ethers.ContractFactory {

@@ -7,0 +7,0 @@ readonly signer: Wallet | Signer;

@@ -12,14 +12,18 @@ "use strict";

super(abi, bytecode, signer);
this.deploymentType = deploymentType || 'create';
this.deploymentType = deploymentType || "create";
}
encodeCalldata(salt, bytecodeHash, constructorCalldata) {
if (this.deploymentType == 'create') {
return utils_1.CONTRACT_DEPLOYER.encodeFunctionData('create', [salt, bytecodeHash, constructorCalldata]);
if (this.deploymentType == "create") {
return utils_1.CONTRACT_DEPLOYER.encodeFunctionData("create", [
salt,
bytecodeHash,
constructorCalldata,
]);
}
else if (this.deploymentType == 'createAccount') {
return utils_1.CONTRACT_DEPLOYER.encodeFunctionData('createAccount', [
else if (this.deploymentType == "createAccount") {
return utils_1.CONTRACT_DEPLOYER.encodeFunctionData("createAccount", [
salt,
bytecodeHash,
constructorCalldata,
types_1.AccountAbstractionVersion.Version1
types_1.AccountAbstractionVersion.Version1,
]);

@@ -35,3 +39,3 @@ }

// TODO (SMA-1585): Users should be able to provide the salt.
let salt = '0x0000000000000000000000000000000000000000000000000000000000000000';
let salt = "0x0000000000000000000000000000000000000000000000000000000000000000";
// The overrides will be popped out in this call:

@@ -64,3 +68,3 @@ const txRequest = super.getDeployTransaction(...args);

const contractWithCorrectAddress = new ethers_1.ethers.Contract(deployedAddresses[deployedAddresses.length - 1], contract.interface, contract.signer);
ethers_1.utils.defineReadOnly(contractWithCorrectAddress, 'deployTransaction', contract.deployTransaction);
ethers_1.utils.defineReadOnly(contractWithCorrectAddress, "deployTransaction", contract.deployTransaction);
return contractWithCorrectAddress;

@@ -67,0 +71,0 @@ }

@@ -1,6 +0,6 @@

export * as utils from './utils';
export * as types from './types';
export { EIP712Signer, Signer, L1Signer, L1VoidSigner, L2VoidSigner } from './signer';
export { Wallet } from './wallet';
export { Web3Provider, Provider } from './provider';
export { ContractFactory, Contract } from './contract';
export * as utils from "./utils";
export * as types from "./types";
export { EIP712Signer, Signer, L1Signer, L1VoidSigner, L2VoidSigner } from "./signer";
export { Wallet } from "./wallet";
export { Web3Provider, Provider } from "./provider";
export { ContractFactory, Contract } from "./contract";

@@ -1,3 +0,3 @@

import { BytesLike, ethers } from 'ethers';
import { Address, ApprovalBasedPaymasterInput, GeneralPaymasterInput, PaymasterInput, PaymasterParams } from './types';
import { BytesLike, ethers } from "ethers";
import { Address, ApprovalBasedPaymasterInput, GeneralPaymasterInput, PaymasterInput, PaymasterParams } from "./types";
export declare const IPaymasterFlow: ethers.utils.Interface;

@@ -4,0 +4,0 @@ export declare function getApprovalBasedPaymasterInput(paymasterInput: ApprovalBasedPaymasterInput): BytesLike;

@@ -5,8 +5,8 @@ "use strict";

const ethers_1 = require("ethers");
exports.IPaymasterFlow = new ethers_1.ethers.utils.Interface(require('../../abi/IPaymasterFlow.json').abi);
exports.IPaymasterFlow = new ethers_1.ethers.utils.Interface(require("../abi/IPaymasterFlow.json").abi);
function getApprovalBasedPaymasterInput(paymasterInput) {
return exports.IPaymasterFlow.encodeFunctionData('approvalBased', [
return exports.IPaymasterFlow.encodeFunctionData("approvalBased", [
paymasterInput.token,
paymasterInput.minimalAllowance,
paymasterInput.innerInput
paymasterInput.innerInput,
]);

@@ -16,10 +16,10 @@ }

function getGeneralPaymasterInput(paymasterInput) {
return exports.IPaymasterFlow.encodeFunctionData('general', [paymasterInput.innerInput]);
return exports.IPaymasterFlow.encodeFunctionData("general", [paymasterInput.innerInput]);
}
exports.getGeneralPaymasterInput = getGeneralPaymasterInput;
function getPaymasterParams(paymasterAddress, paymasterInput) {
if (paymasterInput.type == 'General') {
if (paymasterInput.type == "General") {
return {
paymaster: paymasterAddress,
paymasterInput: getGeneralPaymasterInput(paymasterInput)
paymasterInput: getGeneralPaymasterInput(paymasterInput),
};

@@ -30,3 +30,3 @@ }

paymaster: paymasterAddress,
paymasterInput: getApprovalBasedPaymasterInput(paymasterInput)
paymasterInput: getApprovalBasedPaymasterInput(paymasterInput),
};

@@ -33,0 +33,0 @@ }

@@ -1,7 +0,7 @@

import { ethers, BigNumber, BigNumberish, utils, providers, BytesLike } from 'ethers';
import { BigNumber, BigNumberish, BytesLike, ethers, providers, utils } from "ethers";
import { ExternalProvider } from "@ethersproject/providers";
import { ConnectionInfo } from "@ethersproject/web";
import { Address, BalancesMap, BatchDetails, Block, BlockDetails, BlockTag, BlockWithTransactions, ContractAccountInfo, EventFilter, Log, MessageProof, PriorityOpResponse, Token, TransactionDetails, TransactionReceipt, TransactionRequest, TransactionResponse, TransactionStatus } from "./types";
import { Signer } from "./signer";
import Formatter = providers.Formatter;
import { ExternalProvider } from '@ethersproject/providers';
import { ConnectionInfo } from '@ethersproject/web';
import { Address, EventFilter, BlockTag, TransactionResponse, TransactionRequest, TransactionStatus, Token, PriorityOpResponse, BalancesMap, MessageProof, TransactionReceipt, Block, BlockWithTransactions, Log, TransactionDetails, BatchDetails, BlockDetails, ContractAccountInfo } from './types';
import { Signer } from './signer';
export declare class Provider extends ethers.providers.JsonRpcProvider {

@@ -21,3 +21,3 @@ private static _nextPollId;

static getFormatter(): Formatter;
getBalance(address: Address, blockTag?: BlockTag, tokenAddress?: Address): Promise<ethers.BigNumber>;
getBalance(address: Address, blockTag?: BlockTag, tokenAddress?: Address): Promise<BigNumber>;
l2TokenAddress(token: Address): Promise<string>;

@@ -117,3 +117,3 @@ l1TokenAddress(token: Address): Promise<string>;

getSigner(addressOrIndex?: number | string): Signer;
estimateGas(transaction: ethers.utils.Deferrable<TransactionRequest>): Promise<ethers.BigNumber>;
estimateGas(transaction: ethers.utils.Deferrable<TransactionRequest>): Promise<BigNumber>;
}

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

const ethers_1 = require("ethers");
var Formatter = ethers_1.providers.Formatter;
const web_1 = require("@ethersproject/web");

@@ -12,2 +11,3 @@ const typechain_1 = require("../typechain");

const signer_1 = require("./signer");
var Formatter = ethers_1.providers.Formatter;
let defaultFormatter = null;

@@ -27,3 +27,3 @@ class Provider extends ethers_1.ethers.providers.JsonRpcProvider {

catch (error) {
this.emit('error', error);
this.emit("error", error);
return;

@@ -33,6 +33,6 @@ }

// Emit a poll event after we have the latest (fast) block number
this.emit('poll', pollId, blockNumber);
this.emit("poll", pollId, blockNumber);
// If the block has not changed, meh.
if (blockNumber === this._lastBlockNumber) {
this.emit('didPoll', pollId);
this.emit("didPoll", pollId);
return;

@@ -46,8 +46,8 @@ }

console.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber=${blockNumber})`);
this.emit('error', {
this.emit("error", {
blockNumber: blockNumber,
event: 'blockSkew',
previousBlockNumber: this._emitted.block
event: "blockSkew",
previousBlockNumber: this._emitted.block,
});
this.emit('block', blockNumber);
this.emit("block", blockNumber);
}

@@ -57,3 +57,3 @@ else {

for (let i = this._emitted.block + 1; i <= blockNumber; i++) {
this.emit('block', i);
this.emit("block", i);
}

@@ -66,3 +66,3 @@ }

// The block event does not expire
if (key === 'block') {
if (key === "block") {
return;

@@ -75,7 +75,7 @@ }

// "pending" events
if (eventBlockNumber === 'pending') {
if (eventBlockNumber === "pending") {
return;
}
// Evict any transaction hashes or block hashes over 12 blocks
// old, since they should not return null anyways
// old, since they should not return null anyway
if (blockNumber - eventBlockNumber > 12) {

@@ -93,3 +93,3 @@ delete this._emitted[key];

switch (event.type) {
case 'tx': {
case "tx": {
const hash = event.hash;

@@ -105,6 +105,7 @@ let runner = this.getTransactionReceipt(hash)

if (receipt.blockNumber == null &&
!(receipt.status != null && ethers_1.BigNumber.from(receipt.status).isZero())) {
!(receipt.status != null &&
ethers_1.BigNumber.from(receipt.status).isZero())) {
return null;
}
this._emitted['t:' + hash] = receipt.blockNumber;
this._emitted["t:" + hash] = receipt.blockNumber;
this.emit(hash, receipt);

@@ -114,3 +115,3 @@ return null;

.catch((error) => {
this.emit('error', error);
this.emit("error", error);
});

@@ -120,3 +121,3 @@ runners.push(runner);

}
case 'filter': {
case "filter": {
// We only allow a single getLogs to be in-flight at a time

@@ -133,7 +134,7 @@ if (!event._inflight) {

// indexing events, a logs result with 0 entries cannot be
// trusted and we must retry a range which includes it again
// trusted, and we must retry a range which includes it again
const filter = event.filter;
filter.fromBlock = event._lastBlockNumber + 1;
filter.toBlock = blockNumber;
// Prevent fitler ranges from growing too wild, since it is quite
// Prevent file ranges from growing too wild, since it is quite
// likely there just haven't been any events to move the lastBlockNumber.

@@ -161,4 +162,5 @@ const minFromBlock = filter.toBlock - this._maxFilterBlockRange;

// Make sure we stall requests to fetch blocks and txs
this._emitted['b:' + log.blockHash] = log.blockNumber;
this._emitted['t:' + log.transactionHash] = log.blockNumber;
this._emitted["b:" + log.blockHash] = log.blockNumber;
this._emitted["t:" + log.transactionHash] =
log.blockNumber;
this.emit(filter, log);

@@ -168,3 +170,3 @@ });

.catch((error) => {
this.emit('error', error);
this.emit("error", error);
// Allow another getLogs (the range was not updated)

@@ -183,6 +185,6 @@ event._inflight = false;

.then(() => {
this.emit('didPoll', pollId);
this.emit("didPoll", pollId);
})
.catch((error) => {
this.emit('error', error);
this.emit("error", error);
});

@@ -194,7 +196,9 @@ return;

transactionHash = await transactionHash;
const params = { transactionHash: this.formatter.hash(transactionHash, true) };
const params = {
transactionHash: this.formatter.hash(transactionHash, true),
};
return (0, web_1.poll)(async () => {
const result = await this.perform('getTransactionReceipt', params);
const result = await this.perform("getTransactionReceipt", params);
if (result == null) {
if (this._emitted['t:' + transactionHash] === undefined) {
if (this._emitted["t:" + transactionHash] === undefined) {
return null;

@@ -204,3 +208,5 @@ }

}
if (result.blockNumber == null && result.status != null && ethers_1.BigNumber.from(result.status).isZero()) {
if (result.blockNumber == null &&
result.status != null &&
ethers_1.BigNumber.from(result.status).isZero()) {
// transaction is rejected in the state-keeper

@@ -212,3 +218,3 @@ return {

blockNumber: 0,
blockHash: ethers_1.ethers.constants.HashZero
blockHash: ethers_1.ethers.constants.HashZero,
}),

@@ -218,3 +224,3 @@ blockNumber: null,

l1BatchNumber: null,
l1BatchTxIndex: null
l1BatchTxIndex: null,
};

@@ -270,3 +276,3 @@ }

txIndexInL1Batch: Formatter.allowNull(number),
logIndex: number
logIndex: number,
};

@@ -278,4 +284,6 @@ defaultFormatter.formats.receipt.l1BatchNumber = Formatter.allowNull(number);

defaultFormatter.formats.block.l1BatchTimestamp = Formatter.allowNull(number);
defaultFormatter.formats.blockWithTransactions.l1BatchNumber = Formatter.allowNull(number);
defaultFormatter.formats.blockWithTransactions.l1BatchTimestamp = Formatter.allowNull(number);
defaultFormatter.formats.blockWithTransactions.l1BatchNumber =
Formatter.allowNull(number);
defaultFormatter.formats.blockWithTransactions.l1BatchTimestamp =
Formatter.allowNull(number);
defaultFormatter.formats.transaction.l1BatchNumber = Formatter.allowNull(number);

@@ -295,3 +303,3 @@ defaultFormatter.formats.transaction.l1BatchTxIndex = Formatter.allowNull(number);

try {
let token = typechain_1.IERC20MetadataFactory.connect(tokenAddress, this);
let token = typechain_1.IERC20Factory.connect(tokenAddress, this);
return await token.balanceOf(address, { blockTag: tag });

@@ -310,7 +318,10 @@ }

const l2WethBridge = typechain_1.IL2BridgeFactory.connect(bridgeAddresses.wethL2, this);
const l2WethToken = await l2WethBridge.l2TokenAddress(token);
// If the token is Wrapped Ether, return its L2 token address
if (l2WethToken != ethers_1.ethers.constants.AddressZero) {
return l2WethToken;
try {
const l2WethToken = await l2WethBridge.l2TokenAddress(token);
// If the token is Wrapped Ether, return its L2 token address
if (l2WethToken != ethers_1.ethers.constants.AddressZero) {
return l2WethToken;
}
}
catch (e) { }
const l2Erc20Bridge = typechain_1.IL2BridgeFactory.connect(bridgeAddresses.erc20L2, this);

@@ -325,7 +336,10 @@ return await l2Erc20Bridge.l2TokenAddress(token);

const l2WethBridge = typechain_1.IL2BridgeFactory.connect(bridgeAddresses.wethL2, this);
const l1WethToken = await l2WethBridge.l1TokenAddress(token);
// If the token is Wrapped Ether, return its L1 token address
if (l1WethToken != ethers_1.ethers.constants.AddressZero) {
return l1WethToken;
try {
const l1WethToken = await l2WethBridge.l1TokenAddress(token);
// If the token is Wrapped Ether, return its L1 token address
if (l1WethToken != ethers_1.ethers.constants.AddressZero) {
return l1WethToken;
}
}
catch (e) { }
const erc20Bridge = typechain_1.IL2BridgeFactory.connect(bridgeAddresses.erc20L2, this);

@@ -343,3 +357,3 @@ return await erc20Bridge.l1TokenAddress(token);

customData: true,
from: true
from: true,
});

@@ -350,3 +364,3 @@ if (transaction.customData == null) {

result.eip712Meta = {
gasPerPubdata: ethers_1.utils.hexValue((_a = transaction.customData.gasPerPubdata) !== null && _a !== void 0 ? _a : 0)
gasPerPubdata: ethers_1.utils.hexValue((_a = transaction.customData.gasPerPubdata) !== null && _a !== void 0 ? _a : 0),
};

@@ -365,3 +379,3 @@ transaction.type = utils_1.EIP712_TX_TYPE;

paymaster: ethers_1.utils.hexlify(transaction.customData.paymasterParams.paymaster),
paymasterInput: Array.from(ethers_1.utils.arrayify(transaction.customData.paymasterParams.paymasterInput))
paymasterInput: Array.from(ethers_1.utils.arrayify(transaction.customData.paymasterParams.paymasterInput)),
};

@@ -374,3 +388,3 @@ }

const params = await ethers_1.utils.resolveProperties({
transaction: this._getTransactionRequest(transaction)
transaction: this._getTransactionRequest(transaction),
});

@@ -381,3 +395,3 @@ if (transaction.customData != null) {

}
const result = await this.perform('estimateGas', params);
const result = await this.perform("estimateGas", params);
try {

@@ -393,3 +407,3 @@ return ethers_1.BigNumber.from(result);

const params = await ethers_1.utils.resolveProperties({
transaction: this._getTransactionRequest(transaction)
transaction: this._getTransactionRequest(transaction),
});

@@ -400,4 +414,4 @@ if (transaction.customData != null) {

}
const result = await this.send('zks_estimateGasL1ToL2', [
Provider.hexlifyTransaction(params.transaction, { from: true })
const result = await this.send("zks_estimateGasL1ToL2", [
Provider.hexlifyTransaction(params.transaction, { from: true }),
]);

@@ -413,3 +427,3 @@ try {

const params = token ? [token] : [];
const price = await this.send('eth_gasPrice', params);
const price = await this.send("eth_gasPrice", params);
return ethers_1.BigNumber.from(price);

@@ -422,3 +436,3 @@ }

this.formatter.blockTag = (tag) => {
if (tag == 'committed' || tag == 'finalized') {
if (tag == "committed" || tag == "finalized") {
return tag;

@@ -432,14 +446,14 @@ }

async getMessageProof(blockNumber, sender, messageHash, logIndex) {
return await this.send('zks_getL2ToL1MsgProof', [
return await this.send("zks_getL2ToL1MsgProof", [
ethers_1.BigNumber.from(blockNumber).toNumber(),
sender,
ethers_1.ethers.utils.hexlify(messageHash),
logIndex
logIndex,
]);
}
async getLogProof(txHash, index) {
return await this.send('zks_getL2ToL1LogProof', [ethers_1.ethers.utils.hexlify(txHash), index]);
return await this.send("zks_getL2ToL1LogProof", [ethers_1.ethers.utils.hexlify(txHash), index]);
}
async getL1BatchBlockRange(l1BatchNumber) {
const range = await this.send('zks_getL1BatchBlockRange', [l1BatchNumber]);
const range = await this.send("zks_getL1BatchBlockRange", [l1BatchNumber]);
if (range == null) {

@@ -452,3 +466,3 @@ return null;

if (!this.contractAddresses.mainContract) {
this.contractAddresses.mainContract = await this.send('zks_getMainContract', []);
this.contractAddresses.mainContract = await this.send("zks_getMainContract", []);
}

@@ -459,8 +473,8 @@ return this.contractAddresses.mainContract;

// Unlike contract's addresses, the testnet paymaster is not cached, since it can be trivially changed
// on the fly by the server and should not be relied to be constant
return await this.send('zks_getTestnetPaymaster', []);
// on the fly by the server and should not be relied on to be constant
return await this.send("zks_getTestnetPaymaster", []);
}
async getDefaultBridgeAddresses() {
if (!this.contractAddresses.erc20BridgeL1) {
let addresses = await this.send('zks_getBridgeContracts', []);
let addresses = await this.send("zks_getBridgeContracts", []);
this.contractAddresses.erc20BridgeL1 = addresses.l1Erc20DefaultBridge;

@@ -475,14 +489,14 @@ this.contractAddresses.erc20BridgeL2 = addresses.l2Erc20DefaultBridge;

wethL1: this.contractAddresses.wethBridgeL1,
wethL2: this.contractAddresses.wethBridgeL2
wethL2: this.contractAddresses.wethBridgeL2,
};
}
async getConfirmedTokens(start = 0, limit = 255) {
const tokens = await this.send('zks_getConfirmedTokens', [start, limit]);
const tokens = await this.send("zks_getConfirmedTokens", [start, limit]);
return tokens.map((token) => ({ address: token.l2Address, ...token }));
}
async getTokenPrice(token) {
return await this.send('zks_getTokenPrice', [token]);
return await this.send("zks_getTokenPrice", [token]);
}
async getAllAccountBalances(address) {
let balances = await this.send('zks_getAllAccountBalances', [address]);
let balances = await this.send("zks_getAllAccountBalances", [address]);
for (let token in balances) {

@@ -494,17 +508,17 @@ balances[token] = ethers_1.BigNumber.from(balances[token]);

async l1ChainId() {
const res = await this.send('zks_L1ChainId', []);
const res = await this.send("zks_L1ChainId", []);
return ethers_1.BigNumber.from(res).toNumber();
}
async getL1BatchNumber() {
const number = await this.send('zks_L1BatchNumber', []);
const number = await this.send("zks_L1BatchNumber", []);
return ethers_1.BigNumber.from(number).toNumber();
}
async getL1BatchDetails(number) {
return await this.send('zks_getL1BatchDetails', [number]);
return await this.send("zks_getL1BatchDetails", [number]);
}
async getBlockDetails(number) {
return await this.send('zks_getBlockDetails', [number]);
return await this.send("zks_getBlockDetails", [number]);
}
async getTransactionDetails(txHash) {
return await this.send('zks_getTransactionDetails', [txHash]);
return await this.send("zks_getTransactionDetails", [txHash]);
}

@@ -516,3 +530,3 @@ async getWithdrawTx(transaction) {

if (tx.to == null && tx.from == null) {
throw new Error('withdrawal target address is undefined');
throw new Error("withdrawal target address is undefined");
}

@@ -530,3 +544,3 @@ (_a = tx.to) !== null && _a !== void 0 ? _a : (tx.to = tx.from);

// as the value
throw new Error('The tx.value is not equal to the value withdrawn');
throw new Error("The tx.value is not equal to the value withdrawn");
}

@@ -539,5 +553,11 @@ const ethL2Token = typechain_1.IEthTokenFactory.connect(utils_1.L2_ETH_TOKEN_ADDRESS, this);

const l2WethBridge = typechain_1.IL2BridgeFactory.connect(bridgeAddresses.wethL2, this);
const l1WethToken = await l2WethBridge.l1TokenAddress(tx.token);
let l1WethToken = ethers_1.ethers.constants.AddressZero;
try {
l1WethToken = await l2WethBridge.l1TokenAddress(tx.token);
}
catch (e) { }
tx.bridgeAddress =
l1WethToken != ethers_1.ethers.constants.AddressZero ? bridgeAddresses.wethL2 : bridgeAddresses.erc20L2;
l1WethToken != ethers_1.ethers.constants.AddressZero
? bridgeAddresses.wethL2
: bridgeAddresses.erc20L2;
}

@@ -561,7 +581,7 @@ const bridge = typechain_1.IL2BridgeFactory.connect(tx.bridgeAddress, this);

to: tx.to,
value: tx.amount
value: tx.amount,
};
}
else {
const token = typechain_1.IERC20MetadataFactory.connect(tx.token, this);
const token = typechain_1.IERC20Factory.connect(tx.token, this);
return await token.populateTransaction.transfer(tx.to, tx.amount, tx.overrides);

@@ -576,24 +596,24 @@ }

// TODO (SMA-1606): Add different urls for different networks.
return new Provider(process.env.ZKSYNC_WEB3_API_URL || 'http://localhost:3050');
return new Provider(process.env.ZKSYNC_WEB3_API_URL || "http://localhost:3050");
}
async newFilter(filter) {
filter = await filter;
const id = await this.send('eth_newFilter', [this._prepareFilter(filter)]);
const id = await this.send("eth_newFilter", [this._prepareFilter(filter)]);
return ethers_1.BigNumber.from(id);
}
async newBlockFilter() {
const id = await this.send('eth_newBlockFilter', []);
const id = await this.send("eth_newBlockFilter", []);
return ethers_1.BigNumber.from(id);
}
async newPendingTransactionsFilter() {
const id = await this.send('eth_newPendingTransactionFilter', []);
const id = await this.send("eth_newPendingTransactionFilter", []);
return ethers_1.BigNumber.from(id);
}
async getFilterChanges(idx) {
const logs = await this.send('eth_getFilterChanges', [idx.toHexString()]);
return typeof logs[0] === 'string' ? logs : this._parseLogs(logs);
const logs = await this.send("eth_getFilterChanges", [idx.toHexString()]);
return typeof logs[0] === "string" ? logs : this._parseLogs(logs);
}
async getLogs(filter = {}) {
filter = await filter;
const logs = await this.send('eth_getLogs', [this._prepareFilter(filter)]);
const logs = await this.send("eth_getLogs", [this._prepareFilter(filter)]);
return this._parseLogs(logs);

@@ -608,3 +628,3 @@ }

fromBlock: filter.fromBlock == null ? null : this.formatter.blockTag(filter.fromBlock),
toBlock: filter.fromBlock == null ? null : this.formatter.blockTag(filter.toBlock)
toBlock: filter.fromBlock == null ? null : this.formatter.blockTag(filter.toBlock),
};

@@ -617,3 +637,3 @@ }

while (true) {
const block = await this.getBlock('finalized');
const block = await this.getBlock("finalized");
if (receipt.blockNumber <= block.number) {

@@ -638,3 +658,3 @@ return await this.getTransactionReceipt(receipt.transactionHash);

}
const verifiedBlock = await this.getBlock('finalized');
const verifiedBlock = await this.getBlock("finalized");
if (tx.blockNumber <= verifiedBlock.number) {

@@ -681,3 +701,3 @@ return types_1.TransactionStatus.Finalized;

supportedAAVersion: data.supportedAAVersion,
nonceOrdering: data.nonceOrdering
nonceOrdering: data.nonceOrdering,
};

@@ -694,3 +714,3 @@ }

const customData = {
gasPerPubdataByte: transaction.gasPerPubdataByte
gasPerPubdataByte: transaction.gasPerPubdataByte,
};

@@ -700,3 +720,3 @@ if (transaction.factoryDeps) {

}
const fee = await this.estimateGasL1({
return await this.estimateGasL1({
from: transaction.caller,

@@ -706,5 +726,4 @@ data: transaction.calldata,

value: transaction.l2Value,
customData
customData,
});
return fee;
}

@@ -717,8 +736,8 @@ }

if (provider == null) {
throw new Error('missing provider');
throw new Error("missing provider");
}
if (!provider.request) {
throw new Error('provider must implement eip-1193');
throw new Error("provider must implement eip-1193");
}
let path = provider.host || provider.path || (provider.isMetaMask ? 'metamask' : 'eip-1193:');
let path = provider.host || provider.path || (provider.isMetaMask ? "metamask" : "eip-1193:");
super(path, network);

@@ -730,5 +749,5 @@ this.provider = provider;

// Metamask complains about eth_sign (and on some versions hangs)
if (method == 'eth_sign' && (this.provider.isMetaMask || this.provider.isStatus)) {
if (method == "eth_sign" && (this.provider.isMetaMask || this.provider.isStatus)) {
// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign
method = 'personal_sign';
method = "personal_sign";
params = [params[1], params[0]];

@@ -735,0 +754,0 @@ }

@@ -1,5 +0,5 @@

import { ethers } from 'ethers';
import { Provider } from './provider';
import { BlockTag, TransactionResponse, Signature, TransactionRequest } from './types';
import { TypedDataSigner } from '@ethersproject/abstract-signer';
import { ethers } from "ethers";
import { Provider } from "./provider";
import { BlockTag, Signature, TransactionRequest, TransactionResponse } from "./types";
import { TypedDataSigner } from "@ethersproject/abstract-signer";
export declare const eip712Types: {

@@ -6,0 +6,0 @@ Transaction: {

@@ -10,16 +10,16 @@ "use strict";

Transaction: [
{ name: 'txType', type: 'uint256' },
{ name: 'from', type: 'uint256' },
{ name: 'to', type: 'uint256' },
{ name: 'gasLimit', type: 'uint256' },
{ name: 'gasPerPubdataByteLimit', type: 'uint256' },
{ name: 'maxFeePerGas', type: 'uint256' },
{ name: 'maxPriorityFeePerGas', type: 'uint256' },
{ name: 'paymaster', type: 'uint256' },
{ name: 'nonce', type: 'uint256' },
{ name: 'value', type: 'uint256' },
{ name: 'data', type: 'bytes' },
{ name: 'factoryDeps', type: 'bytes32[]' },
{ name: 'paymasterInput', type: 'bytes' }
]
{ name: "txType", type: "uint256" },
{ name: "from", type: "uint256" },
{ name: "to", type: "uint256" },
{ name: "gasLimit", type: "uint256" },
{ name: "gasPerPubdataByteLimit", type: "uint256" },
{ name: "maxFeePerGas", type: "uint256" },
{ name: "maxPriorityFeePerGas", type: "uint256" },
{ name: "paymaster", type: "uint256" },
{ name: "nonce", type: "uint256" },
{ name: "value", type: "uint256" },
{ name: "data", type: "bytes" },
{ name: "factoryDeps", type: "bytes32[]" },
{ name: "paymasterInput", type: "bytes" },
],
};

@@ -30,5 +30,5 @@ class EIP712Signer {

this.eip712Domain = Promise.resolve(chainId).then((chainId) => ({
name: 'zkSync',
version: '2',
chainId
name: "zkSync",
version: "2",
chainId,
}));

@@ -41,3 +41,3 @@ }

const gasPerPubdataByteLimit = (_e = (_d = transaction.customData) === null || _d === void 0 ? void 0 : _d.gasPerPubdata) !== null && _e !== void 0 ? _e : utils_1.DEFAULT_GAS_PER_PUBDATA_LIMIT;
const signInput = {
return {
txType: transaction.type,

@@ -50,3 +50,4 @@ from: transaction.from,

maxPriorityFeePerGas,
paymaster: ((_g = (_f = transaction.customData) === null || _f === void 0 ? void 0 : _f.paymasterParams) === null || _g === void 0 ? void 0 : _g.paymaster) || ethers_1.ethers.constants.AddressZero,
paymaster: ((_g = (_f = transaction.customData) === null || _f === void 0 ? void 0 : _f.paymasterParams) === null || _g === void 0 ? void 0 : _g.paymaster) ||
ethers_1.ethers.constants.AddressZero,
nonce: transaction.nonce,

@@ -56,5 +57,4 @@ value: transaction.value,

factoryDeps: ((_j = (_h = transaction.customData) === null || _h === void 0 ? void 0 : _h.factoryDeps) === null || _j === void 0 ? void 0 : _j.map((dep) => (0, utils_1.hashBytecode)(dep))) || [],
paymasterInput: ((_l = (_k = transaction.customData) === null || _k === void 0 ? void 0 : _k.paymasterParams) === null || _l === void 0 ? void 0 : _l.paymasterInput) || '0x'
paymasterInput: ((_l = (_k = transaction.customData) === null || _k === void 0 ? void 0 : _k.paymasterParams) === null || _l === void 0 ? void 0 : _l.paymasterInput) || "0x",
};
return signInput;
}

@@ -69,5 +69,5 @@ async sign(transaction) {

const domain = {
name: 'zkSync',
version: '2',
chainId: transaction.chainId
name: "zkSync",
version: "2",
chainId: transaction.chainId,
};

@@ -114,7 +114,7 @@ return hash_1._TypedDataEncoder.hash(domain, exports.eip712Types, EIP712Signer.getSignInput(transaction));

if (transaction.from.toLowerCase() != address.toLowerCase()) {
throw new Error('Transaction `from` address mismatch');
throw new Error("Transaction `from` address mismatch");
}
transaction.type = utils_1.EIP712_TX_TYPE;
(_b = transaction.value) !== null && _b !== void 0 ? _b : (transaction.value = 0);
(_c = transaction.data) !== null && _c !== void 0 ? _c : (transaction.data = '0x');
(_c = transaction.data) !== null && _c !== void 0 ? _c : (transaction.data = "0x");
(_d = transaction.nonce) !== null && _d !== void 0 ? _d : (transaction.nonce = await this.getNonce());

@@ -190,7 +190,7 @@ transaction.customData = this._fillCustomData(transaction.customData);

if (transaction.from.toLowerCase() != address.toLowerCase()) {
throw new Error('Transaction `from` address mismatch');
throw new Error("Transaction `from` address mismatch");
}
transaction.type = utils_1.EIP712_TX_TYPE;
(_b = transaction.value) !== null && _b !== void 0 ? _b : (transaction.value = 0);
(_c = transaction.data) !== null && _c !== void 0 ? _c : (transaction.data = '0x');
(_c = transaction.data) !== null && _c !== void 0 ? _c : (transaction.data = "0x");
(_d = transaction.nonce) !== null && _d !== void 0 ? _d : (transaction.nonce = await this.getNonce());

@@ -197,0 +197,0 @@ transaction.customData = this._fillCustomData(transaction.customData);

@@ -1,3 +0,3 @@

import { BytesLike, BigNumberish, providers, BigNumber } from 'ethers';
import { BlockWithTransactions as EthersBlockWithTransactions } from '@ethersproject/abstract-provider';
import { BytesLike, BigNumberish, providers, BigNumber } from "ethers";
import { BlockWithTransactions as EthersBlockWithTransactions } from "@ethersproject/abstract-provider";
export type Address = string;

@@ -38,3 +38,3 @@ export type Signature = string;

export type BlockTag = number | string | 'committed' | 'finalized' | 'latest' | 'earliest' | 'pending';
export type DeploymentType = 'create' | 'createAccount';
export type DeploymentType = "create" | "createAccount";
export interface Token {

@@ -113,3 +113,3 @@ l1Address: Address;

export interface ApprovalBasedPaymasterInput {
type: 'ApprovalBased';
type: "ApprovalBased";
token: Address;

@@ -120,3 +120,3 @@ minimalAllowance: BigNumber;

export interface GeneralPaymasterInput {
type: 'General';
type: "General";
innerInput: BytesLike;

@@ -157,2 +157,6 @@ }

l2FairGasPrice: number;
baseSystemContractsHashes: {
bootloader: string;
defaultAa: string;
};
}

@@ -173,2 +177,6 @@ export interface BlockDetails {

executedAt?: Date;
baseSystemContractsHashes: {
bootloader: string;
defaultAa: string;
};
}

@@ -179,3 +187,3 @@ export interface TransactionDetails {

fee: BigNumberish;
gasPerPubdata?: BigNumberish;
gasPerPubdata: BigNumberish;
initiatorAddress: Address;

@@ -182,0 +190,0 @@ receivedAt: Date;

@@ -1,7 +0,7 @@

import { utils, ethers, BigNumber, BigNumberish, BytesLike } from 'ethers';
import { SignatureLike } from '@ethersproject/bytes';
import { Address, PriorityQueueType, PriorityOpTree, DeploymentInfo } from './types';
import { TypedDataDomain, TypedDataField } from '@ethersproject/abstract-signer';
import { Provider } from './provider';
export * from './paymaster-utils';
import { utils, ethers, BigNumber, BigNumberish, BytesLike } from "ethers";
import { SignatureLike } from "@ethersproject/bytes";
import { Address, PriorityQueueType, PriorityOpTree, DeploymentInfo } from "./types";
import { TypedDataDomain, TypedDataField } from "@ethersproject/abstract-signer";
import { Provider } from "./provider";
export * from "./paymaster-utils";
export declare const ETH_ADDRESS = "0x0000000000000000000000000000000000000000";

@@ -38,3 +38,3 @@ export declare const ZKSYNC_MAIN_ABI: utils.Interface;

export declare function getDeployedContracts(receipt: ethers.providers.TransactionReceipt): DeploymentInfo[];
export declare function create2Address(sender: Address, bytecodeHash: BytesLike, salt: BytesLike, input: BytesLike): string;
export declare function create2Address(sender: Address, bytecodeHash: BytesLike, salt: BytesLike, input?: BytesLike): string;
export declare function createAddress(sender: Address, senderNonce: BigNumberish): string;

@@ -41,0 +41,0 @@ export declare function checkBaseCost(baseCost: ethers.BigNumber, value: ethers.BigNumberish | Promise<ethers.BigNumberish>): Promise<void>;

@@ -24,16 +24,16 @@ "use strict";

__exportStar(require("./paymaster-utils"), exports);
exports.ETH_ADDRESS = '0x0000000000000000000000000000000000000000';
exports.ZKSYNC_MAIN_ABI = new ethers_1.utils.Interface(require('../../abi/IZkSync.json').abi);
exports.CONTRACT_DEPLOYER = new ethers_1.utils.Interface(require('../../abi/ContractDeployer.json').abi);
exports.L1_MESSENGER = new ethers_1.utils.Interface(require('../../abi/IL1Messenger.json').abi);
exports.IERC20 = new ethers_1.utils.Interface(require('../../abi/IERC20.json').abi);
exports.IERC1271 = new ethers_1.utils.Interface(require('../../abi/IERC1271.json').abi);
exports.L1_BRIDGE_ABI = new ethers_1.utils.Interface(require('../../abi/IL1Bridge.json').abi);
exports.L2_BRIDGE_ABI = new ethers_1.utils.Interface(require('../../abi/IL2Bridge.json').abi);
exports.BOOTLOADER_FORMAL_ADDRESS = '0x0000000000000000000000000000000000008001';
exports.CONTRACT_DEPLOYER_ADDRESS = '0x0000000000000000000000000000000000008006';
exports.L1_MESSENGER_ADDRESS = '0x0000000000000000000000000000000000008008';
exports.L2_ETH_TOKEN_ADDRESS = '0x000000000000000000000000000000000000800a';
exports.L1_TO_L2_ALIAS_OFFSET = '0x1111000000000000000000000000000000001111';
exports.EIP1271_MAGIC_VALUE = '0x1626ba7e';
exports.ETH_ADDRESS = "0x0000000000000000000000000000000000000000";
exports.ZKSYNC_MAIN_ABI = new ethers_1.utils.Interface(require("../abi/IZkSync.json").abi);
exports.CONTRACT_DEPLOYER = new ethers_1.utils.Interface(require("../abi/ContractDeployer.json").abi);
exports.L1_MESSENGER = new ethers_1.utils.Interface(require("../abi/IL1Messenger.json").abi);
exports.IERC20 = new ethers_1.utils.Interface(require("../abi/IERC20.json").abi);
exports.IERC1271 = new ethers_1.utils.Interface(require("../abi/IERC1271.json").abi);
exports.L1_BRIDGE_ABI = new ethers_1.utils.Interface(require("../abi/IL1Bridge.json").abi);
exports.L2_BRIDGE_ABI = new ethers_1.utils.Interface(require("../abi/IL2Bridge.json").abi);
exports.BOOTLOADER_FORMAL_ADDRESS = "0x0000000000000000000000000000000000008001";
exports.CONTRACT_DEPLOYER_ADDRESS = "0x0000000000000000000000000000000000008006";
exports.L1_MESSENGER_ADDRESS = "0x0000000000000000000000000000000000008008";
exports.L2_ETH_TOKEN_ADDRESS = "0x000000000000000000000000000000000000800a";
exports.L1_TO_L2_ALIAS_OFFSET = "0x1111000000000000000000000000000000001111";
exports.EIP1271_MAGIC_VALUE = "0x1626ba7e";
exports.EIP712_TX_TYPE = 0x71;

@@ -51,7 +51,7 @@ exports.PRIORITY_OPERATION_L2_TX_TYPE = 0xff;

// any reasonable limit will be accepted. Note, that the operator is NOT required to
// use the honest value of gas per pubdata and it can use any value up to the one signed by the user.
// use the honest value of gas per pubdata, and it can use any value up to the one signed by the user.
// In the future releases, we will provide a way to estimate the current gasPerPubdata.
exports.DEFAULT_GAS_PER_PUBDATA_LIMIT = 50000;
// It is possible to provide practically any gasPerPubdataByte for L1->L2 transactions, since
// the cost per gas will be adjusted respectively. We will use 800 as an relatively optimal value for now.
// the cost per gas will be adjusted respectively. We will use 800 as a relatively optimal value for now.
exports.REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT = 800;

@@ -69,3 +69,3 @@ function isETH(token) {

queueType: types_1.PriorityQueueType.Deque,
opTree: types_1.PriorityOpTree.Full
opTree: types_1.PriorityOpTree.Full,
};

@@ -81,3 +81,3 @@ }

...ethers_1.ethers.utils.zeroPad(sender, 32),
...ethers_1.ethers.utils.arrayify(ethers_1.ethers.utils.keccak256(msg))
...ethers_1.ethers.utils.arrayify(ethers_1.ethers.utils.keccak256(msg)),
]);

@@ -90,3 +90,3 @@ return ethers_1.ethers.utils.keccak256(encodedMsg);

const deployedContracts = receipt.logs
.filter((log) => log.topics[0] == ethers_1.utils.id('ContractDeployed(address,bytes32,address)') &&
.filter((log) => log.topics[0] == ethers_1.utils.id("ContractDeployed(address,bytes32,address)") &&
log.address == exports.CONTRACT_DEPLOYER_ADDRESS)

@@ -101,3 +101,3 @@ // Take the last topic (deployed contract address as U256) and extract address from it (U160).

bytecodeHash: bytesCodehash,
deployedAddress: ethers_1.utils.getAddress(address)
deployedAddress: ethers_1.utils.getAddress(address),
};

@@ -108,7 +108,13 @@ });

exports.getDeployedContracts = getDeployedContracts;
function create2Address(sender, bytecodeHash, salt, input) {
const prefix = ethers_1.ethers.utils.keccak256(ethers_1.ethers.utils.toUtf8Bytes('zksyncCreate2'));
function create2Address(sender, bytecodeHash, salt, input = "") {
const prefix = ethers_1.ethers.utils.keccak256(ethers_1.ethers.utils.toUtf8Bytes("zksyncCreate2"));
const inputHash = ethers_1.ethers.utils.keccak256(input);
const addressBytes = ethers_1.ethers.utils
.keccak256(ethers_1.ethers.utils.concat([prefix, ethers_1.ethers.utils.zeroPad(sender, 32), salt, bytecodeHash, inputHash]))
.keccak256(ethers_1.ethers.utils.concat([
prefix,
ethers_1.ethers.utils.zeroPad(sender, 32),
salt,
bytecodeHash,
inputHash,
]))
.slice(26);

@@ -119,3 +125,3 @@ return ethers_1.ethers.utils.getAddress(addressBytes);

function createAddress(sender, senderNonce) {
const prefix = ethers_1.ethers.utils.keccak256(ethers_1.ethers.utils.toUtf8Bytes('zksyncCreate'));
const prefix = ethers_1.ethers.utils.keccak256(ethers_1.ethers.utils.toUtf8Bytes("zksyncCreate"));
const addressBytes = ethers_1.ethers.utils

@@ -125,3 +131,3 @@ .keccak256(ethers_1.ethers.utils.concat([

ethers_1.ethers.utils.zeroPad(sender, 32),
ethers_1.ethers.utils.zeroPad(ethers_1.ethers.utils.hexlify(senderNonce), 32)
ethers_1.ethers.utils.zeroPad(ethers_1.ethers.utils.hexlify(senderNonce), 32),
]))

@@ -150,3 +156,3 @@ .slice(26);

if (result.length > 32) {
throw new Error('invalid length for ' + name);
throw new Error("invalid length for " + name);
}

@@ -156,3 +162,3 @@ return result;

if (!transaction.from) {
throw new Error('Explicitly providing `from` field is reqiured for EIP712 transactions');
throw new Error("Explicitly providing `from` field is reqiured for EIP712 transactions");
}

@@ -164,13 +170,13 @@ const from = transaction.from;

const fields = [
formatNumber(transaction.nonce || 0, 'nonce'),
formatNumber(maxPriorityFeePerGas, 'maxPriorityFeePerGas'),
formatNumber(maxFeePerGas, 'maxFeePerGas'),
formatNumber(transaction.gasLimit || 0, 'gasLimit'),
transaction.to != null ? ethers_1.utils.getAddress(transaction.to) : '0x',
formatNumber(transaction.value || 0, 'value'),
transaction.data || '0x'
formatNumber(transaction.nonce || 0, "nonce"),
formatNumber(maxPriorityFeePerGas, "maxPriorityFeePerGas"),
formatNumber(maxFeePerGas, "maxFeePerGas"),
formatNumber(transaction.gasLimit || 0, "gasLimit"),
transaction.to != null ? ethers_1.utils.getAddress(transaction.to) : "0x",
formatNumber(transaction.value || 0, "value"),
transaction.data || "0x",
];
if (signature) {
const sig = ethers_1.utils.splitSignature(signature);
fields.push(formatNumber(sig.recoveryParam, 'recoveryParam'));
fields.push(formatNumber(sig.recoveryParam, "recoveryParam"));
fields.push(ethers_1.utils.stripZeros(sig.r));

@@ -180,17 +186,20 @@ fields.push(ethers_1.utils.stripZeros(sig.s));

else {
fields.push(formatNumber(transaction.chainId, 'chainId'));
fields.push('0x');
fields.push('0x');
fields.push(formatNumber(transaction.chainId, "chainId"));
fields.push("0x");
fields.push("0x");
}
fields.push(formatNumber(transaction.chainId, 'chainId'));
fields.push(formatNumber(transaction.chainId, "chainId"));
fields.push(ethers_1.utils.getAddress(from));
// Add meta
fields.push(formatNumber(meta.gasPerPubdata || exports.DEFAULT_GAS_PER_PUBDATA_LIMIT, 'gasPerPubdata'));
fields.push(formatNumber(meta.gasPerPubdata || exports.DEFAULT_GAS_PER_PUBDATA_LIMIT, "gasPerPubdata"));
fields.push(((_a = meta.factoryDeps) !== null && _a !== void 0 ? _a : []).map((dep) => ethers_1.utils.hexlify(dep)));
if (meta.customSignature && ethers_1.ethers.utils.arrayify(meta.customSignature).length == 0) {
throw new Error('Empty signatures are not supported');
throw new Error("Empty signatures are not supported");
}
fields.push(meta.customSignature || '0x');
fields.push(meta.customSignature || "0x");
if (meta.paymasterParams) {
fields.push([meta.paymasterParams.paymaster, ethers_1.ethers.utils.hexlify(meta.paymasterParams.paymasterInput)]);
fields.push([
meta.paymasterParams.paymaster,
ethers_1.ethers.utils.hexlify(meta.paymasterParams.paymasterInput),
]);
}

@@ -207,3 +216,3 @@ else {

if (bytecodeAsArray.length % 32 != 0) {
throw new Error('The bytecode length in bytes must be divisible by 32');
throw new Error("The bytecode length in bytes must be divisible by 32");
}

@@ -219,3 +228,3 @@ if (bytecodeAsArray.length > exports.MAX_BYTECODE_LEN_BYTES) {

if (bytecodeLengthInWords % 2 == 0) {
throw new Error('Bytecode length in 32-byte words must be odd');
throw new Error("Bytecode length in 32-byte words must be odd");
}

@@ -234,3 +243,3 @@ const bytecodeLength = ethers_1.ethers.utils.arrayify(bytecodeLengthInWords);

function handleAddress(value) {
if (value === '0x') {
if (value === "0x") {
return null;

@@ -241,3 +250,3 @@ }

function handleNumber(value) {
if (value === '0x') {
if (value === "0x") {
return ethers_1.BigNumber.from(0);

@@ -256,3 +265,3 @@ }

paymaster: ethers_1.utils.getAddress(arr[0]),
paymasterInput: ethers_1.utils.arrayify(arr[1])
paymasterInput: ethers_1.utils.arrayify(arr[1]),
};

@@ -280,4 +289,4 @@ }

customSignature: raw[14],
paymasterParams: arrayToPaymasterParams(raw[15])
}
paymasterParams: arrayToPaymasterParams(raw[15]),
},
};

@@ -287,10 +296,12 @@ const ethSignature = {

r: raw[8],
s: raw[9]
s: raw[9],
};
if ((ethers_1.utils.hexlify(ethSignature.r) == '0x' || ethers_1.utils.hexlify(ethSignature.s) == '0x') &&
if ((ethers_1.utils.hexlify(ethSignature.r) == "0x" || ethers_1.utils.hexlify(ethSignature.s) == "0x") &&
!transaction.customData.customSignature) {
return transaction;
}
if (ethSignature.v !== 0 && ethSignature.v !== 1 && !transaction.customData.customSignature) {
throw new Error('Failed to parse signature');
if (ethSignature.v !== 0 &&
ethSignature.v !== 1 &&
!transaction.customData.customSignature) {
throw new Error("Failed to parse signature");
}

@@ -308,7 +319,8 @@ if (!transaction.customData.customSignature) {

var _a;
if (((_a = transaction === null || transaction === void 0 ? void 0 : transaction.customData) === null || _a === void 0 ? void 0 : _a.customSignature) && transaction.customData.customSignature.length) {
if (((_a = transaction === null || transaction === void 0 ? void 0 : transaction.customData) === null || _a === void 0 ? void 0 : _a.customSignature) &&
transaction.customData.customSignature.length) {
return ethers_1.ethers.utils.arrayify(transaction.customData.customSignature);
}
if (!ethSignature) {
throw new Error('No signature provided');
throw new Error("No signature provided");
}

@@ -340,3 +352,3 @@ const r = ethers_1.ethers.utils.zeroPad(ethers_1.ethers.utils.arrayify(ethSignature.r), 32);

if (!txHash) {
throw new Error('Failed to parse tx logs');
throw new Error("Failed to parse tx logs");
}

@@ -361,3 +373,3 @@ return txHash;

async function getERC20DefaultBridgeData(l1TokenAddress, provider) {
const token = typechain_1.IERC20MetadataFactory.connect(l1TokenAddress, provider);
const token = typechain_1.IERC20Factory.connect(l1TokenAddress, provider);
const name = await token.name();

@@ -367,6 +379,6 @@ const symbol = await token.symbol();

const coder = new utils_1.AbiCoder();
const nameBytes = coder.encode(['string'], [name]);
const symbolBytes = coder.encode(['string'], [symbol]);
const decimalsBytes = coder.encode(['uint256'], [decimals]);
return coder.encode(['bytes', 'bytes', 'bytes'], [nameBytes, symbolBytes, decimalsBytes]);
const nameBytes = coder.encode(["string"], [name]);
const symbolBytes = coder.encode(["string"], [symbol]);
const decimalsBytes = coder.encode(["uint256"], [decimals]);
return coder.encode(["bytes", "bytes", "bytes"], [nameBytes, symbolBytes, decimalsBytes]);
}

@@ -377,3 +389,3 @@ exports.getERC20DefaultBridgeData = getERC20DefaultBridgeData;

async function getERC20BridgeCalldata(l1TokenAddress, l1Sender, l2Receiver, amount, bridgeData) {
return exports.L2_BRIDGE_ABI.encodeFunctionData('finalizeDeposit', [
return exports.L2_BRIDGE_ABI.encodeFunctionData("finalizeDeposit", [
l1Sender,

@@ -383,3 +395,3 @@ l2Receiver,

amount,
bridgeData
bridgeData,
]);

@@ -449,4 +461,4 @@ }

caller: from,
calldata: '0x',
l2Value: amount
calldata: "0x",
l2Value: amount,
});

@@ -458,3 +470,7 @@ }

const l1WethBridge = typechain_1.IL1BridgeFactory.connect(bridgeAddresses.wethL1, providerL1);
const l2WethToken = await l1WethBridge.l2TokenAddress(token);
let l2WethToken = ethers_1.ethers.constants.AddressZero;
try {
l2WethToken = await l1WethBridge.l2TokenAddress(token);
}
catch (e) { }
if (l2WethToken != ethers_1.ethers.constants.AddressZero) {

@@ -464,3 +480,3 @@ value = amount;

l2BridgeAddress = bridgeAddresses.wethL2;
bridgeData = '0x';
bridgeData = "0x";
}

@@ -478,3 +494,5 @@ else {

function scaleGasLimit(gasLimit) {
return gasLimit.mul(exports.L1_FEE_ESTIMATION_COEF_NUMERATOR).div(exports.L1_FEE_ESTIMATION_COEF_DENOMINATOR);
return gasLimit
.mul(exports.L1_FEE_ESTIMATION_COEF_NUMERATOR)
.div(exports.L1_FEE_ESTIMATION_COEF_DENOMINATOR);
}

@@ -489,5 +507,5 @@ exports.scaleGasLimit = scaleGasLimit;

calldata,
l2Value
l2Value,
});
}
exports.estimateCustomBridgeDepositL2Gas = estimateCustomBridgeDepositL2Gas;

@@ -1,6 +0,6 @@

import { EIP712Signer } from './signer';
import { Provider } from './provider';
import { ethers, utils } from 'ethers';
import { BlockTag, TransactionResponse, TransactionRequest } from './types';
import { ProgressCallback } from '@ethersproject/json-wallets';
import { EIP712Signer } from "./signer";
import { Provider } from "./provider";
import { ethers, utils } from "ethers";
import { BlockTag, TransactionResponse, TransactionRequest } from "./types";
import { ProgressCallback } from "@ethersproject/json-wallets";
declare const Wallet_base: {

@@ -7,0 +7,0 @@ new (...args: any[]): {

@@ -11,3 +11,3 @@ "use strict";

if (this.providerL1 == null) {
throw new Error('L1 provider missing: use `connectToL1` to specify');
throw new Error("L1 provider missing: use `connectToL1` to specify");
}

@@ -75,3 +75,3 @@ return this.providerL1;

(_a = transaction.value) !== null && _a !== void 0 ? _a : (transaction.value = 0);
(_b = transaction.data) !== null && _b !== void 0 ? _b : (transaction.data = '0x');
(_b = transaction.data) !== null && _b !== void 0 ? _b : (transaction.data = "0x");
transaction.customData = this._fillCustomData(transaction.customData);

@@ -92,3 +92,3 @@ transaction.gasPrice = await this.provider.getGasPrice();

if (transaction.from.toLowerCase() != this.address.toLowerCase()) {
throw new Error('Transaction `from` address mismatch');
throw new Error("Transaction `from` address mismatch");
}

@@ -95,0 +95,0 @@ transaction.customData.customSignature = await this.eip712.sign(transaction);

@@ -26,3 +26,3 @@ /* Autogenerated file. Do not edit manually. */

functions: {
"balanceOf(address)": FunctionFragment;
"balanceOf(uint256)": FunctionFragment;
"decimals()": FunctionFragment;

@@ -37,3 +37,6 @@ "mint(address,uint256)": FunctionFragment;

encodeFunctionData(functionFragment: "balanceOf", values: [string]): string;
encodeFunctionData(
functionFragment: "balanceOf",
values: [BigNumberish]
): string;
encodeFunctionData(functionFragment: "decimals", values?: undefined): string;

@@ -74,3 +77,3 @@ encodeFunctionData(

"Transfer(address,address,uint256)": EventFragment;
"Withdrawal(address,uint256)": EventFragment;
"Withdrawal(address,address,uint256)": EventFragment;
};

@@ -98,3 +101,3 @@

balanceOf(
arg0: string,
arg0: BigNumberish,
overrides?: CallOverrides

@@ -105,4 +108,4 @@ ): Promise<{

"balanceOf(address)"(
arg0: string,
"balanceOf(uint256)"(
arg0: BigNumberish,
overrides?: CallOverrides

@@ -182,6 +185,6 @@ ): Promise<{

balanceOf(arg0: string, overrides?: CallOverrides): Promise<BigNumber>;
balanceOf(arg0: BigNumberish, overrides?: CallOverrides): Promise<BigNumber>;
"balanceOf(address)"(
arg0: string,
"balanceOf(uint256)"(
arg0: BigNumberish,
overrides?: CallOverrides

@@ -243,6 +246,9 @@ ): Promise<BigNumber>;

callStatic: {
balanceOf(arg0: string, overrides?: CallOverrides): Promise<BigNumber>;
balanceOf(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
"balanceOf(address)"(
arg0: string,
"balanceOf(uint256)"(
arg0: BigNumberish,
overrides?: CallOverrides

@@ -306,10 +312,17 @@ ): Promise<BigNumber>;

Withdrawal(_l1Receiver: string | null, _amount: null): EventFilter;
Withdrawal(
_l2Sender: string | null,
_l1Receiver: string | null,
_amount: null
): EventFilter;
};
estimateGas: {
balanceOf(arg0: string, overrides?: CallOverrides): Promise<BigNumber>;
balanceOf(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
"balanceOf(address)"(
arg0: string,
"balanceOf(uint256)"(
arg0: BigNumberish,
overrides?: CallOverrides

@@ -373,8 +386,8 @@ ): Promise<BigNumber>;

balanceOf(
arg0: string,
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
"balanceOf(address)"(
arg0: string,
"balanceOf(uint256)"(
arg0: BigNumberish,
overrides?: CallOverrides

@@ -381,0 +394,0 @@ ): Promise<PopulatedTransaction>;

@@ -65,2 +65,8 @@ "use strict";

internalType: "address",
name: "_l2Sender",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "_l1Receiver",

@@ -82,5 +88,5 @@ type: "address",

{
internalType: "address",
internalType: "uint256",
name: "",
type: "address",
type: "uint256",
},

@@ -87,0 +93,0 @@ ],

@@ -35,48 +35,48 @@ /* Autogenerated file. Do not edit manually. */

encodeFunctionData(
functionFragment: "claimFailedDeposit",
values: [
string,
string,
BytesLike,
BigNumberish,
BigNumberish,
BigNumberish,
BytesLike[]
]
functionFragment: "claimFailedDeposit",
values: [
string,
string,
BytesLike,
BigNumberish,
BigNumberish,
BigNumberish,
BytesLike[]
]
): string;
encodeFunctionData(
functionFragment: "deposit",
values: [string, string, BigNumberish, BigNumberish, BigNumberish, string]
functionFragment: "deposit",
values: [string, string, BigNumberish, BigNumberish, BigNumberish, string]
): string;
encodeFunctionData(
functionFragment: "finalizeWithdrawal",
values: [BigNumberish, BigNumberish, BigNumberish, BytesLike, BytesLike[]]
functionFragment: "finalizeWithdrawal",
values: [BigNumberish, BigNumberish, BigNumberish, BytesLike, BytesLike[]]
): string;
encodeFunctionData(
functionFragment: "isWithdrawalFinalized",
values: [BigNumberish, BigNumberish]
functionFragment: "isWithdrawalFinalized",
values: [BigNumberish, BigNumberish]
): string;
encodeFunctionData(functionFragment: "l2Bridge", values?: undefined): string;
encodeFunctionData(
functionFragment: "l2TokenAddress",
values: [string]
functionFragment: "l2TokenAddress",
values: [string]
): string;
decodeFunctionResult(
functionFragment: "claimFailedDeposit",
data: BytesLike
functionFragment: "claimFailedDeposit",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "deposit", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "finalizeWithdrawal",
data: BytesLike
functionFragment: "finalizeWithdrawal",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "isWithdrawalFinalized",
data: BytesLike
functionFragment: "isWithdrawalFinalized",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "l2Bridge", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "l2TokenAddress",
data: BytesLike
functionFragment: "l2TokenAddress",
data: BytesLike
): Result;

@@ -110,65 +110,65 @@

claimFailedDeposit(
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<ContractTransaction>;
"claimFailedDeposit(address,address,bytes32,uint256,uint256,uint16,bytes32[])"(
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<ContractTransaction>;
deposit(
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
): Promise<ContractTransaction>;
"deposit(address,address,uint256,uint256,uint256,address)"(
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
): Promise<ContractTransaction>;
finalizeWithdrawal(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<ContractTransaction>;
"finalizeWithdrawal(uint256,uint256,uint16,bytes,bytes32[])"(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<ContractTransaction>;
isWithdrawalFinalized(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
): Promise<{

@@ -179,5 +179,5 @@ 0: boolean;

"isWithdrawalFinalized(uint256,uint256)"(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
): Promise<{

@@ -196,4 +196,4 @@ 0: boolean;

l2TokenAddress(
_l1Token: string,
overrides?: CallOverrides
_l1Token: string,
overrides?: CallOverrides
): Promise<{

@@ -204,4 +204,4 @@ 0: string;

"l2TokenAddress(address)"(
_l1Token: string,
overrides?: CallOverrides
_l1Token: string,
overrides?: CallOverrides
): Promise<{

@@ -213,71 +213,71 @@ 0: string;

claimFailedDeposit(
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<ContractTransaction>;
"claimFailedDeposit(address,address,bytes32,uint256,uint256,uint16,bytes32[])"(
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<ContractTransaction>;
deposit(
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
): Promise<ContractTransaction>;
"deposit(address,address,uint256,uint256,uint256,address)"(
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
): Promise<ContractTransaction>;
finalizeWithdrawal(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<ContractTransaction>;
"finalizeWithdrawal(uint256,uint256,uint16,bytes,bytes32[])"(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<ContractTransaction>;
isWithdrawalFinalized(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
): Promise<boolean>;
"isWithdrawalFinalized(uint256,uint256)"(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
): Promise<boolean>;

@@ -292,4 +292,4 @@

"l2TokenAddress(address)"(
_l1Token: string,
overrides?: CallOverrides
_l1Token: string,
overrides?: CallOverrides
): Promise<string>;

@@ -299,71 +299,71 @@

claimFailedDeposit(
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: CallOverrides
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: CallOverrides
): Promise<void>;
"claimFailedDeposit(address,address,bytes32,uint256,uint256,uint16,bytes32[])"(
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: CallOverrides
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: CallOverrides
): Promise<void>;
deposit(
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: CallOverrides
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: CallOverrides
): Promise<string>;
"deposit(address,address,uint256,uint256,uint256,address)"(
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: CallOverrides
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: CallOverrides
): Promise<string>;
finalizeWithdrawal(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: CallOverrides
): Promise<void>;
"finalizeWithdrawal(uint256,uint256,uint16,bytes,bytes32[])"(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: CallOverrides
): Promise<void>;
isWithdrawalFinalized(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
): Promise<boolean>;
"isWithdrawalFinalized(uint256,uint256)"(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
): Promise<boolean>;

@@ -376,9 +376,9 @@

l2TokenAddress(
_l1Token: string,
overrides?: CallOverrides
_l1Token: string,
overrides?: CallOverrides
): Promise<string>;
"l2TokenAddress(address)"(
_l1Token: string,
overrides?: CallOverrides
_l1Token: string,
overrides?: CallOverrides
): Promise<string>;

@@ -389,19 +389,19 @@ };

ClaimedFailedDeposit(
to: string | null,
l1Token: string | null,
amount: null
to: string | null,
l1Token: string | null,
amount: null
): EventFilter;
DepositInitiated(
l2DepositTxHash: BytesLike | null,
from: string | null,
to: string | null,
l1Token: null,
amount: null
l2DepositTxHash: BytesLike | null,
from: string | null,
to: string | null,
l1Token: null,
amount: null
): EventFilter;
WithdrawalFinalized(
to: string | null,
l1Token: string | null,
amount: null
to: string | null,
l1Token: string | null,
amount: null
): EventFilter;

@@ -412,71 +412,71 @@ };

claimFailedDeposit(
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<BigNumber>;
"claimFailedDeposit(address,address,bytes32,uint256,uint256,uint16,bytes32[])"(
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<BigNumber>;
deposit(
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
): Promise<BigNumber>;
"deposit(address,address,uint256,uint256,uint256,address)"(
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
): Promise<BigNumber>;
finalizeWithdrawal(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<BigNumber>;
"finalizeWithdrawal(uint256,uint256,uint16,bytes,bytes32[])"(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<BigNumber>;
isWithdrawalFinalized(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
"isWithdrawalFinalized(uint256,uint256)"(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;

@@ -489,9 +489,9 @@

l2TokenAddress(
_l1Token: string,
overrides?: CallOverrides
_l1Token: string,
overrides?: CallOverrides
): Promise<BigNumber>;
"l2TokenAddress(address)"(
_l1Token: string,
overrides?: CallOverrides
_l1Token: string,
overrides?: CallOverrides
): Promise<BigNumber>;

@@ -502,71 +502,71 @@ };

claimFailedDeposit(
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<PopulatedTransaction>;
"claimFailedDeposit(address,address,bytes32,uint256,uint256,uint16,bytes32[])"(
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<PopulatedTransaction>;
deposit(
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
): Promise<PopulatedTransaction>;
"deposit(address,address,uint256,uint256,uint256,address)"(
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
): Promise<PopulatedTransaction>;
finalizeWithdrawal(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<PopulatedTransaction>;
"finalizeWithdrawal(uint256,uint256,uint16,bytes,bytes32[])"(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<PopulatedTransaction>;
isWithdrawalFinalized(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
"isWithdrawalFinalized(uint256,uint256)"(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;

@@ -579,11 +579,11 @@

l2TokenAddress(
_l1Token: string,
overrides?: CallOverrides
_l1Token: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
"l2TokenAddress(address)"(
_l1Token: string,
overrides?: CallOverrides
_l1Token: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
};
}

@@ -17,2 +17,3 @@ /* Autogenerated file. Do not edit manually. */

Overrides,
PayableOverrides,
CallOverrides,

@@ -27,3 +28,2 @@ } from "@ethersproject/contracts";

"finalizeDeposit(address,address,address,uint256,bytes)": FunctionFragment;
"initialize(address,bytes32,address)": FunctionFragment;
"l1Bridge()": FunctionFragment;

@@ -39,6 +39,2 @@ "l1TokenAddress(address)": FunctionFragment;

): string;
encodeFunctionData(
functionFragment: "initialize",
values: [string, BytesLike, string]
): string;
encodeFunctionData(functionFragment: "l1Bridge", values?: undefined): string;

@@ -62,3 +58,2 @@ encodeFunctionData(

): Result;
decodeFunctionResult(functionFragment: "initialize", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "l1Bridge", data: BytesLike): Result;

@@ -75,3 +70,9 @@ decodeFunctionResult(

events: {};
events: {
"FinalizeDeposit(address,address,address,uint256)": EventFragment;
"WithdrawalInitiated(address,address,address,uint256)": EventFragment;
};
getEvent(nameOrSignatureOrTopic: "FinalizeDeposit"): EventFragment;
getEvent(nameOrSignatureOrTopic: "WithdrawalInitiated"): EventFragment;
}

@@ -99,3 +100,3 @@

_data: BytesLike,
overrides?: Overrides
overrides?: PayableOverrides
): Promise<ContractTransaction>;

@@ -109,19 +110,5 @@

_data: BytesLike,
overrides?: Overrides
overrides?: PayableOverrides
): Promise<ContractTransaction>;
initialize(
_l1Bridge: string,
_l2TokenProxyBytecodeHash: BytesLike,
_governor: string,
overrides?: Overrides
): Promise<ContractTransaction>;
"initialize(address,bytes32,address)"(
_l1Bridge: string,
_l2TokenProxyBytecodeHash: BytesLike,
_governor: string,
overrides?: Overrides
): Promise<ContractTransaction>;
l1Bridge(overrides?: CallOverrides): Promise<{

@@ -184,3 +171,3 @@ 0: string;

_data: BytesLike,
overrides?: Overrides
overrides?: PayableOverrides
): Promise<ContractTransaction>;

@@ -194,19 +181,5 @@

_data: BytesLike,
overrides?: Overrides
overrides?: PayableOverrides
): Promise<ContractTransaction>;
initialize(
_l1Bridge: string,
_l2TokenProxyBytecodeHash: BytesLike,
_governor: string,
overrides?: Overrides
): Promise<ContractTransaction>;
"initialize(address,bytes32,address)"(
_l1Bridge: string,
_l2TokenProxyBytecodeHash: BytesLike,
_governor: string,
overrides?: Overrides
): Promise<ContractTransaction>;
l1Bridge(overrides?: CallOverrides): Promise<string>;

@@ -263,16 +236,2 @@

initialize(
_l1Bridge: string,
_l2TokenProxyBytecodeHash: BytesLike,
_governor: string,
overrides?: CallOverrides
): Promise<void>;
"initialize(address,bytes32,address)"(
_l1Bridge: string,
_l2TokenProxyBytecodeHash: BytesLike,
_governor: string,
overrides?: CallOverrides
): Promise<void>;
l1Bridge(overrides?: CallOverrides): Promise<string>;

@@ -317,4 +276,18 @@

filters: {};
filters: {
FinalizeDeposit(
l1Sender: string | null,
l2Receiver: string | null,
l2Token: string | null,
amount: null
): EventFilter;
WithdrawalInitiated(
l2Sender: string | null,
l1Receiver: string | null,
l2Token: string | null,
amount: null
): EventFilter;
};
estimateGas: {

@@ -327,3 +300,3 @@ finalizeDeposit(

_data: BytesLike,
overrides?: Overrides
overrides?: PayableOverrides
): Promise<BigNumber>;

@@ -337,19 +310,5 @@

_data: BytesLike,
overrides?: Overrides
overrides?: PayableOverrides
): Promise<BigNumber>;
initialize(
_l1Bridge: string,
_l2TokenProxyBytecodeHash: BytesLike,
_governor: string,
overrides?: Overrides
): Promise<BigNumber>;
"initialize(address,bytes32,address)"(
_l1Bridge: string,
_l2TokenProxyBytecodeHash: BytesLike,
_governor: string,
overrides?: Overrides
): Promise<BigNumber>;
l1Bridge(overrides?: CallOverrides): Promise<BigNumber>;

@@ -401,3 +360,3 @@

_data: BytesLike,
overrides?: Overrides
overrides?: PayableOverrides
): Promise<PopulatedTransaction>;

@@ -411,19 +370,5 @@

_data: BytesLike,
overrides?: Overrides
overrides?: PayableOverrides
): Promise<PopulatedTransaction>;
initialize(
_l1Bridge: string,
_l2TokenProxyBytecodeHash: BytesLike,
_governor: string,
overrides?: Overrides
): Promise<PopulatedTransaction>;
"initialize(address,bytes32,address)"(
_l1Bridge: string,
_l2TokenProxyBytecodeHash: BytesLike,
_governor: string,
overrides?: Overrides
): Promise<PopulatedTransaction>;
l1Bridge(overrides?: CallOverrides): Promise<PopulatedTransaction>;

@@ -430,0 +375,0 @@

@@ -16,33 +16,62 @@ "use strict";

{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "_l1Sender",
name: "l1Sender",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "_l2Receiver",
name: "l2Receiver",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "_l1Token",
name: "l2Token",
type: "address",
},
{
indexed: false,
internalType: "uint256",
name: "_amount",
name: "amount",
type: "uint256",
},
],
name: "FinalizeDeposit",
type: "event",
},
{
anonymous: false,
inputs: [
{
internalType: "bytes",
name: "_data",
type: "bytes",
indexed: true,
internalType: "address",
name: "l2Sender",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "l1Receiver",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "l2Token",
type: "address",
},
{
indexed: false,
internalType: "uint256",
name: "amount",
type: "uint256",
},
],
name: "finalizeDeposit",
outputs: [],
stateMutability: "nonpayable",
type: "function",
name: "WithdrawalInitiated",
type: "event",
},

@@ -53,19 +82,29 @@ {

internalType: "address",
name: "_l1Bridge",
name: "_l1Sender",
type: "address",
},
{
internalType: "bytes32",
name: "_l2TokenProxyBytecodeHash",
type: "bytes32",
internalType: "address",
name: "_l2Receiver",
type: "address",
},
{
internalType: "address",
name: "_governor",
name: "_l1Token",
type: "address",
},
{
internalType: "uint256",
name: "_amount",
type: "uint256",
},
{
internalType: "bytes",
name: "_data",
type: "bytes",
},
],
name: "initialize",
name: "finalizeDeposit",
outputs: [],
stateMutability: "nonpayable",
stateMutability: "payable",
type: "function",

@@ -72,0 +111,0 @@ },

@@ -1,12 +0,20 @@

export { IZkSyncFactory } from './IZkSyncFactory';
export type { IZkSync } from './IZkSync';
export { IERC20MetadataFactory } from './IERC20MetadataFactory';
export type { IERC20Metadata } from './IERC20Metadata';
export { ContractDeployerFactory } from './ContractDeployerFactory';
export type { ContractDeployer } from './ContractDeployer';
export { IAllowListFactory } from './IAllowListFactory';
export type { IAllowList } from './IAllowList';
export { IERC20Factory } from './IERC20Factory';
export type { IERC20 } from './IERC20';
export { IERC1271Factory } from './IERC1271Factory';
export type { IERC1271 } from './IERC1271';
export { IEthTokenFactory } from './IEthTokenFactory';
export type { IEthToken } from './IEthToken';
export { IL1BridgeFactory } from './IL1BridgeFactory';
export type { IL1Bridge } from './IL1Bridge';
export { IL1MessengerFactory } from './IL1MessengerFactory';
export type { IL1Messenger } from './IL1Messenger';
export { IL2BridgeFactory } from './IL2BridgeFactory';
export type { IL2Bridge } from './IL2Bridge';
export { IAllowListFactory } from './IAllowListFactory';
export type { IAllowList } from './IAllowList';
export { IEthTokenFactory } from './IEthTokenFactory';
export type { IEthToken } from './IEthToken';
export { IPaymasterFlowFactory } from './IPaymasterFlowFactory';
export type { IPaymasterFlow } from './IPaymasterFlow';
export { IZkSyncFactory } from './IZkSyncFactory';
export type { IZkSync } from './IZkSync';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IEthTokenFactory = exports.IAllowListFactory = exports.IL2BridgeFactory = exports.IL1BridgeFactory = exports.IERC20MetadataFactory = exports.IZkSyncFactory = void 0;
var IZkSyncFactory_1 = require("./IZkSyncFactory");
Object.defineProperty(exports, "IZkSyncFactory", { enumerable: true, get: function () { return IZkSyncFactory_1.IZkSyncFactory; } });
var IERC20MetadataFactory_1 = require("./IERC20MetadataFactory");
Object.defineProperty(exports, "IERC20MetadataFactory", { enumerable: true, get: function () { return IERC20MetadataFactory_1.IERC20MetadataFactory; } });
exports.IZkSyncFactory = exports.IPaymasterFlowFactory = exports.IL2BridgeFactory = exports.IL1MessengerFactory = exports.IL1BridgeFactory = exports.IEthTokenFactory = exports.IERC1271Factory = exports.IERC20Factory = exports.IAllowListFactory = exports.ContractDeployerFactory = void 0;
var ContractDeployerFactory_1 = require("./ContractDeployerFactory");
Object.defineProperty(exports, "ContractDeployerFactory", { enumerable: true, get: function () { return ContractDeployerFactory_1.ContractDeployerFactory; } });
var IAllowListFactory_1 = require("./IAllowListFactory");
Object.defineProperty(exports, "IAllowListFactory", { enumerable: true, get: function () { return IAllowListFactory_1.IAllowListFactory; } });
var IERC20Factory_1 = require("./IERC20Factory");
Object.defineProperty(exports, "IERC20Factory", { enumerable: true, get: function () { return IERC20Factory_1.IERC20Factory; } });
var IERC1271Factory_1 = require("./IERC1271Factory");
Object.defineProperty(exports, "IERC1271Factory", { enumerable: true, get: function () { return IERC1271Factory_1.IERC1271Factory; } });
var IEthTokenFactory_1 = require("./IEthTokenFactory");
Object.defineProperty(exports, "IEthTokenFactory", { enumerable: true, get: function () { return IEthTokenFactory_1.IEthTokenFactory; } });
var IL1BridgeFactory_1 = require("./IL1BridgeFactory");
Object.defineProperty(exports, "IL1BridgeFactory", { enumerable: true, get: function () { return IL1BridgeFactory_1.IL1BridgeFactory; } });
var IL1MessengerFactory_1 = require("./IL1MessengerFactory");
Object.defineProperty(exports, "IL1MessengerFactory", { enumerable: true, get: function () { return IL1MessengerFactory_1.IL1MessengerFactory; } });
var IL2BridgeFactory_1 = require("./IL2BridgeFactory");
Object.defineProperty(exports, "IL2BridgeFactory", { enumerable: true, get: function () { return IL2BridgeFactory_1.IL2BridgeFactory; } });
var IAllowListFactory_1 = require("./IAllowListFactory");
Object.defineProperty(exports, "IAllowListFactory", { enumerable: true, get: function () { return IAllowListFactory_1.IAllowListFactory; } });
var IEthTokenFactory_1 = require("./IEthTokenFactory");
Object.defineProperty(exports, "IEthTokenFactory", { enumerable: true, get: function () { return IEthTokenFactory_1.IEthTokenFactory; } });
var IPaymasterFlowFactory_1 = require("./IPaymasterFlowFactory");
Object.defineProperty(exports, "IPaymasterFlowFactory", { enumerable: true, get: function () { return IPaymasterFlowFactory_1.IPaymasterFlowFactory; } });
var IZkSyncFactory_1 = require("./IZkSyncFactory");
Object.defineProperty(exports, "IZkSyncFactory", { enumerable: true, get: function () { return IZkSyncFactory_1.IZkSyncFactory; } });

@@ -215,40 +215,2 @@ "use strict";

indexed: true,
internalType: "bytes32",
name: "previousBytecodeHash",
type: "bytes32",
},
{
indexed: true,
internalType: "bytes32",
name: "newBytecodeHash",
type: "bytes32",
},
],
name: "NewL2BootloaderBytecodeHash",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "bytes32",
name: "previousBytecodeHash",
type: "bytes32",
},
{
indexed: true,
internalType: "bytes32",
name: "newBytecodeHash",
type: "bytes32",
},
],
name: "NewL2DefaultAccountBytecodeHash",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",

@@ -411,74 +373,2 @@ name: "oldPendingGovernor",

indexed: true,
internalType: "address",
name: "oldVerifier",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "newVerifier",
type: "address",
},
],
name: "NewVerifier",
type: "event",
},
{
anonymous: false,
inputs: [
{
components: [
{
internalType: "bytes32",
name: "recursionNodeLevelVkHash",
type: "bytes32",
},
{
internalType: "bytes32",
name: "recursionLeafLevelVkHash",
type: "bytes32",
},
{
internalType: "bytes32",
name: "recursionCircuitsSetVksHash",
type: "bytes32",
},
],
indexed: false,
internalType: "struct VerifierParams",
name: "oldVerifierParams",
type: "tuple",
},
{
components: [
{
internalType: "bytes32",
name: "recursionNodeLevelVkHash",
type: "bytes32",
},
{
internalType: "bytes32",
name: "recursionLeafLevelVkHash",
type: "bytes32",
},
{
internalType: "bytes32",
name: "recursionCircuitsSetVksHash",
type: "bytes32",
},
],
indexed: false,
internalType: "struct VerifierParams",
name: "newVerifierParams",
type: "tuple",
},
],
name: "NewVerifierParams",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "uint256",

@@ -978,2 +868,15 @@ name: "proposalId",

inputs: [],
name: "getAllowList",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "getCurrentProposalId",

@@ -1070,2 +973,15 @@ outputs: [

inputs: [],
name: "getPriorityTxMaxGasLimit",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "getProposedUpgradeHash",

@@ -1097,2 +1013,15 @@ outputs: [

inputs: [],
name: "getProtocolVersion",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "getSecurityCouncil",

@@ -1219,15 +1148,2 @@ outputs: [

inputs: [],
name: "getpriorityTxMaxGasLimit",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "isApprovedBySecurityCouncil",

@@ -1849,28 +1765,2 @@ outputs: [

{
internalType: "bytes32",
name: "_l2BootloaderBytecodeHash",
type: "bytes32",
},
],
name: "setL2BootloaderBytecodeHash",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "bytes32",
name: "_l2DefaultAccountBytecodeHash",
type: "bytes32",
},
],
name: "setL2DefaultAccountBytecodeHash",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address",

@@ -1933,45 +1823,2 @@ name: "_newPendingGovernor",

{
internalType: "contract Verifier",
name: "_newVerifier",
type: "address",
},
],
name: "setVerifier",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
components: [
{
internalType: "bytes32",
name: "recursionNodeLevelVkHash",
type: "bytes32",
},
{
internalType: "bytes32",
name: "recursionLeafLevelVkHash",
type: "bytes32",
},
{
internalType: "bytes32",
name: "recursionCircuitsSetVksHash",
type: "bytes32",
},
],
internalType: "struct VerifierParams",
name: "_newVerifierParams",
type: "tuple",
},
],
name: "setVerifierParams",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "uint256",

@@ -1978,0 +1825,0 @@ name: "_blockNumber",

{
"name": "zksync-web3",
"version": "0.15.4",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"files": [
"build/",
"abi/",
"src/",
"typechain/"
],
"license": "MIT",
"devDependencies": {
"@types/chai": "^4.2.19",
"@types/mocha": "^8.2.2",
"@types/node": "^16.0.0",
"chai": "^4.3.4",
"ethers": "~5.7.0",
"mocha": "^9.0.2",
"ts-node": "^10.0.0",
"typescript": "^4.3.5"
},
"peerDependencies": {
"ethers": "^5.7.0"
},
"scripts": {
"tests": "mocha -r ts-node/register tests/**/*.test.ts",
"build": "tsc && cp -f typechain/*.d.ts build/typechain",
"watch": "tsc --watch"
}
"name": "zksync-web3",
"version": "0.15.5",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"description": "A Web3 library for interacting with the ZkSync Layer 2 scaling solution.",
"files": [
"build/",
"abi/",
"src/",
"typechain/"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/zksync-sdk/zksync2-js.git"
},
"bugs": {
"url": "https://github.com/zksync-sdk/zksync2-js/issues"
},
"homepage": "https://github.com/zksync-sdk/zksync2-js/tree/ethers-v5#readme",
"keywords": [
"zksync",
"web3",
"ethereum",
"layer2"
],
"dependencies": {
"ethers": "~5.7.0"
},
"devDependencies": {
"@typechain/ethers-v5": "^2.0.0",
"@types/chai": "^4.2.19",
"@types/mocha": "^8.2.2",
"@types/node": "^16.0.0",
"chai": "^4.3.4",
"ethers": "~5.7.0",
"mocha": "10.1.0",
"ncp": "^2.0.0",
"prettier": "3.0.3",
"ts-node": "^10.0.0",
"typechain": "^3.0.0",
"typescript": "^4.3.5"
},
"peerDependencies": {
"ethers": "~5.7.0"
},
"scripts": {
"test": "mocha -r ts-node/register --bail tests/setup.test.ts tests/unit/*.test.ts tests/integration/*.test.ts",
"build": "tsc && cp -f typechain/*.d.ts build/typechain && ncp ./abi ./build/abi",
"lint": "prettier . --write",
"lint:check": "prettier . --check",
"watch": "tsc --watch",
"types": "find ./abi -name \"*.json\" -print0 | xargs -0 -I {} npx typechain --target ethers-v5 --outDir typechain {}"
},
"publishConfig": {
"access": "public"
}
}

@@ -1,5 +0,10 @@

import { BigNumber, BigNumberish, BytesLike, ethers } from 'ethers';
import { IERC20MetadataFactory, IL1BridgeFactory, IL2BridgeFactory, IZkSyncFactory } from '../typechain';
import { Provider } from './provider';
import { BigNumber, BigNumberish, BytesLike, ethers } from "ethers";
import {
IERC20Factory,
IL1BridgeFactory,
IL2BridgeFactory,
IZkSyncFactory,
} from "../typechain";
import { Provider } from "./provider";
import {
Address,

@@ -11,4 +16,4 @@ BalancesMap,

PriorityOpResponse,
TransactionResponse
} from './types';
TransactionResponse,
} from "./types";
import {

@@ -18,15 +23,15 @@ BOOTLOADER_FORMAL_ADDRESS,

DEFAULT_GAS_PER_PUBDATA_LIMIT,
REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT,
estimateCustomBridgeDepositL2Gas,
estimateDefaultBridgeDepositL2Gas,
ETH_ADDRESS,
getERC20DefaultBridgeData,
isETH,
L1_MESSENGER_ADDRESS,
L1_RECOMMENDED_MIN_ERC20_DEPOSIT_GAS_LIMIT,
L1_RECOMMENDED_MIN_ETH_DEPOSIT_GAS_LIMIT,
layer1TxDefaults,
REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT,
scaleGasLimit,
undoL1ToL2Alias,
estimateDefaultBridgeDepositL2Gas,
scaleGasLimit,
L1_RECOMMENDED_MIN_ETH_DEPOSIT_GAS_LIMIT,
L1_RECOMMENDED_MIN_ERC20_DEPOSIT_GAS_LIMIT,
estimateCustomBridgeDepositL2Gas,
getERC20DefaultBridgeData
} from './utils';
} from "./utils";

@@ -36,3 +41,5 @@ type Constructor<T = {}> = new (...args: any[]) => T;

interface TxSender {
sendTransaction(tx: ethers.providers.TransactionRequest): Promise<ethers.providers.TransactionResponse>;
sendTransaction(
tx: ethers.providers.TransactionRequest,
): Promise<ethers.providers.TransactionResponse>;
getAddress(): Promise<Address>;

@@ -44,9 +51,9 @@ }

_providerL2(): Provider {
throw new Error('Must be implemented by the derived class!');
throw new Error("Must be implemented by the derived class!");
}
_providerL1(): ethers.providers.Provider {
throw new Error('Must be implemented by the derived class!');
throw new Error("Must be implemented by the derived class!");
}
_signerL1(): ethers.Signer {
throw new Error('Must be implemented by the derived class!');
throw new Error("Must be implemented by the derived class!");
}

@@ -63,7 +70,10 @@

erc20: IL1BridgeFactory.connect(addresses.erc20L1, this._signerL1()),
weth: IL1BridgeFactory.connect(addresses.wethL1, this._signerL1())
weth: IL1BridgeFactory.connect(addresses.wethL1, this._signerL1()),
};
}
async getBalanceL1(token?: Address, blockTag?: ethers.providers.BlockTag): Promise<BigNumber> {
async getBalanceL1(
token?: Address,
blockTag?: ethers.providers.BlockTag,
): Promise<BigNumber> {
token ??= ETH_ADDRESS;

@@ -73,3 +83,3 @@ if (isETH(token)) {

} else {
const erc20contract = IERC20MetadataFactory.connect(token, this._providerL1());
const erc20contract = IERC20Factory.connect(token, this._providerL1());
return await erc20contract.balanceOf(await this.getAddress());

@@ -82,7 +92,11 @@ }

bridgeAddress?: Address,
blockTag?: ethers.providers.BlockTag
blockTag?: ethers.providers.BlockTag,
): Promise<BigNumber> {
if (!bridgeAddress) {
const bridgeContracts = await this.getL1BridgeContracts();
const l2WethToken = await bridgeContracts.weth.l2TokenAddress(token);
let l2WethToken = ethers.constants.AddressZero;
try {
l2WethToken = await bridgeContracts.weth.l2TokenAddress(token);
} catch (e) {}
// If the token is Wrapped Ether, return allowance to its own bridge, otherwise to the default ERC20 bridge.

@@ -95,4 +109,6 @@ bridgeAddress =

const erc20contract = IERC20MetadataFactory.connect(token, this._providerL1());
return await erc20contract.allowance(await this.getAddress(), bridgeAddress, { blockTag });
const erc20contract = IERC20Factory.connect(token, this._providerL1());
return await erc20contract.allowance(await this.getAddress(), bridgeAddress, {
blockTag,
});
}

@@ -106,8 +122,9 @@

const bridgeContracts = await this.getL1BridgeContracts();
const l2WethToken = await bridgeContracts.weth.l2TokenAddress(token);
// If the token is Wrapped Ether, return its L2 token address.
if (l2WethToken != ethers.constants.AddressZero) {
return l2WethToken;
}
try {
const l2WethToken = await bridgeContracts.weth.l2TokenAddress(token);
// If the token is Wrapped Ether, return its L2 token address.
if (l2WethToken != ethers.constants.AddressZero) {
return l2WethToken;
}
} catch (e) {}
return await bridgeContracts.erc20.l2TokenAddress(token);

@@ -119,14 +136,19 @@ }

amount: BigNumberish,
overrides?: ethers.Overrides & { bridgeAddress?: Address }
overrides?: ethers.Overrides & { bridgeAddress?: Address },
): Promise<ethers.providers.TransactionResponse> {
if (isETH(token)) {
throw new Error("ETH token can't be approved. The address of the token does not exist on L1.");
throw new Error(
"ETH token can't be approved. The address of the token does not exist on L1.",
);
}
let bridgeAddress = overrides?.bridgeAddress;
const erc20contract = IERC20MetadataFactory.connect(token, this._signerL1());
const erc20contract = IERC20Factory.connect(token, this._signerL1());
if (bridgeAddress == null) {
const bridgeContracts = await this.getL1BridgeContracts();
const l2WethToken = await bridgeContracts.weth.l2TokenAddress(token);
let l2WethToken = ethers.constants.AddressZero;
try {
l2WethToken = await bridgeContracts.weth.l2TokenAddress(token);
} catch (e) {}
// If the token is Wrapped Ether, return corresponding bridge, otherwise return default ERC20 bridge

@@ -160,4 +182,4 @@ bridgeAddress =

parameters.gasLimit,
parameters.gasPerPubdataByte
)
parameters.gasPerPubdataByte,
),
);

@@ -193,3 +215,8 @@ }

if (transaction.approveERC20) {
const l2WethToken = await bridgeContracts.weth.l2TokenAddress(transaction.token);
let l2WethToken = ethers.constants.AddressZero;
try {
l2WethToken = await bridgeContracts.weth.l2TokenAddress(
transaction.token,
);
} catch (e) {}
// If the token is Wrapped Ether, use its bridge.

@@ -200,11 +227,20 @@ const proposedBridge =

: bridgeContracts.erc20.address;
const bridgeAddress = transaction.bridgeAddress ? transaction.bridgeAddress : proposedBridge;
const bridgeAddress = transaction.bridgeAddress
? transaction.bridgeAddress
: proposedBridge;
// We only request the allowance if the current one is not enough.
const allowance = await this.getAllowanceL1(transaction.token, bridgeAddress);
const allowance = await this.getAllowanceL1(
transaction.token,
bridgeAddress,
);
if (allowance.lt(transaction.amount)) {
const approveTx = await this.approveERC20(transaction.token, transaction.amount, {
bridgeAddress,
...transaction.approveOverrides
});
const approveTx = await this.approveERC20(
transaction.token,
transaction.amount,
{
bridgeAddress,
...transaction.approveOverrides,
},
);
await approveTx.wait();

@@ -220,3 +256,3 @@ }

return await this._providerL2().getPriorityOpResponse(
await this._signerL1().sendTransaction(depositTx)
await this._signerL1().sendTransaction(depositTx),
);

@@ -264,3 +300,5 @@ }

if (transaction.bridgeAddress != null) {
bridgeContracts.erc20 = bridgeContracts.erc20.attach(transaction.bridgeAddress);
bridgeContracts.erc20 = bridgeContracts.erc20.attach(
transaction.bridgeAddress,
);
}

@@ -276,3 +314,3 @@

tx.customBridgeData ?? bridgeContracts.weth.address == tx.bridgeAddress
? '0x'
? "0x"
: await getERC20DefaultBridgeData(tx.token, this._providerL1());

@@ -290,3 +328,3 @@ const bridge = IL1BridgeFactory.connect(tx.bridgeAddress, this._signerL1());

await this.getAddress(),
tx.gasPerPubdataByte
tx.gasPerPubdataByte,
);

@@ -301,3 +339,3 @@ } else {

await this.getAddress(),
tx.gasPerPubdataByte
tx.gasPerPubdataByte,
);

@@ -316,3 +354,3 @@ }

tx.l2GasLimit,
tx.gasPerPubdataByte
tx.gasPerPubdataByte,
);

@@ -325,3 +363,3 @@

contractAddress: to,
calldata: '0x',
calldata: "0x",
l2Value: amount,

@@ -331,14 +369,14 @@ // For some reason typescript can not deduce that we've already set the

l2GasLimit: tx.l2GasLimit!,
...tx
...tx,
};
} else {
let refundRecipient = tx.refundRecipient ?? ethers.constants.AddressZero;
const args: [Address, Address, BigNumberish, BigNumberish, BigNumberish, Address] = [
to,
token,
amount,
tx.l2GasLimit,
tx.gasPerPubdataByte,
refundRecipient
];
const args: [
Address,
Address,
BigNumberish,
BigNumberish,
BigNumberish,
Address,
] = [to, token, amount, tx.l2GasLimit, tx.gasPerPubdataByte, refundRecipient];

@@ -348,5 +386,11 @@ overrides.value ??= baseCost.add(operatorTip);

const l2WethToken = await bridgeContracts.weth.l2TokenAddress(tx.token);
let l2WethToken = ethers.constants.AddressZero;
try {
l2WethToken = await bridgeContracts.weth.l2TokenAddress(tx.token);
} catch (e) {}
const bridge =
l2WethToken != ethers.constants.AddressZero ? bridgeContracts.weth : bridgeContracts.erc20;
l2WethToken != ethers.constants.AddressZero
? bridgeContracts.weth
: bridgeContracts.erc20;
return await bridge.populateTransaction.deposit(...args, overrides);

@@ -367,3 +411,3 @@ }

// It is assumed that the L2 fee for the transaction does not depend on its value.
const dummyAmount = '1';
const dummyAmount = "1";

@@ -375,3 +419,4 @@ const { ...tx } = transaction;

await insertGasPrice(this._providerL1(), tx.overrides);
const gasPriceForMessages = (await tx.overrides.maxFeePerGas) || (await tx.overrides.gasPrice);
const gasPriceForMessages =
(await tx.overrides.maxFeePerGas) || (await tx.overrides.gasPrice);

@@ -381,3 +426,3 @@ tx.to ??= await this.getAddress();

let l2GasLimit;
let l2GasLimit = null;
if (tx.bridgeAddress != null) {

@@ -387,3 +432,3 @@ const bridgeContracts = await this.getL1BridgeContracts();

tx.customBridgeData ?? bridgeContracts.weth.address == tx.bridgeAddress
? '0x'
? "0x"
: await getERC20DefaultBridgeData(tx.token, this._providerL1());

@@ -401,3 +446,3 @@ let bridge = IL1BridgeFactory.connect(tx.bridgeAddress, this._signerL1());

await this.getAddress(),
tx.gasPerPubdataByte
tx.gasPerPubdataByte,
);

@@ -412,3 +457,3 @@ } else {

await this.getAddress(),
tx.gasPerPubdataByte
tx.gasPerPubdataByte,
);

@@ -420,3 +465,3 @@ }

l2GasLimit,
tx.gasPerPubdataByte
tx.gasPerPubdataByte,
);

@@ -426,3 +471,3 @@

// We could 0 in, because the final fee will anyway be bigger than
// We could use 0, because the final fee will anyway be bigger than
if (baseCost.gte(selfBalanceETH.add(dummyAmount))) {

@@ -432,9 +477,10 @@ const recommendedETHBalance = BigNumber.from(

? L1_RECOMMENDED_MIN_ETH_DEPOSIT_GAS_LIMIT
: L1_RECOMMENDED_MIN_ERC20_DEPOSIT_GAS_LIMIT
: L1_RECOMMENDED_MIN_ERC20_DEPOSIT_GAS_LIMIT,
)
.mul(gasPriceForMessages)
.add(baseCost);
const formattedRecommendedBalance = ethers.utils.formatEther(recommendedETHBalance);
const formattedRecommendedBalance =
ethers.utils.formatEther(recommendedETHBalance);
throw new Error(
`Not enough balance for deposit. Under the provided gas price, the recommended balance to perform a deposit is ${formattedRecommendedBalance} ETH`
`Not enough balance for deposit. Under the provided gas price, the recommended balance to perform a deposit is ${formattedRecommendedBalance} ETH`,
);

@@ -444,3 +490,3 @@ }

// For ETH token the value that the user passes to the estimation is the one which has the
// value for the L2 comission substracted.
// value for the L2 commission substracted.
let amountForEstimate: BigNumber;

@@ -453,3 +499,3 @@ if (isETH(tx.token)) {

if ((await this.getAllowanceL1(tx.token)) < amountForEstimate) {
throw new Error('Not enough allowance to cover the deposit');
throw new Error("Not enough allowance to cover the deposit");
}

@@ -470,3 +516,3 @@ }

overrides: estimationOverrides,
l2GasLimit
l2GasLimit,
});

@@ -477,3 +523,3 @@

l1GasLimit,
l2GasLimit
l2GasLimit,
};

@@ -485,3 +531,5 @@

fullCost.maxFeePerGas = BigNumber.from(await tx.overrides.maxFeePerGas);
fullCost.maxPriorityFeePerGas = BigNumber.from(await tx.overrides.maxPriorityFeePerGas);
fullCost.maxPriorityFeePerGas = BigNumber.from(
await tx.overrides.maxPriorityFeePerGas,
);
}

@@ -498,3 +546,3 @@

log.address == L1_MESSENGER_ADDRESS &&
log.topics[0] == ethers.utils.id('L1MessageSent(address,bytes32,bytes)')
log.topics[0] == ethers.utils.id("L1MessageSent(address,bytes32,bytes)"),
)[index];

@@ -504,3 +552,3 @@

log,
l1BatchTxId: receipt.l1BatchTxIndex
l1BatchTxId: receipt.l1BatchTxIndex,
};

@@ -513,3 +561,3 @@ }

const messages = Array.from(receipt.l2ToL1Logs.entries()).filter(
([_, log]) => log.sender == L1_MESSENGER_ADDRESS
([_, log]) => log.sender == L1_MESSENGER_ADDRESS,
);

@@ -520,3 +568,3 @@ const [l2ToL1LogIndex, l2ToL1Log] = messages[index];

l2ToL1LogIndex,
l2ToL1Log
l2ToL1Log,
};

@@ -527,6 +575,9 @@ }

const { log, l1BatchTxId } = await this._getWithdrawalLog(withdrawalHash, index);
const { l2ToL1LogIndex } = await this._getWithdrawalL2ToL1Log(withdrawalHash, index);
const { l2ToL1LogIndex } = await this._getWithdrawalL2ToL1Log(
withdrawalHash,
index,
);
const sender = ethers.utils.hexDataSlice(log.topics[1], 12);
const proof = await this._providerL2().getLogProof(withdrawalHash, l2ToL1LogIndex);
const message = ethers.utils.defaultAbiCoder.decode(['bytes'], log.data)[0];
const message = ethers.utils.defaultAbiCoder.decode(["bytes"], log.data)[0];
return {

@@ -538,9 +589,19 @@ l1BatchNumber: log.l1BatchNumber,

sender,
proof: proof.proof
proof: proof.proof,
};
}
async finalizeWithdrawal(withdrawalHash: BytesLike, index: number = 0, overrides?: ethers.Overrides) {
const { l1BatchNumber, l2MessageIndex, l2TxNumberInBlock, message, sender, proof } =
await this.finalizeWithdrawalParams(withdrawalHash, index);
async finalizeWithdrawal(
withdrawalHash: BytesLike,
index: number = 0,
overrides?: ethers.Overrides,
) {
const {
l1BatchNumber,
l2MessageIndex,
l2TxNumberInBlock,
message,
sender,
proof,
} = await this.finalizeWithdrawalParams(withdrawalHash, index);

@@ -559,3 +620,3 @@ if (isETH(sender)) {

proof,
overrides ?? {}
overrides ?? {},
);

@@ -573,3 +634,3 @@ }

proof,
overrides ?? {}
overrides ?? {},
);

@@ -579,3 +640,6 @@ }

const l2Bridge = IL2BridgeFactory.connect(sender, this._providerL2());
const l1Bridge = IL1BridgeFactory.connect(await l2Bridge.l1Bridge(), this._signerL1());
const l1Bridge = IL1BridgeFactory.connect(
await l2Bridge.l1Bridge(),
this._signerL1(),
);
return await l1Bridge.finalizeWithdrawal(

@@ -587,3 +651,3 @@ l1BatchNumber,

proof,
overrides ?? {}
overrides ?? {},
);

@@ -594,3 +658,6 @@ }

const { log } = await this._getWithdrawalLog(withdrawalHash, index);
const { l2ToL1LogIndex } = await this._getWithdrawalL2ToL1Log(withdrawalHash, index);
const { l2ToL1LogIndex } = await this._getWithdrawalL2ToL1Log(
withdrawalHash,
index,
);
const sender = ethers.utils.hexDataSlice(log.topics[1], 12);

@@ -610,3 +677,6 @@ // `getLogProof` is called not to get proof but

const l2Bridge = IL2BridgeFactory.connect(sender, this._providerL2());
const l1Bridge = IL1BridgeFactory.connect(await l2Bridge.l1Bridge(), this._providerL1());
const l1Bridge = IL1BridgeFactory.connect(
await l2Bridge.l1Bridge(),
this._providerL1(),
);

@@ -617,12 +687,18 @@ return await l1Bridge.isWithdrawalFinalized(log.l1BatchNumber, proof.id);

async claimFailedDeposit(depositHash: BytesLike, overrides?: ethers.Overrides) {
const receipt = await this._providerL2().getTransactionReceipt(ethers.utils.hexlify(depositHash));
const receipt = await this._providerL2().getTransactionReceipt(
ethers.utils.hexlify(depositHash),
);
const successL2ToL1LogIndex = receipt.l2ToL1Logs.findIndex(
(l2ToL1log) => l2ToL1log.sender == BOOTLOADER_FORMAL_ADDRESS && l2ToL1log.key == depositHash
(l2ToL1log) =>
l2ToL1log.sender == BOOTLOADER_FORMAL_ADDRESS &&
l2ToL1log.key == depositHash,
);
const successL2ToL1Log = receipt.l2ToL1Logs[successL2ToL1LogIndex];
if (successL2ToL1Log.value != ethers.constants.HashZero) {
throw new Error('Cannot claim successful deposit');
throw new Error("Cannot claim successful deposit");
}
const tx = await this._providerL2().getTransaction(ethers.utils.hexlify(depositHash));
const tx = await this._providerL2().getTransaction(
ethers.utils.hexlify(depositHash),
);

@@ -636,8 +712,11 @@ // Undo the aliasing, since the Mailbox contract set it as for contract address.

const calldata = l2Bridge.interface.decodeFunctionData('finalizeDeposit', tx.data);
const calldata = l2Bridge.interface.decodeFunctionData("finalizeDeposit", tx.data);
const proof = await this._providerL2().getLogProof(depositHash, successL2ToL1LogIndex);
const proof = await this._providerL2().getLogProof(
depositHash,
successL2ToL1LogIndex,
);
return await l1Bridge.claimFailedDeposit(
calldata['_l1Sender'],
calldata['_l1Token'],
calldata["_l1Sender"],
calldata["_l1Token"],
depositHash,

@@ -648,3 +727,3 @@ receipt.l1BatchNumber,

proof.proof,
overrides ?? {}
overrides ?? {},
);

@@ -665,3 +744,5 @@ }

const requestExecuteTx = await this.getRequestExecuteTx(transaction);
return this._providerL2().getPriorityOpResponse(await this._signerL1().sendTransaction(requestExecuteTx));
return this._providerL2().getPriorityOpResponse(
await this._signerL1().sendTransaction(requestExecuteTx),
);
}

@@ -720,3 +801,3 @@

gasPerPubdataByte,
refundRecipient
refundRecipient,
} = tx;

@@ -730,3 +811,3 @@

gasPerPubdataByte,
gasLimit: l2GasLimit
gasLimit: l2GasLimit,
});

@@ -746,3 +827,3 @@

refundRecipient,
overrides
overrides,
);

@@ -756,10 +837,14 @@ }

_providerL2(): Provider {
throw new Error('Must be implemented by the derived class!');
throw new Error("Must be implemented by the derived class!");
}
_signerL2(): ethers.Signer {
throw new Error('Must be implemented by the derived class!');
throw new Error("Must be implemented by the derived class!");
}
async getBalance(token?: Address, blockTag: BlockTag = 'committed') {
return await this._providerL2().getBalance(await this.getAddress(), blockTag, token);
async getBalance(token?: Address, blockTag: BlockTag = "committed") {
return await this._providerL2().getBalance(
await this.getAddress(),
blockTag,
token,
);
}

@@ -775,3 +860,3 @@

erc20: IL2BridgeFactory.connect(addresses.erc20L2, this._signerL2()),
weth: IL2BridgeFactory.connect(addresses.wethL2, this._signerL2())
weth: IL2BridgeFactory.connect(addresses.wethL2, this._signerL2()),
};

@@ -796,3 +881,3 @@ }

from: await this.getAddress(),
...transaction
...transaction,
});

@@ -811,3 +896,3 @@ const txResponse = await this.sendTransaction(withdrawTx);

from: await this.getAddress(),
...transaction
...transaction,
});

@@ -822,3 +907,6 @@ const txResponse = await this.sendTransaction(transferTx);

/// the maxFeePerGas
async function insertGasPrice(l1Provider: ethers.providers.Provider, overrides: ethers.PayableOverrides) {
async function insertGasPrice(
l1Provider: ethers.providers.Provider,
overrides: ethers.PayableOverrides,
) {
if (!overrides.gasPrice && !overrides.maxFeePerGas) {

@@ -830,9 +918,7 @@ const l1FeeData = await l1Provider.getFeeData();

// ethers.js by default uses multiplcation by 2, but since the price for the L2 part
// ethers.js by default uses multiplication by 2, but since the price for the L2 part
// will depend on the L1 part, doubling base fee is typically too much.
const maxFeePerGas = baseFee.mul(3).div(2).add(l1FeeData.maxPriorityFeePerGas);
overrides.maxFeePerGas = maxFeePerGas;
overrides.maxFeePerGas = baseFee.mul(3).div(2).add(l1FeeData.maxPriorityFeePerGas);
overrides.maxPriorityFeePerGas = l1FeeData.maxPriorityFeePerGas;
}
}

@@ -1,2 +0,2 @@

import { BigNumber, BigNumberish, ethers, utils } from 'ethers';
import { BigNumber, BigNumberish, ethers, utils } from "ethers";

@@ -33,3 +33,3 @@ interface CallDataParams {

if (bytes.length < 4) {
throw new Error('No function selector found');
throw new Error("No function selector found");
}

@@ -42,3 +42,3 @@

if (bytes.length % 32 !== 4) {
throw new Error('Unsupported arguments alignment');
throw new Error("Unsupported arguments alignment");
}

@@ -55,3 +55,3 @@

input,
...params
...params,
};

@@ -94,3 +94,6 @@ }

buffer.set(argument.slice(SELECTOR_SIZE_BYTES), offset);
buffer.set(argument.slice(0, SELECTOR_SIZE_BYTES), offset + 2 * FIELD_SIZE - SELECTOR_SIZE_BYTES);
buffer.set(
argument.slice(0, SELECTOR_SIZE_BYTES),
offset + 2 * FIELD_SIZE - SELECTOR_SIZE_BYTES,
);
}

@@ -97,0 +100,0 @@

@@ -1,4 +0,4 @@

import { Wallet } from './wallet';
import { Signer } from './signer';
import { BytesLike, Contract, ContractInterface, ethers, utils } from 'ethers';
import { Wallet } from "./wallet";
import { Signer } from "./signer";
import { BytesLike, Contract, ContractInterface, ethers, utils } from "ethers";
import {

@@ -10,6 +10,6 @@ hashBytecode,

getDeployedContracts,
DEFAULT_GAS_PER_PUBDATA_LIMIT
} from './utils';
import { AccountAbstractionVersion, DeploymentType } from './types';
export { Contract } from 'ethers';
DEFAULT_GAS_PER_PUBDATA_LIMIT,
} from "./utils";
import { AccountAbstractionVersion, DeploymentType } from "./types";
export { Contract } from "ethers";

@@ -24,18 +24,26 @@ export class ContractFactory extends ethers.ContractFactory {

signer: Wallet | Signer,
deploymentType?: DeploymentType
deploymentType?: DeploymentType,
) {
super(abi, bytecode, signer);
this.deploymentType = deploymentType || 'create';
this.deploymentType = deploymentType || "create";
}
private encodeCalldata(salt: BytesLike, bytecodeHash: BytesLike, constructorCalldata: BytesLike) {
if (this.deploymentType == 'create') {
return CONTRACT_DEPLOYER.encodeFunctionData('create', [salt, bytecodeHash, constructorCalldata]);
} else if (this.deploymentType == 'createAccount') {
return CONTRACT_DEPLOYER.encodeFunctionData('createAccount', [
private encodeCalldata(
salt: BytesLike,
bytecodeHash: BytesLike,
constructorCalldata: BytesLike,
) {
if (this.deploymentType == "create") {
return CONTRACT_DEPLOYER.encodeFunctionData("create", [
salt,
bytecodeHash,
constructorCalldata,
AccountAbstractionVersion.Version1
]);
} else if (this.deploymentType == "createAccount") {
return CONTRACT_DEPLOYER.encodeFunctionData("createAccount", [
salt,
bytecodeHash,
constructorCalldata,
AccountAbstractionVersion.Version1,
]);
} else {

@@ -48,3 +56,3 @@ throw new Error(`Unsupported deployment type ${this.deploymentType}`);

// TODO (SMA-1585): Users should be able to provide the salt.
let salt = '0x0000000000000000000000000000000000000000000000000000000000000000';
let salt = "0x0000000000000000000000000000000000000000000000000000000000000000";

@@ -83,3 +91,5 @@ // The overrides will be popped out in this call:

const deployedAddresses = getDeployedContracts(deployTxReceipt).map((info) => info.deployedAddress);
const deployedAddresses = getDeployedContracts(deployTxReceipt).map(
(info) => info.deployedAddress,
);

@@ -89,7 +99,11 @@ const contractWithCorrectAddress = new ethers.Contract(

contract.interface,
contract.signer
contract.signer,
);
utils.defineReadOnly(contractWithCorrectAddress, 'deployTransaction', contract.deployTransaction);
utils.defineReadOnly(
contractWithCorrectAddress,
"deployTransaction",
contract.deployTransaction,
);
return contractWithCorrectAddress;
}
}

@@ -1,6 +0,6 @@

export * as utils from './utils';
export * as types from './types';
export { EIP712Signer, Signer, L1Signer, L1VoidSigner, L2VoidSigner } from './signer';
export { Wallet } from './wallet';
export { Web3Provider, Provider } from './provider';
export { ContractFactory, Contract } from './contract';
export * as utils from "./utils";
export * as types from "./types";
export { EIP712Signer, Signer, L1Signer, L1VoidSigner, L2VoidSigner } from "./signer";
export { Wallet } from "./wallet";
export { Web3Provider, Provider } from "./provider";
export { ContractFactory, Contract } from "./contract";

@@ -1,12 +0,22 @@

import { BytesLike, ethers } from 'ethers';
import { BytesLike, ethers } from "ethers";
import { Address, ApprovalBasedPaymasterInput, GeneralPaymasterInput, PaymasterInput, PaymasterParams } from './types';
import {
Address,
ApprovalBasedPaymasterInput,
GeneralPaymasterInput,
PaymasterInput,
PaymasterParams,
} from "./types";
export const IPaymasterFlow = new ethers.utils.Interface(require('../../abi/IPaymasterFlow.json').abi);
export const IPaymasterFlow = new ethers.utils.Interface(
require("../abi/IPaymasterFlow.json").abi,
);
export function getApprovalBasedPaymasterInput(paymasterInput: ApprovalBasedPaymasterInput): BytesLike {
return IPaymasterFlow.encodeFunctionData('approvalBased', [
export function getApprovalBasedPaymasterInput(
paymasterInput: ApprovalBasedPaymasterInput,
): BytesLike {
return IPaymasterFlow.encodeFunctionData("approvalBased", [
paymasterInput.token,
paymasterInput.minimalAllowance,
paymasterInput.innerInput
paymasterInput.innerInput,
]);

@@ -16,10 +26,13 @@ }

export function getGeneralPaymasterInput(paymasterInput: GeneralPaymasterInput): BytesLike {
return IPaymasterFlow.encodeFunctionData('general', [paymasterInput.innerInput]);
return IPaymasterFlow.encodeFunctionData("general", [paymasterInput.innerInput]);
}
export function getPaymasterParams(paymasterAddress: Address, paymasterInput: PaymasterInput): PaymasterParams {
if (paymasterInput.type == 'General') {
export function getPaymasterParams(
paymasterAddress: Address,
paymasterInput: PaymasterInput,
): PaymasterParams {
if (paymasterInput.type == "General") {
return {
paymaster: paymasterAddress,
paymasterInput: getGeneralPaymasterInput(paymasterInput)
paymasterInput: getGeneralPaymasterInput(paymasterInput),
};

@@ -29,5 +42,5 @@ } else {

paymaster: paymasterAddress,
paymasterInput: getApprovalBasedPaymasterInput(paymasterInput)
paymasterInput: getApprovalBasedPaymasterInput(paymasterInput),
};
}
}

@@ -1,39 +0,47 @@

import { ethers, BigNumber, BigNumberish, utils, providers, BytesLike, Contract } from 'ethers';
import Formatter = providers.Formatter;
import { ExternalProvider } from '@ethersproject/providers';
import { ConnectionInfo, poll } from '@ethersproject/web';
import { IERC20MetadataFactory, IEthTokenFactory, IL2BridgeFactory } from '../typechain';
import {
BigNumber,
BigNumberish,
BytesLike,
Contract,
ethers,
providers,
utils,
} from "ethers";
import { ExternalProvider } from "@ethersproject/providers";
import { ConnectionInfo, poll } from "@ethersproject/web";
import { IERC20Factory, IEthTokenFactory, IL2BridgeFactory } from "../typechain";
import {
Address,
EventFilter,
BlockTag,
TransactionResponse,
TransactionRequest,
TransactionStatus,
Token,
PriorityOpResponse,
BalancesMap,
MessageProof,
TransactionReceipt,
BatchDetails,
Block,
BlockDetails,
BlockTag,
BlockWithTransactions,
ContractAccountInfo,
EventFilter,
Log,
MessageProof,
PriorityOpResponse,
Token,
TransactionDetails,
BatchDetails,
BlockDetails,
ContractAccountInfo
} from './types';
TransactionReceipt,
TransactionRequest,
TransactionResponse,
TransactionStatus,
} from "./types";
import {
isETH,
getL2HashFromPriorityOp,
CONTRACT_DEPLOYER,
CONTRACT_DEPLOYER_ADDRESS,
EIP712_TX_TYPE,
CONTRACT_DEPLOYER_ADDRESS,
CONTRACT_DEPLOYER,
ETH_ADDRESS,
getL2HashFromPriorityOp,
isETH,
L2_ETH_TOKEN_ADDRESS,
parseTransaction,
REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT,
sleep,
L2_ETH_TOKEN_ADDRESS,
REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT
} from './utils';
import { Signer } from './signer';
} from "./utils";
import { Signer } from "./signer";
import Formatter = providers.Formatter;

@@ -65,3 +73,3 @@ let defaultFormatter: Formatter = null;

} catch (error) {
this.emit('error', error);
this.emit("error", error);
return;

@@ -72,7 +80,7 @@ }

// Emit a poll event after we have the latest (fast) block number
this.emit('poll', pollId, blockNumber);
this.emit("poll", pollId, blockNumber);
// If the block has not changed, meh.
if (blockNumber === this._lastBlockNumber) {
this.emit('didPoll', pollId);
this.emit("didPoll", pollId);
return;

@@ -88,14 +96,14 @@ }

console.warn(
`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber=${blockNumber})`
`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber=${blockNumber})`,
);
this.emit('error', {
this.emit("error", {
blockNumber: blockNumber,
event: 'blockSkew',
previousBlockNumber: this._emitted.block
event: "blockSkew",
previousBlockNumber: this._emitted.block,
});
this.emit('block', blockNumber);
this.emit("block", blockNumber);
} else {
// Notify all listener for each block that has passed
for (let i = <number>this._emitted.block + 1; i <= blockNumber; i++) {
this.emit('block', i);
this.emit("block", i);
}

@@ -110,3 +118,3 @@ }

// The block event does not expire
if (key === 'block') {
if (key === "block") {
return;

@@ -121,3 +129,3 @@ }

// "pending" events
if (eventBlockNumber === 'pending') {
if (eventBlockNumber === "pending") {
return;

@@ -127,3 +135,3 @@ }

// Evict any transaction hashes or block hashes over 12 blocks
// old, since they should not return null anyways
// old, since they should not return null anyway
if (blockNumber - eventBlockNumber > 12) {

@@ -142,3 +150,3 @@ delete this._emitted[key];

switch (event.type) {
case 'tx': {
case "tx": {
const hash = event.hash;

@@ -156,3 +164,6 @@ let runner = this.getTransactionReceipt(hash)

receipt.blockNumber == null &&
!(receipt.status != null && BigNumber.from(receipt.status).isZero())
!(
receipt.status != null &&
BigNumber.from(receipt.status).isZero()
)
) {

@@ -162,3 +173,3 @@ return null;

this._emitted['t:' + hash] = receipt.blockNumber;
this._emitted["t:" + hash] = receipt.blockNumber;
this.emit(hash, receipt);

@@ -168,3 +179,3 @@ return null;

.catch((error: Error) => {
this.emit('error', error);
this.emit("error", error);
});

@@ -177,3 +188,3 @@

case 'filter': {
case "filter": {
// We only allow a single getLogs to be in-flight at a time

@@ -192,3 +203,3 @@ if (!event._inflight) {

// indexing events, a logs result with 0 entries cannot be
// trusted and we must retry a range which includes it again
// trusted, and we must retry a range which includes it again
const filter = event.filter;

@@ -198,3 +209,3 @@ filter.fromBlock = event._lastBlockNumber + 1;

// Prevent fitler ranges from growing too wild, since it is quite
// Prevent file ranges from growing too wild, since it is quite
// likely there just haven't been any events to move the lastBlockNumber.

@@ -227,4 +238,5 @@ const minFromBlock = filter.toBlock - this._maxFilterBlockRange;

// Make sure we stall requests to fetch blocks and txs
this._emitted['b:' + log.blockHash] = log.blockNumber;
this._emitted['t:' + log.transactionHash] = log.blockNumber;
this._emitted["b:" + log.blockHash] = log.blockNumber;
this._emitted["t:" + log.transactionHash] =
log.blockNumber;

@@ -235,3 +247,3 @@ this.emit(filter, log);

.catch((error: Error) => {
this.emit('error', error);
this.emit("error", error);

@@ -254,6 +266,6 @@ // Allow another getLogs (the range was not updated)

.then(() => {
this.emit('didPoll', pollId);
this.emit("didPoll", pollId);
})
.catch((error) => {
this.emit('error', error);
this.emit("error", error);
});

@@ -264,3 +276,5 @@

override async getTransactionReceipt(transactionHash: string | Promise<string>): Promise<TransactionReceipt> {
override async getTransactionReceipt(
transactionHash: string | Promise<string>,
): Promise<TransactionReceipt> {
await this.getNetwork();

@@ -270,10 +284,12 @@

const params = { transactionHash: this.formatter.hash(transactionHash, true) };
const params = {
transactionHash: this.formatter.hash(transactionHash, true),
};
return poll(
async () => {
const result = await this.perform('getTransactionReceipt', params);
const result = await this.perform("getTransactionReceipt", params);
if (result == null) {
if (this._emitted['t:' + transactionHash] === undefined) {
if (this._emitted["t:" + transactionHash] === undefined) {
return null;

@@ -284,3 +300,7 @@ }

if (result.blockNumber == null && result.status != null && BigNumber.from(result.status).isZero()) {
if (
result.blockNumber == null &&
result.status != null &&
BigNumber.from(result.status).isZero()
) {
// transaction is rejected in the state-keeper

@@ -292,3 +312,3 @@ return {

blockNumber: 0,
blockHash: ethers.constants.HashZero
blockHash: ethers.constants.HashZero,
}),

@@ -298,3 +318,3 @@ blockNumber: null,

l1BatchNumber: null,
l1BatchTxIndex: null
l1BatchTxIndex: null,
};

@@ -311,3 +331,5 @@ }

} else if (receipt.confirmations == null) {
const blockNumber = await this._getInternalBlockNumber(100 + 2 * this.pollingInterval);
const blockNumber = await this._getInternalBlockNumber(
100 + 2 * this.pollingInterval,
);

@@ -324,7 +346,9 @@ // Add the confirmations using the fast block number (pessimistic)

},
{ oncePoll: this }
{ oncePoll: this },
);
}
override async getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block> {
override async getBlock(
blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>,
): Promise<Block> {
return <Promise<Block>>this._getBlock(blockHashOrBlockTag, false);

@@ -334,3 +358,3 @@ }

override async getBlockWithTransactions(
blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>
blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>,
): Promise<BlockWithTransactions> {

@@ -362,3 +386,3 @@ return <Promise<BlockWithTransactions>>this._getBlock(blockHashOrBlockTag, true);

txIndexInL1Batch: Formatter.allowNull(number),
logIndex: number
logIndex: number,
};

@@ -369,3 +393,3 @@

defaultFormatter.formats.receipt.l2ToL1Logs = Formatter.arrayOf((value) =>
Formatter.check((defaultFormatter.formats as any).l2Tol1Log, value)
Formatter.check((defaultFormatter.formats as any).l2Tol1Log, value),
);

@@ -375,4 +399,6 @@

defaultFormatter.formats.block.l1BatchTimestamp = Formatter.allowNull(number);
defaultFormatter.formats.blockWithTransactions.l1BatchNumber = Formatter.allowNull(number);
defaultFormatter.formats.blockWithTransactions.l1BatchTimestamp = Formatter.allowNull(number);
defaultFormatter.formats.blockWithTransactions.l1BatchNumber =
Formatter.allowNull(number);
defaultFormatter.formats.blockWithTransactions.l1BatchTimestamp =
Formatter.allowNull(number);
defaultFormatter.formats.transaction.l1BatchNumber = Formatter.allowNull(number);

@@ -393,3 +419,3 @@ defaultFormatter.formats.transaction.l1BatchTxIndex = Formatter.allowNull(number);

try {
let token = IERC20MetadataFactory.connect(tokenAddress, this);
let token = IERC20Factory.connect(tokenAddress, this);
return await token.balanceOf(address, { blockTag: tag });

@@ -409,8 +435,9 @@ } catch {

const l2WethBridge = IL2BridgeFactory.connect(bridgeAddresses.wethL2, this);
const l2WethToken = await l2WethBridge.l2TokenAddress(token);
// If the token is Wrapped Ether, return its L2 token address
if (l2WethToken != ethers.constants.AddressZero) {
return l2WethToken;
}
try {
const l2WethToken = await l2WethBridge.l2TokenAddress(token);
// If the token is Wrapped Ether, return its L2 token address
if (l2WethToken != ethers.constants.AddressZero) {
return l2WethToken;
}
} catch (e) {}
const l2Erc20Bridge = IL2BridgeFactory.connect(bridgeAddresses.erc20L2, this);

@@ -427,8 +454,9 @@ return await l2Erc20Bridge.l2TokenAddress(token);

const l2WethBridge = IL2BridgeFactory.connect(bridgeAddresses.wethL2, this);
const l1WethToken = await l2WethBridge.l1TokenAddress(token);
// If the token is Wrapped Ether, return its L1 token address
if (l1WethToken != ethers.constants.AddressZero) {
return l1WethToken;
}
try {
const l1WethToken = await l2WethBridge.l1TokenAddress(token);
// If the token is Wrapped Ether, return its L1 token address
if (l1WethToken != ethers.constants.AddressZero) {
return l1WethToken;
}
} catch (e) {}
const erc20Bridge = IL2BridgeFactory.connect(bridgeAddresses.erc20L2, this);

@@ -444,3 +472,3 @@ return await erc20Bridge.l1TokenAddress(token);

transaction: ethers.providers.TransactionRequest,
allowExtra?: Record<string, boolean>
allowExtra?: Record<string, boolean>,
) {

@@ -450,3 +478,3 @@ const result = ethers.providers.JsonRpcProvider.hexlifyTransaction(transaction, {

customData: true,
from: true
from: true,
});

@@ -457,3 +485,3 @@ if (transaction.customData == null) {

result.eip712Meta = {
gasPerPubdata: utils.hexValue(transaction.customData.gasPerPubdata ?? 0)
gasPerPubdata: utils.hexValue(transaction.customData.gasPerPubdata ?? 0),
} as any;

@@ -463,6 +491,7 @@ transaction.type = EIP712_TX_TYPE;

// @ts-ignore
result.eip712Meta.factoryDeps = transaction.customData.factoryDeps.map((dep: ethers.BytesLike) =>
// TODO (SMA-1605): we arraify instead of hexlifying because server expects Vec<u8>.
// We should change deserialization there.
Array.from(utils.arrayify(dep))
result.eip712Meta.factoryDeps = transaction.customData.factoryDeps.map(
(dep: ethers.BytesLike) =>
// TODO (SMA-1605): we arraify instead of hexlifying because server expects Vec<u8>.
// We should change deserialization there.
Array.from(utils.arrayify(dep)),
);

@@ -474,3 +503,5 @@ }

paymaster: utils.hexlify(transaction.customData.paymasterParams.paymaster),
paymasterInput: Array.from(utils.arrayify(transaction.customData.paymasterParams.paymasterInput))
paymasterInput: Array.from(
utils.arrayify(transaction.customData.paymasterParams.paymasterInput),
),
};

@@ -481,6 +512,8 @@ }

override async estimateGas(transaction: utils.Deferrable<TransactionRequest>): Promise<BigNumber> {
override async estimateGas(
transaction: utils.Deferrable<TransactionRequest>,
): Promise<BigNumber> {
await this.getNetwork();
const params = await utils.resolveProperties({
transaction: this._getTransactionRequest(transaction)
transaction: this._getTransactionRequest(transaction),
});

@@ -491,3 +524,3 @@ if (transaction.customData != null) {

}
const result = await this.perform('estimateGas', params);
const result = await this.perform("estimateGas", params);
try {

@@ -500,6 +533,8 @@ return BigNumber.from(result);

async estimateGasL1(transaction: utils.Deferrable<TransactionRequest>): Promise<BigNumber> {
async estimateGasL1(
transaction: utils.Deferrable<TransactionRequest>,
): Promise<BigNumber> {
await this.getNetwork();
const params = await utils.resolveProperties({
transaction: this._getTransactionRequest(transaction)
transaction: this._getTransactionRequest(transaction),
});

@@ -510,4 +545,4 @@ if (transaction.customData != null) {

}
const result = await this.send('zks_estimateGasL1ToL2', [
Provider.hexlifyTransaction(params.transaction, { from: true })
const result = await this.send("zks_estimateGasL1ToL2", [
Provider.hexlifyTransaction(params.transaction, { from: true }),
]);

@@ -523,3 +558,3 @@ try {

const params = token ? [token] : [];
const price = await this.send('eth_gasPrice', params);
const price = await this.send("eth_gasPrice", params);
return BigNumber.from(price);

@@ -534,3 +569,3 @@ }

this.formatter.blockTag = (tag: any) => {
if (tag == 'committed' || tag == 'finalized') {
if (tag == "committed" || tag == "finalized") {
return tag;

@@ -548,9 +583,9 @@ }

messageHash: BytesLike,
logIndex?: number
logIndex?: number,
): Promise<MessageProof | null> {
return await this.send('zks_getL2ToL1MsgProof', [
return await this.send("zks_getL2ToL1MsgProof", [
BigNumber.from(blockNumber).toNumber(),
sender,
ethers.utils.hexlify(messageHash),
logIndex
logIndex,
]);

@@ -560,7 +595,7 @@ }

async getLogProof(txHash: BytesLike, index?: number): Promise<MessageProof | null> {
return await this.send('zks_getL2ToL1LogProof', [ethers.utils.hexlify(txHash), index]);
return await this.send("zks_getL2ToL1LogProof", [ethers.utils.hexlify(txHash), index]);
}
async getL1BatchBlockRange(l1BatchNumber: number): Promise<[number, number] | null> {
const range = await this.send('zks_getL1BatchBlockRange', [l1BatchNumber]);
const range = await this.send("zks_getL1BatchBlockRange", [l1BatchNumber]);
if (range == null) {

@@ -574,3 +609,3 @@ return null;

if (!this.contractAddresses.mainContract) {
this.contractAddresses.mainContract = await this.send('zks_getMainContract', []);
this.contractAddresses.mainContract = await this.send("zks_getMainContract", []);
}

@@ -582,4 +617,4 @@ return this.contractAddresses.mainContract;

// Unlike contract's addresses, the testnet paymaster is not cached, since it can be trivially changed
// on the fly by the server and should not be relied to be constant
return await this.send('zks_getTestnetPaymaster', []);
// on the fly by the server and should not be relied on to be constant
return await this.send("zks_getTestnetPaymaster", []);
}

@@ -589,3 +624,3 @@

if (!this.contractAddresses.erc20BridgeL1) {
let addresses = await this.send('zks_getBridgeContracts', []);
let addresses = await this.send("zks_getBridgeContracts", []);
this.contractAddresses.erc20BridgeL1 = addresses.l1Erc20DefaultBridge;

@@ -600,3 +635,3 @@ this.contractAddresses.erc20BridgeL2 = addresses.l2Erc20DefaultBridge;

wethL1: this.contractAddresses.wethBridgeL1,
wethL2: this.contractAddresses.wethBridgeL2
wethL2: this.contractAddresses.wethBridgeL2,
};

@@ -606,3 +641,3 @@ }

async getConfirmedTokens(start: number = 0, limit: number = 255): Promise<Token[]> {
const tokens: Token[] = await this.send('zks_getConfirmedTokens', [start, limit]);
const tokens: Token[] = await this.send("zks_getConfirmedTokens", [start, limit]);
return tokens.map((token) => ({ address: token.l2Address, ...token }));

@@ -612,7 +647,7 @@ }

async getTokenPrice(token: Address): Promise<string | null> {
return await this.send('zks_getTokenPrice', [token]);
return await this.send("zks_getTokenPrice", [token]);
}
async getAllAccountBalances(address: Address): Promise<BalancesMap> {
let balances = await this.send('zks_getAllAccountBalances', [address]);
let balances = await this.send("zks_getAllAccountBalances", [address]);
for (let token in balances) {

@@ -625,3 +660,3 @@ balances[token] = BigNumber.from(balances[token]);

async l1ChainId(): Promise<number> {
const res = await this.send('zks_L1ChainId', []);
const res = await this.send("zks_L1ChainId", []);
return BigNumber.from(res).toNumber();

@@ -631,3 +666,3 @@ }

async getL1BatchNumber(): Promise<number> {
const number = await this.send('zks_L1BatchNumber', []);
const number = await this.send("zks_L1BatchNumber", []);
return BigNumber.from(number).toNumber();

@@ -637,11 +672,11 @@ }

async getL1BatchDetails(number: number): Promise<BatchDetails> {
return await this.send('zks_getL1BatchDetails', [number]);
return await this.send("zks_getL1BatchDetails", [number]);
}
async getBlockDetails(number: number): Promise<BlockDetails> {
return await this.send('zks_getBlockDetails', [number]);
return await this.send("zks_getBlockDetails", [number]);
}
async getTransactionDetails(txHash: BytesLike): Promise<TransactionDetails> {
return await this.send('zks_getTransactionDetails', [txHash]);
return await this.send("zks_getTransactionDetails", [txHash]);
}

@@ -660,3 +695,3 @@

if (tx.to == null && tx.from == null) {
throw new Error('withdrawal target address is undefined');
throw new Error("withdrawal target address is undefined");
}

@@ -678,3 +713,3 @@

throw new Error('The tx.value is not equal to the value withdrawn');
throw new Error("The tx.value is not equal to the value withdrawn");
}

@@ -689,6 +724,10 @@

const l2WethBridge = IL2BridgeFactory.connect(bridgeAddresses.wethL2, this);
const l1WethToken = await l2WethBridge.l1TokenAddress(tx.token);
let l1WethToken = ethers.constants.AddressZero;
try {
l1WethToken = await l2WethBridge.l1TokenAddress(tx.token);
} catch (e) {}
tx.bridgeAddress =
l1WethToken != ethers.constants.AddressZero ? bridgeAddresses.wethL2 : bridgeAddresses.erc20L2;
l1WethToken != ethers.constants.AddressZero
? bridgeAddresses.wethL2
: bridgeAddresses.erc20L2;
}

@@ -727,6 +766,6 @@

to: tx.to,
value: tx.amount
value: tx.amount,
};
} else {
const token = IERC20MetadataFactory.connect(tx.token, this);
const token = IERC20Factory.connect(tx.token, this);
return await token.populateTransaction.transfer(tx.to, tx.amount, tx.overrides);

@@ -749,3 +788,3 @@ }

// TODO (SMA-1606): Add different urls for different networks.
return new Provider(process.env.ZKSYNC_WEB3_API_URL || 'http://localhost:3050');
return new Provider(process.env.ZKSYNC_WEB3_API_URL || "http://localhost:3050");
}

@@ -755,3 +794,3 @@

filter = await filter;
const id = await this.send('eth_newFilter', [this._prepareFilter(filter)]);
const id = await this.send("eth_newFilter", [this._prepareFilter(filter)]);
return BigNumber.from(id);

@@ -761,3 +800,3 @@ }

async newBlockFilter(): Promise<BigNumber> {
const id = await this.send('eth_newBlockFilter', []);
const id = await this.send("eth_newBlockFilter", []);
return BigNumber.from(id);

@@ -767,3 +806,3 @@ }

async newPendingTransactionsFilter(): Promise<BigNumber> {
const id = await this.send('eth_newPendingTransactionFilter', []);
const id = await this.send("eth_newPendingTransactionFilter", []);
return BigNumber.from(id);

@@ -773,9 +812,11 @@ }

async getFilterChanges(idx: BigNumber): Promise<Array<Log | string>> {
const logs = await this.send('eth_getFilterChanges', [idx.toHexString()]);
return typeof logs[0] === 'string' ? logs : this._parseLogs(logs);
const logs = await this.send("eth_getFilterChanges", [idx.toHexString()]);
return typeof logs[0] === "string" ? logs : this._parseLogs(logs);
}
override async getLogs(filter: EventFilter | Promise<EventFilter> = {}): Promise<Array<Log>> {
override async getLogs(
filter: EventFilter | Promise<EventFilter> = {},
): Promise<Array<Log>> {
filter = await filter;
const logs = await this.send('eth_getLogs', [this._prepareFilter(filter)]);
const logs = await this.send("eth_getLogs", [this._prepareFilter(filter)]);
return this._parseLogs(logs);

@@ -791,4 +832,5 @@ }

...filter,
fromBlock: filter.fromBlock == null ? null : this.formatter.blockTag(filter.fromBlock),
toBlock: filter.fromBlock == null ? null : this.formatter.blockTag(filter.toBlock)
fromBlock:
filter.fromBlock == null ? null : this.formatter.blockTag(filter.fromBlock),
toBlock: filter.fromBlock == null ? null : this.formatter.blockTag(filter.toBlock),
};

@@ -803,3 +845,3 @@ }

while (true) {
const block = await this.getBlock('finalized');
const block = await this.getBlock("finalized");
if (receipt.blockNumber <= block.number) {

@@ -825,3 +867,3 @@ return await this.getTransactionReceipt(receipt.transactionHash);

}
const verifiedBlock = await this.getBlock('finalized');
const verifiedBlock = await this.getBlock("finalized");
if (tx.blockNumber <= verifiedBlock.number) {

@@ -833,3 +875,5 @@ return TransactionStatus.Finalized;

override async getTransaction(hash: string | Promise<string>): Promise<TransactionResponse> {
override async getTransaction(
hash: string | Promise<string>,
): Promise<TransactionResponse> {
hash = await hash;

@@ -840,3 +884,5 @@ const tx = await super.getTransaction(hash);

override async sendTransaction(transaction: string | Promise<string>): Promise<TransactionResponse> {
override async sendTransaction(
transaction: string | Promise<string>,
): Promise<TransactionResponse> {
return (await super.sendTransaction(transaction)) as TransactionResponse;

@@ -846,3 +892,3 @@ }

async getL2TransactionFromPriorityOp(
l1TxResponse: ethers.providers.TransactionResponse
l1TxResponse: ethers.providers.TransactionResponse,
): Promise<TransactionResponse> {

@@ -861,3 +907,5 @@ const receipt = await l1TxResponse.wait();

async getPriorityOpResponse(l1TxResponse: ethers.providers.TransactionResponse): Promise<PriorityOpResponse> {
async getPriorityOpResponse(
l1TxResponse: ethers.providers.TransactionResponse,
): Promise<PriorityOpResponse> {
const l2Response = { ...l1TxResponse } as PriorityOpResponse;

@@ -879,3 +927,7 @@

async getContractAccountInfo(address: Address): Promise<ContractAccountInfo> {
const deployerContract = new Contract(CONTRACT_DEPLOYER_ADDRESS, CONTRACT_DEPLOYER, this);
const deployerContract = new Contract(
CONTRACT_DEPLOYER_ADDRESS,
CONTRACT_DEPLOYER,
this,
);
const data = await deployerContract.getAccountInfo(address);

@@ -885,3 +937,3 @@

supportedAAVersion: data.supportedAAVersion,
nonceOrdering: data.nonceOrdering
nonceOrdering: data.nonceOrdering,
};

@@ -908,3 +960,3 @@ }

const customData = {
gasPerPubdataByte: transaction.gasPerPubdataByte
gasPerPubdataByte: transaction.gasPerPubdataByte,
};

@@ -915,3 +967,3 @@ if (transaction.factoryDeps) {

const fee = await this.estimateGasL1({
return await this.estimateGasL1({
from: transaction.caller,

@@ -921,6 +973,4 @@ data: transaction.calldata,

value: transaction.l2Value,
customData
customData,
});
return fee;
}

@@ -934,9 +984,10 @@ }

if (provider == null) {
throw new Error('missing provider');
throw new Error("missing provider");
}
if (!provider.request) {
throw new Error('provider must implement eip-1193');
throw new Error("provider must implement eip-1193");
}
let path = provider.host || provider.path || (provider.isMetaMask ? 'metamask' : 'eip-1193:');
let path =
provider.host || provider.path || (provider.isMetaMask ? "metamask" : "eip-1193:");
super(path, network);

@@ -949,5 +1000,5 @@ this.provider = provider;

// Metamask complains about eth_sign (and on some versions hangs)
if (method == 'eth_sign' && (this.provider.isMetaMask || this.provider.isStatus)) {
if (method == "eth_sign" && (this.provider.isMetaMask || this.provider.isStatus)) {
// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign
method = 'personal_sign';
method = "personal_sign";
params = [params[1], params[0]];

@@ -954,0 +1005,0 @@ }

@@ -1,25 +0,30 @@

import { ethers } from 'ethers';
import { Provider } from './provider';
import { serialize, EIP712_TX_TYPE, hashBytecode, DEFAULT_GAS_PER_PUBDATA_LIMIT } from './utils';
import { BlockTag, TransactionResponse, Signature, TransactionRequest } from './types';
import { TypedDataDomain, TypedDataSigner } from '@ethersproject/abstract-signer';
import { _TypedDataEncoder as TypedDataEncoder } from '@ethersproject/hash';
import { AdapterL1, AdapterL2 } from './adapters';
import { ethers } from "ethers";
import { Provider } from "./provider";
import {
DEFAULT_GAS_PER_PUBDATA_LIMIT,
EIP712_TX_TYPE,
hashBytecode,
serialize,
} from "./utils";
import { BlockTag, Signature, TransactionRequest, TransactionResponse } from "./types";
import { TypedDataDomain, TypedDataSigner } from "@ethersproject/abstract-signer";
import { _TypedDataEncoder as TypedDataEncoder } from "@ethersproject/hash";
import { AdapterL1, AdapterL2 } from "./adapters";
export const eip712Types = {
Transaction: [
{ name: 'txType', type: 'uint256' },
{ name: 'from', type: 'uint256' },
{ name: 'to', type: 'uint256' },
{ name: 'gasLimit', type: 'uint256' },
{ name: 'gasPerPubdataByteLimit', type: 'uint256' },
{ name: 'maxFeePerGas', type: 'uint256' },
{ name: 'maxPriorityFeePerGas', type: 'uint256' },
{ name: 'paymaster', type: 'uint256' },
{ name: 'nonce', type: 'uint256' },
{ name: 'value', type: 'uint256' },
{ name: 'data', type: 'bytes' },
{ name: 'factoryDeps', type: 'bytes32[]' },
{ name: 'paymasterInput', type: 'bytes' }
]
{ name: "txType", type: "uint256" },
{ name: "from", type: "uint256" },
{ name: "to", type: "uint256" },
{ name: "gasLimit", type: "uint256" },
{ name: "gasPerPubdataByteLimit", type: "uint256" },
{ name: "maxFeePerGas", type: "uint256" },
{ name: "maxPriorityFeePerGas", type: "uint256" },
{ name: "paymaster", type: "uint256" },
{ name: "nonce", type: "uint256" },
{ name: "value", type: "uint256" },
{ name: "data", type: "bytes" },
{ name: "factoryDeps", type: "bytes32[]" },
{ name: "paymasterInput", type: "bytes" },
],
};

@@ -29,7 +34,10 @@

private eip712Domain: Promise<TypedDataDomain>;
constructor(private ethSigner: ethers.Signer & TypedDataSigner, chainId: number | Promise<number>) {
constructor(
private ethSigner: ethers.Signer & TypedDataSigner,
chainId: number | Promise<number>,
) {
this.eip712Domain = Promise.resolve(chainId).then((chainId) => ({
name: 'zkSync',
version: '2',
chainId
name: "zkSync",
version: "2",
chainId,
}));

@@ -41,4 +49,5 @@ }

const maxPriorityFeePerGas = transaction.maxPriorityFeePerGas ?? maxFeePerGas;
const gasPerPubdataByteLimit = transaction.customData?.gasPerPubdata ?? DEFAULT_GAS_PER_PUBDATA_LIMIT;
const signInput = {
const gasPerPubdataByteLimit =
transaction.customData?.gasPerPubdata ?? DEFAULT_GAS_PER_PUBDATA_LIMIT;
return {
txType: transaction.type,

@@ -51,10 +60,12 @@ from: transaction.from,

maxPriorityFeePerGas,
paymaster: transaction.customData?.paymasterParams?.paymaster || ethers.constants.AddressZero,
paymaster:
transaction.customData?.paymasterParams?.paymaster ||
ethers.constants.AddressZero,
nonce: transaction.nonce,
value: transaction.value,
data: transaction.data,
factoryDeps: transaction.customData?.factoryDeps?.map((dep) => hashBytecode(dep)) || [],
paymasterInput: transaction.customData?.paymasterParams?.paymasterInput || '0x'
factoryDeps:
transaction.customData?.factoryDeps?.map((dep) => hashBytecode(dep)) || [],
paymasterInput: transaction.customData?.paymasterParams?.paymasterInput || "0x",
};
return signInput;
}

@@ -66,3 +77,3 @@

eip712Types,
EIP712Signer.getSignInput(transaction)
EIP712Signer.getSignInput(transaction),
);

@@ -76,7 +87,11 @@ }

const domain = {
name: 'zkSync',
version: '2',
chainId: transaction.chainId
name: "zkSync",
version: "2",
chainId: transaction.chainId,
};
return TypedDataEncoder.hash(domain, eip712Types, EIP712Signer.getSignInput(transaction));
return TypedDataEncoder.hash(
domain,
eip712Types,
EIP712Signer.getSignInput(transaction),
);
}

@@ -115,3 +130,5 @@ }

override async sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse> {
override async sendTransaction(
transaction: TransactionRequest,
): Promise<TransactionResponse> {
if (transaction.customData == null && transaction.type == null) {

@@ -127,7 +144,7 @@ // use legacy txs by default

if (transaction.from.toLowerCase() != address.toLowerCase()) {
throw new Error('Transaction `from` address mismatch');
throw new Error("Transaction `from` address mismatch");
}
transaction.type = EIP712_TX_TYPE;
transaction.value ??= 0;
transaction.data ??= '0x';
transaction.data ??= "0x";
transaction.nonce ??= await this.getNonce();

@@ -203,3 +220,5 @@ transaction.customData = this._fillCustomData(transaction.customData);

override async sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse> {
override async sendTransaction(
transaction: TransactionRequest,
): Promise<TransactionResponse> {
if (transaction.customData == null && transaction.type == null) {

@@ -215,7 +234,7 @@ // use legacy txs by default

if (transaction.from.toLowerCase() != address.toLowerCase()) {
throw new Error('Transaction `from` address mismatch');
throw new Error("Transaction `from` address mismatch");
}
transaction.type = EIP712_TX_TYPE;
transaction.value ??= 0;
transaction.data ??= '0x';
transaction.data ??= "0x";
transaction.nonce ??= await this.getNonce();

@@ -222,0 +241,0 @@ transaction.customData = this._fillCustomData(transaction.customData);

@@ -1,3 +0,3 @@

import { BytesLike, BigNumberish, providers, BigNumber } from 'ethers';
import { BlockWithTransactions as EthersBlockWithTransactions } from '@ethersproject/abstract-provider';
import { BytesLike, BigNumberish, providers, BigNumber } from "ethers";
import { BlockWithTransactions as EthersBlockWithTransactions } from "@ethersproject/abstract-provider";

@@ -15,3 +15,3 @@ // 0x-prefixed, hex encoded, ethereum account address

Goerli = 5,
Localhost = 9
Localhost = 9,
}

@@ -22,3 +22,3 @@

HeapBuffer = 1,
Heap = 2
Heap = 2,
}

@@ -28,10 +28,10 @@

Full = 0,
Rollup = 1
Rollup = 1,
}
export enum TransactionStatus {
NotFound = 'not-found',
Processing = 'processing',
Committed = 'committed',
Finalized = 'finalized'
NotFound = "not-found",
Processing = "processing",
Committed = "committed",
Finalized = "finalized",
}

@@ -62,3 +62,3 @@

// TODO (SMA-1585): Support create2 variants.
export type DeploymentType = 'create' | 'createAccount';
export type DeploymentType = "create" | "createAccount";

@@ -149,3 +149,3 @@ export interface Token {

export interface ApprovalBasedPaymasterInput {
type: 'ApprovalBased';
type: "ApprovalBased";
token: Address;

@@ -157,3 +157,3 @@ minimalAllowance: BigNumber;

export interface GeneralPaymasterInput {
type: 'General';
type: "General";
innerInput: BytesLike;

@@ -172,3 +172,3 @@ }

None = 0,
Version1 = 1
Version1 = 1,
}

@@ -178,3 +178,3 @@

Sequential = 0,
Arbitrary = 1
Arbitrary = 1,
}

@@ -202,2 +202,6 @@

l2FairGasPrice: number;
baseSystemContractsHashes: {
bootloader: string;
defaultAa: string;
};
}

@@ -219,2 +223,6 @@

executedAt?: Date;
baseSystemContractsHashes: {
bootloader: string;
defaultAa: string;
};
}

@@ -226,3 +234,3 @@

fee: BigNumberish;
gasPerPubdata?: BigNumberish;
gasPerPubdata: BigNumberish;
initiatorAddress: Address;

@@ -229,0 +237,0 @@ receivedAt: Date;

@@ -1,3 +0,3 @@

import { utils, ethers, BigNumber, BigNumberish, BytesLike } from 'ethers';
import { SignatureLike } from '@ethersproject/bytes';
import { utils, ethers, BigNumber, BigNumberish, BytesLike } from "ethers";
import { SignatureLike } from "@ethersproject/bytes";
import {

@@ -10,30 +10,32 @@ Address,

PaymasterParams,
EthereumSignature
} from './types';
import { TypedDataDomain, TypedDataField } from '@ethersproject/abstract-signer';
import { Provider } from './provider';
import { EIP712Signer } from './signer';
import { IERC20MetadataFactory, IL1BridgeFactory } from '../typechain';
import { AbiCoder } from 'ethers/lib/utils';
EthereumSignature,
} from "./types";
import { TypedDataDomain, TypedDataField } from "@ethersproject/abstract-signer";
import { Provider } from "./provider";
import { EIP712Signer } from "./signer";
import { IERC20Factory, IL1BridgeFactory } from "../typechain";
import { AbiCoder } from "ethers/lib/utils";
export * from './paymaster-utils';
export * from "./paymaster-utils";
export const ETH_ADDRESS = '0x0000000000000000000000000000000000000000';
export const ETH_ADDRESS = "0x0000000000000000000000000000000000000000";
export const ZKSYNC_MAIN_ABI = new utils.Interface(require('../../abi/IZkSync.json').abi);
export const CONTRACT_DEPLOYER = new utils.Interface(require('../../abi/ContractDeployer.json').abi);
export const L1_MESSENGER = new utils.Interface(require('../../abi/IL1Messenger.json').abi);
export const IERC20 = new utils.Interface(require('../../abi/IERC20.json').abi);
export const IERC1271 = new utils.Interface(require('../../abi/IERC1271.json').abi);
export const L1_BRIDGE_ABI = new utils.Interface(require('../../abi/IL1Bridge.json').abi);
export const L2_BRIDGE_ABI = new utils.Interface(require('../../abi/IL2Bridge.json').abi);
export const ZKSYNC_MAIN_ABI = new utils.Interface(require("../abi/IZkSync.json").abi);
export const CONTRACT_DEPLOYER = new utils.Interface(
require("../abi/ContractDeployer.json").abi,
);
export const L1_MESSENGER = new utils.Interface(require("../abi/IL1Messenger.json").abi);
export const IERC20 = new utils.Interface(require("../abi/IERC20.json").abi);
export const IERC1271 = new utils.Interface(require("../abi/IERC1271.json").abi);
export const L1_BRIDGE_ABI = new utils.Interface(require("../abi/IL1Bridge.json").abi);
export const L2_BRIDGE_ABI = new utils.Interface(require("../abi/IL2Bridge.json").abi);
export const BOOTLOADER_FORMAL_ADDRESS = '0x0000000000000000000000000000000000008001';
export const CONTRACT_DEPLOYER_ADDRESS = '0x0000000000000000000000000000000000008006';
export const L1_MESSENGER_ADDRESS = '0x0000000000000000000000000000000000008008';
export const L2_ETH_TOKEN_ADDRESS = '0x000000000000000000000000000000000000800a';
export const BOOTLOADER_FORMAL_ADDRESS = "0x0000000000000000000000000000000000008001";
export const CONTRACT_DEPLOYER_ADDRESS = "0x0000000000000000000000000000000000008006";
export const L1_MESSENGER_ADDRESS = "0x0000000000000000000000000000000000008008";
export const L2_ETH_TOKEN_ADDRESS = "0x000000000000000000000000000000000000800a";
export const L1_TO_L2_ALIAS_OFFSET = '0x1111000000000000000000000000000000001111';
export const L1_TO_L2_ALIAS_OFFSET = "0x1111000000000000000000000000000000001111";
export const EIP1271_MAGIC_VALUE = '0x1626ba7e';
export const EIP1271_MAGIC_VALUE = "0x1626ba7e";

@@ -56,3 +58,3 @@ export const EIP712_TX_TYPE = 0x71;

// any reasonable limit will be accepted. Note, that the operator is NOT required to
// use the honest value of gas per pubdata and it can use any value up to the one signed by the user.
// use the honest value of gas per pubdata, and it can use any value up to the one signed by the user.
// In the future releases, we will provide a way to estimate the current gasPerPubdata.

@@ -62,3 +64,3 @@ export const DEFAULT_GAS_PER_PUBDATA_LIMIT = 50000;

// It is possible to provide practically any gasPerPubdataByte for L1->L2 transactions, since
// the cost per gas will be adjusted respectively. We will use 800 as an relatively optimal value for now.
// the cost per gas will be adjusted respectively. We will use 800 as a relatively optimal value for now.
export const REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT = 800;

@@ -77,3 +79,3 @@

queueType: PriorityQueueType.Deque,
opTree: PriorityOpTree.Full
opTree: PriorityOpTree.Full,
};

@@ -89,3 +91,3 @@ }

...ethers.utils.zeroPad(sender, 32),
...ethers.utils.arrayify(ethers.utils.keccak256(msg))
...ethers.utils.arrayify(ethers.utils.keccak256(msg)),
]);

@@ -96,3 +98,5 @@

export function getDeployedContracts(receipt: ethers.providers.TransactionReceipt): DeploymentInfo[] {
export function getDeployedContracts(
receipt: ethers.providers.TransactionReceipt,
): DeploymentInfo[] {
const addressBytesLen = 40;

@@ -102,4 +106,4 @@ const deployedContracts = receipt.logs

(log) =>
log.topics[0] == utils.id('ContractDeployed(address,bytes32,address)') &&
log.address == CONTRACT_DEPLOYER_ADDRESS
log.topics[0] == utils.id("ContractDeployed(address,bytes32,address)") &&
log.address == CONTRACT_DEPLOYER_ADDRESS,
)

@@ -114,3 +118,3 @@ // Take the last topic (deployed contract address as U256) and extract address from it (U160).

bytecodeHash: bytesCodehash,
deployedAddress: utils.getAddress(address)
deployedAddress: utils.getAddress(address),
};

@@ -122,7 +126,20 @@ });

export function create2Address(sender: Address, bytecodeHash: BytesLike, salt: BytesLike, input: BytesLike) {
const prefix = ethers.utils.keccak256(ethers.utils.toUtf8Bytes('zksyncCreate2'));
export function create2Address(
sender: Address,
bytecodeHash: BytesLike,
salt: BytesLike,
input: BytesLike = "",
) {
const prefix = ethers.utils.keccak256(ethers.utils.toUtf8Bytes("zksyncCreate2"));
const inputHash = ethers.utils.keccak256(input);
const addressBytes = ethers.utils
.keccak256(ethers.utils.concat([prefix, ethers.utils.zeroPad(sender, 32), salt, bytecodeHash, inputHash]))
.keccak256(
ethers.utils.concat([
prefix,
ethers.utils.zeroPad(sender, 32),
salt,
bytecodeHash,
inputHash,
]),
)
.slice(26);

@@ -133,3 +150,3 @@ return ethers.utils.getAddress(addressBytes);

export function createAddress(sender: Address, senderNonce: BigNumberish) {
const prefix = ethers.utils.keccak256(ethers.utils.toUtf8Bytes('zksyncCreate'));
const prefix = ethers.utils.keccak256(ethers.utils.toUtf8Bytes("zksyncCreate"));
const addressBytes = ethers.utils

@@ -140,4 +157,4 @@ .keccak256(

ethers.utils.zeroPad(sender, 32),
ethers.utils.zeroPad(ethers.utils.hexlify(senderNonce), 32)
])
ethers.utils.zeroPad(ethers.utils.hexlify(senderNonce), 32),
]),
)

@@ -151,3 +168,3 @@ .slice(26);

baseCost: ethers.BigNumber,
value: ethers.BigNumberish | Promise<ethers.BigNumberish>
value: ethers.BigNumberish | Promise<ethers.BigNumberish>,
) {

@@ -157,3 +174,3 @@ if (baseCost.gt(await value)) {

`The base cost of performing the priority operation is higher than the provided value parameter ` +
`for the transaction: baseCost: ${baseCost}, provided value: ${value}`
`for the transaction: baseCost: ${baseCost}, provided value: ${value}`,
);

@@ -163,5 +180,11 @@ }

export function serialize(transaction: ethers.providers.TransactionRequest, signature?: SignatureLike) {
export function serialize(
transaction: ethers.providers.TransactionRequest,
signature?: SignatureLike,
) {
if (transaction.customData == null && transaction.type != EIP712_TX_TYPE) {
return utils.serializeTransaction(transaction as ethers.PopulatedTransaction, signature);
return utils.serializeTransaction(
transaction as ethers.PopulatedTransaction,
signature,
);
}

@@ -175,3 +198,3 @@ if (!transaction.chainId) {

if (result.length > 32) {
throw new Error('invalid length for ' + name);
throw new Error("invalid length for " + name);
}

@@ -182,3 +205,5 @@ return result;

if (!transaction.from) {
throw new Error('Explicitly providing `from` field is reqiured for EIP712 transactions');
throw new Error(
"Explicitly providing `from` field is reqiured for EIP712 transactions",
);
}

@@ -193,9 +218,9 @@ const from = transaction.from;

const fields: any[] = [
formatNumber(transaction.nonce || 0, 'nonce'),
formatNumber(maxPriorityFeePerGas, 'maxPriorityFeePerGas'),
formatNumber(maxFeePerGas, 'maxFeePerGas'),
formatNumber(transaction.gasLimit || 0, 'gasLimit'),
transaction.to != null ? utils.getAddress(transaction.to) : '0x',
formatNumber(transaction.value || 0, 'value'),
transaction.data || '0x'
formatNumber(transaction.nonce || 0, "nonce"),
formatNumber(maxPriorityFeePerGas, "maxPriorityFeePerGas"),
formatNumber(maxFeePerGas, "maxFeePerGas"),
formatNumber(transaction.gasLimit || 0, "gasLimit"),
transaction.to != null ? utils.getAddress(transaction.to) : "0x",
formatNumber(transaction.value || 0, "value"),
transaction.data || "0x",
];

@@ -205,24 +230,29 @@

const sig = utils.splitSignature(signature);
fields.push(formatNumber(sig.recoveryParam, 'recoveryParam'));
fields.push(formatNumber(sig.recoveryParam, "recoveryParam"));
fields.push(utils.stripZeros(sig.r));
fields.push(utils.stripZeros(sig.s));
} else {
fields.push(formatNumber(transaction.chainId, 'chainId'));
fields.push('0x');
fields.push('0x');
fields.push(formatNumber(transaction.chainId, "chainId"));
fields.push("0x");
fields.push("0x");
}
fields.push(formatNumber(transaction.chainId, 'chainId'));
fields.push(formatNumber(transaction.chainId, "chainId"));
fields.push(utils.getAddress(from));
// Add meta
fields.push(formatNumber(meta.gasPerPubdata || DEFAULT_GAS_PER_PUBDATA_LIMIT, 'gasPerPubdata'));
fields.push(
formatNumber(meta.gasPerPubdata || DEFAULT_GAS_PER_PUBDATA_LIMIT, "gasPerPubdata"),
);
fields.push((meta.factoryDeps ?? []).map((dep) => utils.hexlify(dep)));
if (meta.customSignature && ethers.utils.arrayify(meta.customSignature).length == 0) {
throw new Error('Empty signatures are not supported');
throw new Error("Empty signatures are not supported");
}
fields.push(meta.customSignature || '0x');
fields.push(meta.customSignature || "0x");
if (meta.paymasterParams) {
fields.push([meta.paymasterParams.paymaster, ethers.utils.hexlify(meta.paymasterParams.paymasterInput)]);
fields.push([
meta.paymasterParams.paymaster,
ethers.utils.hexlify(meta.paymasterParams.paymasterInput),
]);
} else {

@@ -240,3 +270,3 @@ fields.push([]);

if (bytecodeAsArray.length % 32 != 0) {
throw new Error('The bytecode length in bytes must be divisible by 32');
throw new Error("The bytecode length in bytes must be divisible by 32");
}

@@ -255,3 +285,3 @@

if (bytecodeLengthInWords % 2 == 0) {
throw new Error('Bytecode length in 32-byte words must be odd');
throw new Error("Bytecode length in 32-byte words must be odd");
}

@@ -274,3 +304,3 @@

function handleAddress(value: string): string {
if (value === '0x') {
if (value === "0x") {
return null;

@@ -282,3 +312,3 @@ }

function handleNumber(value: string): BigNumber {
if (value === '0x') {
if (value === "0x") {
return BigNumber.from(0);

@@ -294,3 +324,5 @@ }

if (arr.length != 2) {
throw new Error(`Invalid paymaster parameters, expected to have length of 2, found ${arr.length}`);
throw new Error(
`Invalid paymaster parameters, expected to have length of 2, found ${arr.length}`,
);
}

@@ -300,3 +332,3 @@

paymaster: utils.getAddress(arr[0]),
paymasterInput: utils.arrayify(arr[1])
paymasterInput: utils.arrayify(arr[1]),
};

@@ -326,4 +358,4 @@ }

customSignature: raw[14],
paymasterParams: arrayToPaymasterParams(raw[15])
}
paymasterParams: arrayToPaymasterParams(raw[15]),
},
};

@@ -334,7 +366,7 @@

r: raw[8],
s: raw[9]
s: raw[9],
};
if (
(utils.hexlify(ethSignature.r) == '0x' || utils.hexlify(ethSignature.s) == '0x') &&
(utils.hexlify(ethSignature.r) == "0x" || utils.hexlify(ethSignature.s) == "0x") &&
!transaction.customData.customSignature

@@ -345,4 +377,8 @@ ) {

if (ethSignature.v !== 0 && ethSignature.v !== 1 && !transaction.customData.customSignature) {
throw new Error('Failed to parse signature');
if (
ethSignature.v !== 0 &&
ethSignature.v !== 1 &&
!transaction.customData.customSignature
) {
throw new Error("Failed to parse signature");
}

@@ -362,3 +398,6 @@

function getSignature(transaction: any, ethSignature?: EthereumSignature): Uint8Array {
if (transaction?.customData?.customSignature && transaction.customData.customSignature.length) {
if (
transaction?.customData?.customSignature &&
transaction.customData.customSignature.length
) {
return ethers.utils.arrayify(transaction.customData.customSignature);

@@ -368,3 +407,3 @@ }

if (!ethSignature) {
throw new Error('No signature provided');
throw new Error("No signature provided");
}

@@ -388,3 +427,3 @@

txReceipt: ethers.providers.TransactionReceipt,
zkSyncAddress: Address
zkSyncAddress: Address,
): string {

@@ -405,3 +444,3 @@ let txHash: string = null;

if (!txHash) {
throw new Error('Failed to parse tx logs');
throw new Error("Failed to parse tx logs");
}

@@ -415,3 +454,5 @@

export function applyL1ToL2Alias(address: string): string {
return ethers.utils.hexlify(ethers.BigNumber.from(address).add(L1_TO_L2_ALIAS_OFFSET).mod(ADDRESS_MODULO));
return ethers.utils.hexlify(
ethers.BigNumber.from(address).add(L1_TO_L2_ALIAS_OFFSET).mod(ADDRESS_MODULO),
);
}

@@ -431,5 +472,5 @@

l1TokenAddress: string,
provider: ethers.providers.Provider
provider: ethers.providers.Provider,
): Promise<string> {
const token = IERC20MetadataFactory.connect(l1TokenAddress, provider);
const token = IERC20Factory.connect(l1TokenAddress, provider);

@@ -442,7 +483,7 @@ const name = await token.name();

const nameBytes = coder.encode(['string'], [name]);
const symbolBytes = coder.encode(['string'], [symbol]);
const decimalsBytes = coder.encode(['uint256'], [decimals]);
const nameBytes = coder.encode(["string"], [name]);
const symbolBytes = coder.encode(["string"], [symbol]);
const decimalsBytes = coder.encode(["uint256"], [decimals]);
return coder.encode(['bytes', 'bytes', 'bytes'], [nameBytes, symbolBytes, decimalsBytes]);
return coder.encode(["bytes", "bytes", "bytes"], [nameBytes, symbolBytes, decimalsBytes]);
}

@@ -457,5 +498,5 @@

amount: BigNumberish,
bridgeData: BytesLike
bridgeData: BytesLike,
): Promise<string> {
return L2_BRIDGE_ABI.encodeFunctionData('finalizeDeposit', [
return L2_BRIDGE_ABI.encodeFunctionData("finalizeDeposit", [
l1Sender,

@@ -465,3 +506,3 @@ l2Receiver,

amount,
bridgeData
bridgeData,
]);

@@ -476,3 +517,7 @@ }

// letting our SDK have functionality to verify signatures.
function isECDSASignatureCorrect(address: string, msgHash: string, signature: SignatureLike): boolean {
function isECDSASignatureCorrect(
address: string,
msgHash: string,
signature: SignatureLike,
): boolean {
try {

@@ -491,3 +536,3 @@ return address == ethers.utils.recoverAddress(msgHash, signature);

msgHash: string,
signature: SignatureLike
signature: SignatureLike,
): Promise<boolean> {

@@ -508,3 +553,3 @@ const accountContract = new ethers.Contract(address, IERC1271, provider);

msgHash: string,
signature: SignatureLike
signature: SignatureLike,
): Promise<boolean> {

@@ -530,3 +575,3 @@ let isContractAccount = false;

message: ethers.Bytes | string,
signature: SignatureLike
signature: SignatureLike,
): Promise<boolean> {

@@ -546,3 +591,3 @@ const msgHash = ethers.utils.hashMessage(message);

value: Record<string, any>,
signature: SignatureLike
signature: SignatureLike,
): Promise<boolean> {

@@ -560,3 +605,3 @@ const msgHash = ethers.utils._TypedDataEncoder.hash(domain, types, value);

from?: Address,
gasPerPubdataByte?: BigNumberish
gasPerPubdataByte?: BigNumberish,
): Promise<BigNumber> {

@@ -573,4 +618,4 @@ // If the `from` address is not provided, we use a random address, because

caller: from,
calldata: '0x',
l2Value: amount
calldata: "0x",
l2Value: amount,
});

@@ -581,3 +626,7 @@ } else {

const l1WethBridge = IL1BridgeFactory.connect(bridgeAddresses.wethL1, providerL1);
const l2WethToken = await l1WethBridge.l2TokenAddress(token);
let l2WethToken = ethers.constants.AddressZero;
try {
l2WethToken = await l1WethBridge.l2TokenAddress(token);
} catch (e) {}
if (l2WethToken != ethers.constants.AddressZero) {

@@ -587,3 +636,3 @@ value = amount;

l2BridgeAddress = bridgeAddresses.wethL2;
bridgeData = '0x';
bridgeData = "0x";
} else {

@@ -606,3 +655,3 @@ value = 0;

gasPerPubdataByte,
value
value,
);

@@ -613,3 +662,5 @@ }

export function scaleGasLimit(gasLimit: BigNumber): BigNumber {
return gasLimit.mul(L1_FEE_ESTIMATION_COEF_NUMERATOR).div(L1_FEE_ESTIMATION_COEF_DENOMINATOR);
return gasLimit
.mul(L1_FEE_ESTIMATION_COEF_NUMERATOR)
.div(L1_FEE_ESTIMATION_COEF_DENOMINATOR);
}

@@ -627,3 +678,3 @@

gasPerPubdataByte?: BigNumberish,
l2Value?: BigNumberish
l2Value?: BigNumberish,
): Promise<BigNumber> {

@@ -636,4 +687,4 @@ const calldata = await getERC20BridgeCalldata(token, from, to, amount, bridgeData);

calldata,
l2Value
l2Value,
});
}

@@ -1,8 +0,8 @@

import { EIP712Signer } from './signer';
import { Provider } from './provider';
import { serialize, EIP712_TX_TYPE } from './utils';
import { ethers, utils } from 'ethers';
import { BlockTag, TransactionResponse, TransactionRequest } from './types';
import { ProgressCallback } from '@ethersproject/json-wallets';
import { AdapterL1, AdapterL2 } from './adapters';
import { EIP712Signer } from "./signer";
import { Provider } from "./provider";
import { serialize, EIP712_TX_TYPE } from "./utils";
import { ethers, utils } from "ethers";
import { BlockTag, TransactionResponse, TransactionRequest } from "./types";
import { ProgressCallback } from "@ethersproject/json-wallets";
import { AdapterL1, AdapterL2 } from "./adapters";

@@ -16,3 +16,3 @@ export class Wallet extends AdapterL2(AdapterL1(ethers.Wallet)) {

if (this.providerL1 == null) {
throw new Error('L1 provider missing: use `connectToL1` to specify');
throw new Error("L1 provider missing: use `connectToL1` to specify");
}

@@ -59,3 +59,3 @@ return this.providerL1;

password?: string | ethers.Bytes,
callback?: ProgressCallback
callback?: ProgressCallback,
) {

@@ -79,3 +79,3 @@ const wallet = await super.fromEncryptedJson(json, password, callback);

providerL2?: Provider,
providerL1?: ethers.providers.Provider
providerL1?: ethers.providers.Provider,
) {

@@ -91,3 +91,5 @@ super(privateKey, providerL2);

override async populateTransaction(transaction: TransactionRequest): Promise<TransactionRequest> {
override async populateTransaction(
transaction: TransactionRequest,
): Promise<TransactionRequest> {
if (transaction.type == null && transaction.customData == null) {

@@ -104,3 +106,3 @@ // use legacy txs by default

transaction.value ??= 0;
transaction.data ??= '0x';
transaction.data ??= "0x";
transaction.customData = this._fillCustomData(transaction.customData);

@@ -120,3 +122,3 @@ transaction.gasPrice = await this.provider.getGasPrice();

if (transaction.from.toLowerCase() != this.address.toLowerCase()) {
throw new Error('Transaction `from` address mismatch');
throw new Error("Transaction `from` address mismatch");
}

@@ -129,3 +131,5 @@ transaction.customData.customSignature = await this.eip712.sign(transaction);

override async sendTransaction(transaction: ethers.providers.TransactionRequest): Promise<TransactionResponse> {
override async sendTransaction(
transaction: ethers.providers.TransactionRequest,
): Promise<TransactionResponse> {
// Typescript isn't smart enough to recognise that wallet.sendTransaction

@@ -132,0 +136,0 @@ // calls provider.sendTransaction which returns our extended type and not ethers' one.

@@ -26,3 +26,3 @@ /* Autogenerated file. Do not edit manually. */

functions: {
"balanceOf(address)": FunctionFragment;
"balanceOf(uint256)": FunctionFragment;
"decimals()": FunctionFragment;

@@ -37,3 +37,6 @@ "mint(address,uint256)": FunctionFragment;

encodeFunctionData(functionFragment: "balanceOf", values: [string]): string;
encodeFunctionData(
functionFragment: "balanceOf",
values: [BigNumberish]
): string;
encodeFunctionData(functionFragment: "decimals", values?: undefined): string;

@@ -74,3 +77,3 @@ encodeFunctionData(

"Transfer(address,address,uint256)": EventFragment;
"Withdrawal(address,uint256)": EventFragment;
"Withdrawal(address,address,uint256)": EventFragment;
};

@@ -98,3 +101,3 @@

balanceOf(
arg0: string,
arg0: BigNumberish,
overrides?: CallOverrides

@@ -105,4 +108,4 @@ ): Promise<{

"balanceOf(address)"(
arg0: string,
"balanceOf(uint256)"(
arg0: BigNumberish,
overrides?: CallOverrides

@@ -182,6 +185,6 @@ ): Promise<{

balanceOf(arg0: string, overrides?: CallOverrides): Promise<BigNumber>;
balanceOf(arg0: BigNumberish, overrides?: CallOverrides): Promise<BigNumber>;
"balanceOf(address)"(
arg0: string,
"balanceOf(uint256)"(
arg0: BigNumberish,
overrides?: CallOverrides

@@ -243,6 +246,9 @@ ): Promise<BigNumber>;

callStatic: {
balanceOf(arg0: string, overrides?: CallOverrides): Promise<BigNumber>;
balanceOf(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
"balanceOf(address)"(
arg0: string,
"balanceOf(uint256)"(
arg0: BigNumberish,
overrides?: CallOverrides

@@ -306,10 +312,17 @@ ): Promise<BigNumber>;

Withdrawal(_l1Receiver: string | null, _amount: null): EventFilter;
Withdrawal(
_l2Sender: string | null,
_l1Receiver: string | null,
_amount: null
): EventFilter;
};
estimateGas: {
balanceOf(arg0: string, overrides?: CallOverrides): Promise<BigNumber>;
balanceOf(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
"balanceOf(address)"(
arg0: string,
"balanceOf(uint256)"(
arg0: BigNumberish,
overrides?: CallOverrides

@@ -373,8 +386,8 @@ ): Promise<BigNumber>;

balanceOf(
arg0: string,
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
"balanceOf(address)"(
arg0: string,
"balanceOf(uint256)"(
arg0: BigNumberish,
overrides?: CallOverrides

@@ -381,0 +394,0 @@ ): Promise<PopulatedTransaction>;

@@ -70,2 +70,8 @@ /* Autogenerated file. Do not edit manually. */

internalType: "address",
name: "_l2Sender",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "_l1Receiver",

@@ -87,5 +93,5 @@ type: "address",

{
internalType: "address",
internalType: "uint256",
name: "",
type: "address",
type: "uint256",
},

@@ -92,0 +98,0 @@ ],

@@ -35,48 +35,48 @@ /* Autogenerated file. Do not edit manually. */

encodeFunctionData(
functionFragment: "claimFailedDeposit",
values: [
string,
string,
BytesLike,
BigNumberish,
BigNumberish,
BigNumberish,
BytesLike[]
]
functionFragment: "claimFailedDeposit",
values: [
string,
string,
BytesLike,
BigNumberish,
BigNumberish,
BigNumberish,
BytesLike[]
]
): string;
encodeFunctionData(
functionFragment: "deposit",
values: [string, string, BigNumberish, BigNumberish, BigNumberish, string]
functionFragment: "deposit",
values: [string, string, BigNumberish, BigNumberish, BigNumberish, string]
): string;
encodeFunctionData(
functionFragment: "finalizeWithdrawal",
values: [BigNumberish, BigNumberish, BigNumberish, BytesLike, BytesLike[]]
functionFragment: "finalizeWithdrawal",
values: [BigNumberish, BigNumberish, BigNumberish, BytesLike, BytesLike[]]
): string;
encodeFunctionData(
functionFragment: "isWithdrawalFinalized",
values: [BigNumberish, BigNumberish]
functionFragment: "isWithdrawalFinalized",
values: [BigNumberish, BigNumberish]
): string;
encodeFunctionData(functionFragment: "l2Bridge", values?: undefined): string;
encodeFunctionData(
functionFragment: "l2TokenAddress",
values: [string]
functionFragment: "l2TokenAddress",
values: [string]
): string;
decodeFunctionResult(
functionFragment: "claimFailedDeposit",
data: BytesLike
functionFragment: "claimFailedDeposit",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "deposit", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "finalizeWithdrawal",
data: BytesLike
functionFragment: "finalizeWithdrawal",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "isWithdrawalFinalized",
data: BytesLike
functionFragment: "isWithdrawalFinalized",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "l2Bridge", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "l2TokenAddress",
data: BytesLike
functionFragment: "l2TokenAddress",
data: BytesLike
): Result;

@@ -110,65 +110,65 @@

claimFailedDeposit(
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<ContractTransaction>;
"claimFailedDeposit(address,address,bytes32,uint256,uint256,uint16,bytes32[])"(
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<ContractTransaction>;
deposit(
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
): Promise<ContractTransaction>;
"deposit(address,address,uint256,uint256,uint256,address)"(
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
): Promise<ContractTransaction>;
finalizeWithdrawal(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<ContractTransaction>;
"finalizeWithdrawal(uint256,uint256,uint16,bytes,bytes32[])"(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<ContractTransaction>;
isWithdrawalFinalized(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
): Promise<{

@@ -179,5 +179,5 @@ 0: boolean;

"isWithdrawalFinalized(uint256,uint256)"(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
): Promise<{

@@ -196,4 +196,4 @@ 0: boolean;

l2TokenAddress(
_l1Token: string,
overrides?: CallOverrides
_l1Token: string,
overrides?: CallOverrides
): Promise<{

@@ -204,4 +204,4 @@ 0: string;

"l2TokenAddress(address)"(
_l1Token: string,
overrides?: CallOverrides
_l1Token: string,
overrides?: CallOverrides
): Promise<{

@@ -213,71 +213,71 @@ 0: string;

claimFailedDeposit(
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<ContractTransaction>;
"claimFailedDeposit(address,address,bytes32,uint256,uint256,uint16,bytes32[])"(
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<ContractTransaction>;
deposit(
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
): Promise<ContractTransaction>;
"deposit(address,address,uint256,uint256,uint256,address)"(
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
): Promise<ContractTransaction>;
finalizeWithdrawal(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<ContractTransaction>;
"finalizeWithdrawal(uint256,uint256,uint16,bytes,bytes32[])"(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<ContractTransaction>;
isWithdrawalFinalized(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
): Promise<boolean>;
"isWithdrawalFinalized(uint256,uint256)"(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
): Promise<boolean>;

@@ -292,4 +292,4 @@

"l2TokenAddress(address)"(
_l1Token: string,
overrides?: CallOverrides
_l1Token: string,
overrides?: CallOverrides
): Promise<string>;

@@ -299,71 +299,71 @@

claimFailedDeposit(
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: CallOverrides
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: CallOverrides
): Promise<void>;
"claimFailedDeposit(address,address,bytes32,uint256,uint256,uint16,bytes32[])"(
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: CallOverrides
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: CallOverrides
): Promise<void>;
deposit(
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: CallOverrides
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: CallOverrides
): Promise<string>;
"deposit(address,address,uint256,uint256,uint256,address)"(
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: CallOverrides
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: CallOverrides
): Promise<string>;
finalizeWithdrawal(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: CallOverrides
): Promise<void>;
"finalizeWithdrawal(uint256,uint256,uint16,bytes,bytes32[])"(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: CallOverrides
): Promise<void>;
isWithdrawalFinalized(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
): Promise<boolean>;
"isWithdrawalFinalized(uint256,uint256)"(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
): Promise<boolean>;

@@ -376,9 +376,9 @@

l2TokenAddress(
_l1Token: string,
overrides?: CallOverrides
_l1Token: string,
overrides?: CallOverrides
): Promise<string>;
"l2TokenAddress(address)"(
_l1Token: string,
overrides?: CallOverrides
_l1Token: string,
overrides?: CallOverrides
): Promise<string>;

@@ -389,19 +389,19 @@ };

ClaimedFailedDeposit(
to: string | null,
l1Token: string | null,
amount: null
to: string | null,
l1Token: string | null,
amount: null
): EventFilter;
DepositInitiated(
l2DepositTxHash: BytesLike | null,
from: string | null,
to: string | null,
l1Token: null,
amount: null
l2DepositTxHash: BytesLike | null,
from: string | null,
to: string | null,
l1Token: null,
amount: null
): EventFilter;
WithdrawalFinalized(
to: string | null,
l1Token: string | null,
amount: null
to: string | null,
l1Token: string | null,
amount: null
): EventFilter;

@@ -412,71 +412,71 @@ };

claimFailedDeposit(
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<BigNumber>;
"claimFailedDeposit(address,address,bytes32,uint256,uint256,uint16,bytes32[])"(
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<BigNumber>;
deposit(
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
): Promise<BigNumber>;
"deposit(address,address,uint256,uint256,uint256,address)"(
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
): Promise<BigNumber>;
finalizeWithdrawal(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<BigNumber>;
"finalizeWithdrawal(uint256,uint256,uint16,bytes,bytes32[])"(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<BigNumber>;
isWithdrawalFinalized(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
"isWithdrawalFinalized(uint256,uint256)"(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;

@@ -489,9 +489,9 @@

l2TokenAddress(
_l1Token: string,
overrides?: CallOverrides
_l1Token: string,
overrides?: CallOverrides
): Promise<BigNumber>;
"l2TokenAddress(address)"(
_l1Token: string,
overrides?: CallOverrides
_l1Token: string,
overrides?: CallOverrides
): Promise<BigNumber>;

@@ -502,71 +502,71 @@ };

claimFailedDeposit(
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<PopulatedTransaction>;
"claimFailedDeposit(address,address,bytes32,uint256,uint256,uint16,bytes32[])"(
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
_depositSender: string,
_l1Token: string,
_l2TxHash: BytesLike,
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<PopulatedTransaction>;
deposit(
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
): Promise<PopulatedTransaction>;
"deposit(address,address,uint256,uint256,uint256,address)"(
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
_l2Receiver: string,
_l1Token: string,
_amount: BigNumberish,
_l2TxGasLimit: BigNumberish,
_l2TxGasPerPubdataByte: BigNumberish,
_refundRecipient: string,
overrides?: PayableOverrides
): Promise<PopulatedTransaction>;
finalizeWithdrawal(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<PopulatedTransaction>;
"finalizeWithdrawal(uint256,uint256,uint16,bytes,bytes32[])"(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
_l2TxNumberInBlock: BigNumberish,
_message: BytesLike,
_merkleProof: BytesLike[],
overrides?: Overrides
): Promise<PopulatedTransaction>;
isWithdrawalFinalized(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
"isWithdrawalFinalized(uint256,uint256)"(
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
_l2BlockNumber: BigNumberish,
_l2MessageIndex: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;

@@ -579,11 +579,11 @@

l2TokenAddress(
_l1Token: string,
overrides?: CallOverrides
_l1Token: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
"l2TokenAddress(address)"(
_l1Token: string,
overrides?: CallOverrides
_l1Token: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
};
}

@@ -12,4 +12,4 @@ /* Autogenerated file. Do not edit manually. */

static connect(
address: string,
signerOrProvider: Signer | Provider
address: string,
signerOrProvider: Signer | Provider
): IL1Bridge {

@@ -284,2 +284,2 @@ return new Contract(address, _abi, signerOrProvider) as IL1Bridge;

},
];
];

@@ -17,2 +17,3 @@ /* Autogenerated file. Do not edit manually. */

Overrides,
PayableOverrides,
CallOverrides,

@@ -27,3 +28,2 @@ } from "@ethersproject/contracts";

"finalizeDeposit(address,address,address,uint256,bytes)": FunctionFragment;
"initialize(address,bytes32,address)": FunctionFragment;
"l1Bridge()": FunctionFragment;

@@ -39,6 +39,2 @@ "l1TokenAddress(address)": FunctionFragment;

): string;
encodeFunctionData(
functionFragment: "initialize",
values: [string, BytesLike, string]
): string;
encodeFunctionData(functionFragment: "l1Bridge", values?: undefined): string;

@@ -62,3 +58,2 @@ encodeFunctionData(

): Result;
decodeFunctionResult(functionFragment: "initialize", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "l1Bridge", data: BytesLike): Result;

@@ -75,3 +70,9 @@ decodeFunctionResult(

events: {};
events: {
"FinalizeDeposit(address,address,address,uint256)": EventFragment;
"WithdrawalInitiated(address,address,address,uint256)": EventFragment;
};
getEvent(nameOrSignatureOrTopic: "FinalizeDeposit"): EventFragment;
getEvent(nameOrSignatureOrTopic: "WithdrawalInitiated"): EventFragment;
}

@@ -99,3 +100,3 @@

_data: BytesLike,
overrides?: Overrides
overrides?: PayableOverrides
): Promise<ContractTransaction>;

@@ -109,19 +110,5 @@

_data: BytesLike,
overrides?: Overrides
overrides?: PayableOverrides
): Promise<ContractTransaction>;
initialize(
_l1Bridge: string,
_l2TokenProxyBytecodeHash: BytesLike,
_governor: string,
overrides?: Overrides
): Promise<ContractTransaction>;
"initialize(address,bytes32,address)"(
_l1Bridge: string,
_l2TokenProxyBytecodeHash: BytesLike,
_governor: string,
overrides?: Overrides
): Promise<ContractTransaction>;
l1Bridge(overrides?: CallOverrides): Promise<{

@@ -184,3 +171,3 @@ 0: string;

_data: BytesLike,
overrides?: Overrides
overrides?: PayableOverrides
): Promise<ContractTransaction>;

@@ -194,19 +181,5 @@

_data: BytesLike,
overrides?: Overrides
overrides?: PayableOverrides
): Promise<ContractTransaction>;
initialize(
_l1Bridge: string,
_l2TokenProxyBytecodeHash: BytesLike,
_governor: string,
overrides?: Overrides
): Promise<ContractTransaction>;
"initialize(address,bytes32,address)"(
_l1Bridge: string,
_l2TokenProxyBytecodeHash: BytesLike,
_governor: string,
overrides?: Overrides
): Promise<ContractTransaction>;
l1Bridge(overrides?: CallOverrides): Promise<string>;

@@ -263,16 +236,2 @@

initialize(
_l1Bridge: string,
_l2TokenProxyBytecodeHash: BytesLike,
_governor: string,
overrides?: CallOverrides
): Promise<void>;
"initialize(address,bytes32,address)"(
_l1Bridge: string,
_l2TokenProxyBytecodeHash: BytesLike,
_governor: string,
overrides?: CallOverrides
): Promise<void>;
l1Bridge(overrides?: CallOverrides): Promise<string>;

@@ -317,4 +276,18 @@

filters: {};
filters: {
FinalizeDeposit(
l1Sender: string | null,
l2Receiver: string | null,
l2Token: string | null,
amount: null
): EventFilter;
WithdrawalInitiated(
l2Sender: string | null,
l1Receiver: string | null,
l2Token: string | null,
amount: null
): EventFilter;
};
estimateGas: {

@@ -327,3 +300,3 @@ finalizeDeposit(

_data: BytesLike,
overrides?: Overrides
overrides?: PayableOverrides
): Promise<BigNumber>;

@@ -337,19 +310,5 @@

_data: BytesLike,
overrides?: Overrides
overrides?: PayableOverrides
): Promise<BigNumber>;
initialize(
_l1Bridge: string,
_l2TokenProxyBytecodeHash: BytesLike,
_governor: string,
overrides?: Overrides
): Promise<BigNumber>;
"initialize(address,bytes32,address)"(
_l1Bridge: string,
_l2TokenProxyBytecodeHash: BytesLike,
_governor: string,
overrides?: Overrides
): Promise<BigNumber>;
l1Bridge(overrides?: CallOverrides): Promise<BigNumber>;

@@ -401,3 +360,3 @@

_data: BytesLike,
overrides?: Overrides
overrides?: PayableOverrides
): Promise<PopulatedTransaction>;

@@ -411,19 +370,5 @@

_data: BytesLike,
overrides?: Overrides
overrides?: PayableOverrides
): Promise<PopulatedTransaction>;
initialize(
_l1Bridge: string,
_l2TokenProxyBytecodeHash: BytesLike,
_governor: string,
overrides?: Overrides
): Promise<PopulatedTransaction>;
"initialize(address,bytes32,address)"(
_l1Bridge: string,
_l2TokenProxyBytecodeHash: BytesLike,
_governor: string,
overrides?: Overrides
): Promise<PopulatedTransaction>;
l1Bridge(overrides?: CallOverrides): Promise<PopulatedTransaction>;

@@ -430,0 +375,0 @@

@@ -21,33 +21,62 @@ /* Autogenerated file. Do not edit manually. */

{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "_l1Sender",
name: "l1Sender",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "_l2Receiver",
name: "l2Receiver",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "_l1Token",
name: "l2Token",
type: "address",
},
{
indexed: false,
internalType: "uint256",
name: "_amount",
name: "amount",
type: "uint256",
},
],
name: "FinalizeDeposit",
type: "event",
},
{
anonymous: false,
inputs: [
{
internalType: "bytes",
name: "_data",
type: "bytes",
indexed: true,
internalType: "address",
name: "l2Sender",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "l1Receiver",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "l2Token",
type: "address",
},
{
indexed: false,
internalType: "uint256",
name: "amount",
type: "uint256",
},
],
name: "finalizeDeposit",
outputs: [],
stateMutability: "nonpayable",
type: "function",
name: "WithdrawalInitiated",
type: "event",
},

@@ -58,19 +87,29 @@ {

internalType: "address",
name: "_l1Bridge",
name: "_l1Sender",
type: "address",
},
{
internalType: "bytes32",
name: "_l2TokenProxyBytecodeHash",
type: "bytes32",
internalType: "address",
name: "_l2Receiver",
type: "address",
},
{
internalType: "address",
name: "_governor",
name: "_l1Token",
type: "address",
},
{
internalType: "uint256",
name: "_amount",
type: "uint256",
},
{
internalType: "bytes",
name: "_data",
type: "bytes",
},
],
name: "initialize",
name: "finalizeDeposit",
outputs: [],
stateMutability: "nonpayable",
stateMutability: "payable",
type: "function",

@@ -77,0 +116,0 @@ },

@@ -1,13 +0,21 @@

export { IZkSyncFactory } from './IZkSyncFactory';
export type { IZkSync } from './IZkSync';
export { IERC20MetadataFactory } from './IERC20MetadataFactory';
export type { IERC20Metadata } from './IERC20Metadata';
export { IL1BridgeFactory } from './IL1BridgeFactory';
export type { IL1Bridge } from './IL1Bridge';
export { IL2BridgeFactory } from './IL2BridgeFactory';
export type { IL2Bridge } from './IL2Bridge';
export { IAllowListFactory } from './IAllowListFactory';
export type { IAllowList } from './IAllowList';
export { IEthTokenFactory } from './IEthTokenFactory';
export type { IEthToken } from './IEthToken';
export {ContractDeployerFactory} from './ContractDeployerFactory';
export type {ContractDeployer} from './ContractDeployer';
export {IAllowListFactory} from './IAllowListFactory';
export type {IAllowList} from './IAllowList';
export {IERC20Factory} from './IERC20Factory';
export type {IERC20} from './IERC20';
export {IERC1271Factory} from './IERC1271Factory';
export type {IERC1271} from './IERC1271';
export {IEthTokenFactory} from './IEthTokenFactory';
export type {IEthToken} from './IEthToken';
export {IL1BridgeFactory} from './IL1BridgeFactory';
export type {IL1Bridge} from './IL1Bridge';
export {IL1MessengerFactory} from './IL1MessengerFactory';
export type {IL1Messenger} from './IL1Messenger';
export {IL2BridgeFactory} from './IL2BridgeFactory';
export type {IL2Bridge} from './IL2Bridge';
export {IPaymasterFlowFactory} from './IPaymasterFlowFactory';
export type {IPaymasterFlow} from './IPaymasterFlow';
export {IZkSyncFactory} from './IZkSyncFactory';
export type {IZkSync} from './IZkSync';

@@ -220,40 +220,2 @@ /* Autogenerated file. Do not edit manually. */

indexed: true,
internalType: "bytes32",
name: "previousBytecodeHash",
type: "bytes32",
},
{
indexed: true,
internalType: "bytes32",
name: "newBytecodeHash",
type: "bytes32",
},
],
name: "NewL2BootloaderBytecodeHash",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "bytes32",
name: "previousBytecodeHash",
type: "bytes32",
},
{
indexed: true,
internalType: "bytes32",
name: "newBytecodeHash",
type: "bytes32",
},
],
name: "NewL2DefaultAccountBytecodeHash",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",

@@ -416,74 +378,2 @@ name: "oldPendingGovernor",

indexed: true,
internalType: "address",
name: "oldVerifier",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "newVerifier",
type: "address",
},
],
name: "NewVerifier",
type: "event",
},
{
anonymous: false,
inputs: [
{
components: [
{
internalType: "bytes32",
name: "recursionNodeLevelVkHash",
type: "bytes32",
},
{
internalType: "bytes32",
name: "recursionLeafLevelVkHash",
type: "bytes32",
},
{
internalType: "bytes32",
name: "recursionCircuitsSetVksHash",
type: "bytes32",
},
],
indexed: false,
internalType: "struct VerifierParams",
name: "oldVerifierParams",
type: "tuple",
},
{
components: [
{
internalType: "bytes32",
name: "recursionNodeLevelVkHash",
type: "bytes32",
},
{
internalType: "bytes32",
name: "recursionLeafLevelVkHash",
type: "bytes32",
},
{
internalType: "bytes32",
name: "recursionCircuitsSetVksHash",
type: "bytes32",
},
],
indexed: false,
internalType: "struct VerifierParams",
name: "newVerifierParams",
type: "tuple",
},
],
name: "NewVerifierParams",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "uint256",

@@ -983,2 +873,15 @@ name: "proposalId",

inputs: [],
name: "getAllowList",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "getCurrentProposalId",

@@ -1075,2 +978,15 @@ outputs: [

inputs: [],
name: "getPriorityTxMaxGasLimit",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "getProposedUpgradeHash",

@@ -1102,2 +1018,15 @@ outputs: [

inputs: [],
name: "getProtocolVersion",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "getSecurityCouncil",

@@ -1224,15 +1153,2 @@ outputs: [

inputs: [],
name: "getpriorityTxMaxGasLimit",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "isApprovedBySecurityCouncil",

@@ -1854,28 +1770,2 @@ outputs: [

{
internalType: "bytes32",
name: "_l2BootloaderBytecodeHash",
type: "bytes32",
},
],
name: "setL2BootloaderBytecodeHash",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "bytes32",
name: "_l2DefaultAccountBytecodeHash",
type: "bytes32",
},
],
name: "setL2DefaultAccountBytecodeHash",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address",

@@ -1938,45 +1828,2 @@ name: "_newPendingGovernor",

{
internalType: "contract Verifier",
name: "_newVerifier",
type: "address",
},
],
name: "setVerifier",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
components: [
{
internalType: "bytes32",
name: "recursionNodeLevelVkHash",
type: "bytes32",
},
{
internalType: "bytes32",
name: "recursionLeafLevelVkHash",
type: "bytes32",
},
{
internalType: "bytes32",
name: "recursionCircuitsSetVksHash",
type: "bytes32",
},
],
internalType: "struct VerifierParams",
name: "_newVerifierParams",
type: "tuple",
},
],
name: "setVerifierParams",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "uint256",

@@ -1983,0 +1830,0 @@ name: "_blockNumber",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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