opstack-kit-chains
Version:
Support your OP-Stack network with 'opstack-kit'
30 lines • 1.32 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.estimateProveWithdrawalGas = void 0;
const estimateContractGas_js_1 = require("../../actions/public/estimateContractGas.js");
const abis_js_1 = require("../abis.js");
async function estimateProveWithdrawalGas(client, parameters) {
const { account, chain = client.chain, gas, l2OutputIndex, maxFeePerGas, maxPriorityFeePerGas, nonce, outputRootProof, targetChain, withdrawalProof, withdrawal, } = parameters;
const portalAddress = (() => {
if (parameters.portalAddress)
return parameters.portalAddress;
if (chain)
return targetChain.contracts.portal[chain.id].address;
return Object.values(targetChain.contracts.portal)[0].address;
})();
const params = {
account,
abi: abis_js_1.portalAbi,
address: portalAddress,
functionName: 'proveWithdrawalTransaction',
args: [withdrawal, l2OutputIndex, outputRootProof, withdrawalProof],
gas,
maxFeePerGas,
maxPriorityFeePerGas,
nonce,
chain,
};
return (0, estimateContractGas_js_1.estimateContractGas)(client, params);
}
exports.estimateProveWithdrawalGas = estimateProveWithdrawalGas;
//# sourceMappingURL=estimateProveWithdrawalGas.js.map
;