zksync-web3
Advanced tools
Comparing version 0.13.0-beta.1 to 0.13.0-beta.2
@@ -35,3 +35,3 @@ import { BigNumber, BigNumberish, ethers, BytesLike } from 'ethers'; | ||
approveERC20?: boolean; | ||
gasLimit?: BigNumberish; | ||
l2GasLimit?: BigNumberish; | ||
gasPerPubdataByte?: BigNumberish; | ||
@@ -55,3 +55,3 @@ overrides?: ethers.PayableOverrides; | ||
calldata: BytesLike; | ||
gasLimit: BigNumberish; | ||
l2GasLimit: BigNumberish; | ||
l2Value?: BigNumberish; | ||
@@ -58,0 +58,0 @@ factoryDeps?: ethers.BytesLike[]; |
@@ -71,3 +71,6 @@ "use strict"; | ||
} | ||
return await erc20contract.approve(bridgeAddress, amount, { gasLimit, ...overrides }); | ||
return await erc20contract.approve(bridgeAddress, amount, { | ||
gasLimit, | ||
...overrides | ||
}); | ||
} | ||
@@ -93,3 +96,3 @@ async getBaseCost(params) { | ||
(_d = tx.gasPerPubdataByte) !== null && _d !== void 0 ? _d : (tx.gasPerPubdataByte = utils_1.DEFAULT_GAS_PER_PUBDATA_LIMIT); | ||
(_e = tx.gasLimit) !== null && _e !== void 0 ? _e : (tx.gasLimit = ethers_1.BigNumber.from(utils_1.RECOMMENDED_DEPOSIT_L2_GAS_LIMIT)); | ||
(_e = tx.l2GasLimit) !== null && _e !== void 0 ? _e : (tx.l2GasLimit = ethers_1.BigNumber.from(utils_1.RECOMMENDED_DEPOSIT_L2_GAS_LIMIT)); | ||
const { to, token, amount, operatorTip, overrides } = tx; | ||
@@ -104,3 +107,3 @@ (_f = overrides.gasPrice) !== null && _f !== void 0 ? _f : (overrides.gasPrice = await this._providerL1().getGasPrice()); | ||
amount, | ||
tx.gasLimit, | ||
tx.l2GasLimit, | ||
tx.gasPerPubdataByte | ||
@@ -116,3 +119,3 @@ ]; | ||
// tx.gasLimit | ||
gasLimit: tx.gasLimit, | ||
l2GasLimit: tx.l2GasLimit, | ||
...tx | ||
@@ -220,3 +223,3 @@ }); | ||
(_f = tx.refundRecipient) !== null && _f !== void 0 ? _f : (tx.refundRecipient = await this.getAddress()); | ||
const { contractAddress, l2Value, calldata, gasLimit, factoryDeps, operatorTip, overrides, gasPerPubdataByte, refundRecipient } = tx; | ||
const { contractAddress, l2Value, calldata, l2GasLimit, factoryDeps, operatorTip, overrides, gasPerPubdataByte, refundRecipient } = tx; | ||
(_g = overrides.gasPrice) !== null && _g !== void 0 ? _g : (overrides.gasPrice = await this._providerL1().getGasPrice()); | ||
@@ -227,7 +230,7 @@ (_h = overrides.gasLimit) !== null && _h !== void 0 ? _h : (overrides.gasLimit = ethers_1.BigNumber.from(utils_1.RECOMMENDED_GAS_LIMIT.EXECUTE)); | ||
gasPerPubdataByte, | ||
gasLimit | ||
gasLimit: l2GasLimit | ||
}); | ||
(_j = overrides.value) !== null && _j !== void 0 ? _j : (overrides.value = baseCost.add(operatorTip).add(l2Value)); | ||
await (0, utils_1.checkBaseCost)(baseCost, overrides.value); | ||
return this._providerL2().getPriorityOpResponse(await zksyncContract.requestL2Transaction(contractAddress, l2Value, calldata, gasLimit, utils_1.DEFAULT_GAS_PER_PUBDATA_LIMIT, factoryDeps, refundRecipient, overrides)); | ||
return this._providerL2().getPriorityOpResponse(await zksyncContract.requestL2Transaction(contractAddress, l2Value, calldata, l2GasLimit, utils_1.DEFAULT_GAS_PER_PUBDATA_LIMIT, factoryDeps, refundRecipient, overrides)); | ||
} | ||
@@ -260,3 +263,3 @@ }; | ||
const customData = { ...data }; | ||
(_a = customData.ergsPerPubdata) !== null && _a !== void 0 ? _a : (customData.ergsPerPubdata = utils_1.DEFAULT_GAS_PER_PUBDATA_LIMIT); | ||
(_a = customData.gasPerPubdata) !== null && _a !== void 0 ? _a : (customData.gasPerPubdata = utils_1.DEFAULT_GAS_PER_PUBDATA_LIMIT); | ||
(_b = customData.factoryDeps) !== null && _b !== void 0 ? _b : (customData.factoryDeps = []); | ||
@@ -263,0 +266,0 @@ return customData; |
@@ -153,4 +153,3 @@ "use strict"; | ||
result.eip712Meta = { | ||
// TODO: update server and use gasPerPubdata | ||
ergsPerPubdata: 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) | ||
}; | ||
@@ -157,0 +156,0 @@ transaction.type = utils_1.EIP712_TX_TYPE; |
@@ -97,3 +97,3 @@ import { ethers } from 'ethers'; | ||
approveERC20?: boolean; | ||
gasLimit?: ethers.BigNumberish; | ||
l2GasLimit?: ethers.BigNumberish; | ||
gasPerPubdataByte?: ethers.BigNumberish; | ||
@@ -117,3 +117,3 @@ overrides?: ethers.PayableOverrides; | ||
calldata: ethers.utils.BytesLike; | ||
gasLimit: ethers.BigNumberish; | ||
l2GasLimit: ethers.BigNumberish; | ||
l2Value?: ethers.BigNumberish; | ||
@@ -120,0 +120,0 @@ factoryDeps?: ethers.utils.BytesLike[]; |
@@ -38,3 +38,3 @@ "use strict"; | ||
const maxPriorityFeePerGas = transaction.maxPriorityFeePerGas || maxFeePerGas; | ||
const gasPerPubdataByteLimit = ((_a = transaction.customData) === null || _a === void 0 ? void 0 : _a.ergsPerPubdata) || utils_1.DEFAULT_GAS_PER_PUBDATA_LIMIT; | ||
const gasPerPubdataByteLimit = ((_a = transaction.customData) === null || _a === void 0 ? void 0 : _a.gasPerPubdata) || utils_1.DEFAULT_GAS_PER_PUBDATA_LIMIT; | ||
const signInput = { | ||
@@ -41,0 +41,0 @@ txType: transaction.type, |
@@ -32,3 +32,3 @@ import { BytesLike, BigNumberish, providers, BigNumber } from 'ethers'; | ||
export type Eip712Meta = { | ||
ergsPerPubdata?: BigNumberish; | ||
gasPerPubdata?: BigNumberish; | ||
factoryDeps?: BytesLike[]; | ||
@@ -35,0 +35,0 @@ customSignature?: BytesLike; |
@@ -169,3 +169,3 @@ "use strict"; | ||
// Add meta | ||
fields.push(formatNumber(meta.ergsPerPubdata || 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))); | ||
@@ -254,3 +254,3 @@ if (meta.customSignature && ethers_1.ethers.utils.arrayify(meta.customSignature).length == 0) { | ||
customData: { | ||
ergsPerPubdata: handleNumber(raw[12]), | ||
gasPerPubdata: handleNumber(raw[12]), | ||
factoryDeps: raw[13], | ||
@@ -257,0 +257,0 @@ customSignature: raw[14], |
@@ -58,3 +58,3 @@ import { EIP712Signer } from './signer'; | ||
approveERC20?: boolean; | ||
gasLimit?: ethers.BigNumberish; | ||
l2GasLimit?: ethers.BigNumberish; | ||
gasPerPubdataByte?: ethers.BigNumberish; | ||
@@ -78,3 +78,3 @@ overrides?: ethers.PayableOverrides; | ||
calldata: ethers.utils.BytesLike; | ||
gasLimit: ethers.BigNumberish; | ||
l2GasLimit: ethers.BigNumberish; | ||
l2Value?: ethers.BigNumberish; | ||
@@ -81,0 +81,0 @@ factoryDeps?: ethers.utils.BytesLike[]; |
{ | ||
"name": "zksync-web3", | ||
"version": "0.13.0-beta.1", | ||
"version": "0.13.0-beta.2", | ||
"main": "build/src/index.js", | ||
@@ -5,0 +5,0 @@ "types": "build/src/index.d.ts", |
@@ -98,3 +98,6 @@ import { BigNumber, BigNumberish, ethers, BytesLike } from 'ethers'; | ||
return await erc20contract.approve(bridgeAddress, amount, { gasLimit, ...overrides }); | ||
return await erc20contract.approve(bridgeAddress, amount, { | ||
gasLimit, | ||
...overrides | ||
}); | ||
} | ||
@@ -128,3 +131,3 @@ | ||
approveERC20?: boolean; | ||
gasLimit?: BigNumberish; | ||
l2GasLimit?: BigNumberish; | ||
gasPerPubdataByte?: BigNumberish; | ||
@@ -144,3 +147,3 @@ overrides?: ethers.PayableOverrides; | ||
tx.gasPerPubdataByte ??= DEFAULT_GAS_PER_PUBDATA_LIMIT; | ||
tx.gasLimit ??= BigNumber.from(RECOMMENDED_DEPOSIT_L2_GAS_LIMIT); | ||
tx.l2GasLimit ??= BigNumber.from(RECOMMENDED_DEPOSIT_L2_GAS_LIMIT); | ||
@@ -158,3 +161,3 @@ const { to, token, amount, operatorTip, overrides } = tx; | ||
amount, | ||
tx.gasLimit, | ||
tx.l2GasLimit, | ||
tx.gasPerPubdataByte | ||
@@ -172,3 +175,3 @@ ]; | ||
// tx.gasLimit | ||
gasLimit: tx.gasLimit!, | ||
l2GasLimit: tx.l2GasLimit!, | ||
...tx | ||
@@ -324,3 +327,3 @@ }); | ||
calldata: BytesLike; | ||
gasLimit: BigNumberish; | ||
l2GasLimit: BigNumberish; | ||
l2Value?: BigNumberish; | ||
@@ -347,3 +350,3 @@ factoryDeps?: ethers.BytesLike[]; | ||
calldata, | ||
gasLimit, | ||
l2GasLimit, | ||
factoryDeps, | ||
@@ -361,3 +364,3 @@ operatorTip, | ||
gasPerPubdataByte, | ||
gasLimit | ||
gasLimit: l2GasLimit | ||
}); | ||
@@ -374,3 +377,3 @@ | ||
calldata, | ||
gasLimit, | ||
l2GasLimit, | ||
DEFAULT_GAS_PER_PUBDATA_LIMIT, | ||
@@ -412,3 +415,3 @@ factoryDeps, | ||
const customData = { ...data }; | ||
customData.ergsPerPubdata ??= DEFAULT_GAS_PER_PUBDATA_LIMIT; | ||
customData.gasPerPubdata ??= DEFAULT_GAS_PER_PUBDATA_LIMIT; | ||
customData.factoryDeps ??= []; | ||
@@ -415,0 +418,0 @@ return customData; |
@@ -209,4 +209,3 @@ import { ethers, BigNumber, BigNumberish, utils, providers, BytesLike, Contract } from 'ethers'; | ||
result.eip712Meta = { | ||
// TODO: update server and use gasPerPubdata | ||
ergsPerPubdata: utils.hexValue(transaction.customData.gasPerPubdata ?? 0) | ||
gasPerPubdata: utils.hexValue(transaction.customData.gasPerPubdata ?? 0) | ||
} as any; | ||
@@ -213,0 +212,0 @@ transaction.type = EIP712_TX_TYPE; |
@@ -40,3 +40,3 @@ import { ethers } from 'ethers'; | ||
const maxPriorityFeePerGas = transaction.maxPriorityFeePerGas || maxFeePerGas; | ||
const gasPerPubdataByteLimit = transaction.customData?.ergsPerPubdata || DEFAULT_GAS_PER_PUBDATA_LIMIT; | ||
const gasPerPubdataByteLimit = transaction.customData?.gasPerPubdata || DEFAULT_GAS_PER_PUBDATA_LIMIT; | ||
const signInput = { | ||
@@ -43,0 +43,0 @@ txType: transaction.type, |
@@ -42,3 +42,3 @@ import { BytesLike, BigNumberish, providers, BigNumber } from 'ethers'; | ||
export type Eip712Meta = { | ||
ergsPerPubdata?: BigNumberish; | ||
gasPerPubdata?: BigNumberish; | ||
factoryDeps?: BytesLike[]; | ||
@@ -128,3 +128,5 @@ customSignature?: BytesLike; | ||
export type TransactionRequest = providers.TransactionRequest & { customData?: Eip712Meta }; | ||
export type TransactionRequest = providers.TransactionRequest & { | ||
customData?: Eip712Meta; | ||
}; | ||
@@ -131,0 +133,0 @@ export interface PriorityOpResponse extends TransactionResponse { |
@@ -193,3 +193,3 @@ import { utils, ethers, BigNumber, BigNumberish, BytesLike } from 'ethers'; | ||
// Add meta | ||
fields.push(formatNumber(meta.ergsPerPubdata || 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))); | ||
@@ -293,3 +293,3 @@ | ||
customData: { | ||
ergsPerPubdata: handleNumber(raw[12]), | ||
gasPerPubdata: handleNumber(raw[12]), | ||
factoryDeps: raw[13], | ||
@@ -296,0 +296,0 @@ customSignature: raw[14], |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
860344
27852