chore: estimate gas

This commit is contained in:
Danish Arora 2025-04-14 14:03:46 +05:30
parent e5ef13472c
commit e5a52d0a9c
No known key found for this signature in database
GPG Key ID: 1C6EF37CDAE1426E

View File

@ -432,9 +432,15 @@ export class RLNBaseContract {
idCommitmentBigInt: bigint,
eraseFromMembershipSet: boolean = true
): Promise<ethers.ContractTransaction> {
const estimatedGas = await this.contract.estimateGas[
"eraseMemberships(uint256[],bool)"
]([idCommitmentBigInt], eraseFromMembershipSet);
const gasLimit = estimatedGas.add(10000);
const tx = await this.contract["eraseMemberships(uint256[],bool)"](
[idCommitmentBigInt],
eraseFromMembershipSet
eraseFromMembershipSet,
{ gasLimit }
);
await tx.wait();
return tx;