Skip to content

Commit

Permalink
refactor: remove type cast and add comment for context
Browse files Browse the repository at this point in the history
  • Loading branch information
spsjvc committed Oct 3, 2024
1 parent 6b73f5f commit fdb7d29
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/createRollupGetRetryablesFees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export async function createRollupGetRetryablesFees<TChain extends Chain | undef
percentIncrease: isCustomGasToken ? undefined : 30n,
});

const callParams = {
const callParams: CallParameters = {
account,
data: encodeFunctionData({
abi: deployHelperABI,
Expand All @@ -120,7 +120,9 @@ export async function createRollupGetRetryablesFees<TChain extends Chain | undef
maxFeePerGas: baseFeeWithBuffer,
};

// calculate gas necessary for the call, otherwise it's inflated and the call will fail
// calculate the gas necessary for the call, otherwise it's inflated and the call will fail
//
// https://github.com/wevm/viem/discussions/862#discussioncomment-6398745
const gasWithBuffer = applyPercentIncrease({
base: await publicClient.estimateGas(callParams as unknown as EstimateGasParameters<TChain>),
percentIncrease: 30n,
Expand All @@ -129,7 +131,7 @@ export async function createRollupGetRetryablesFees<TChain extends Chain | undef
const { data: result } = await publicClient.call({
...callParams,
gas: gasWithBuffer,
} as unknown as CallParameters<TChain>);
});

return decodeFunctionResult({
abi: deployHelperABI,
Expand Down

0 comments on commit fdb7d29

Please sign in to comment.