You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// biome-ignore lint/suspicious/noExplicitAny: TODO add to RPC method types
185
-
method: "zks_estimateFee"asany,
186
-
// biome-ignore lint/suspicious/noExplicitAny: TODO add to RPC method types
187
-
params: [replaceBigInts(params,toHex)]asany,
188
-
}))as{
189
-
gas_limit: string;
190
-
max_fee_per_gas: string;
191
-
max_priority_fee_per_gas: string;
192
-
gas_per_pubdata_limit: string;
193
-
};
194
-
gas=toBigInt(result.gas_limit)*2n;// overestimating to avoid issues when not accounting for paymaster extra gas ( we should really pass the paymaster input above for better accuracy )
195
-
constbaseFee=toBigInt(result.max_fee_per_gas);
196
-
maxFeePerGas=baseFee*2n;// bumping the base fee per gas to ensure fast inclusion
gasPerPubdata=toBigInt(result.gas_per_pubdata_limit)*2n;// doubling for fast inclusion;
199
-
if(gasPerPubdata<50000n){
200
-
// enforce a minimum gas per pubdata limit
201
-
gasPerPubdata=50000n;
183
+
184
+
// Try zkSync-specific fee estimation first, fallback to standard EVM methods
185
+
try{
186
+
constresult=(awaitrpc({
187
+
// biome-ignore lint/suspicious/noExplicitAny: TODO add to RPC method types
188
+
method: "zks_estimateFee"asany,
189
+
// biome-ignore lint/suspicious/noExplicitAny: TODO add to RPC method types
190
+
params: [replaceBigInts(params,toHex)]asany,
191
+
}))as{
192
+
gas_limit: string;
193
+
max_fee_per_gas: string;
194
+
max_priority_fee_per_gas: string;
195
+
gas_per_pubdata_limit: string;
196
+
};
197
+
gas=toBigInt(result.gas_limit)*2n;// overestimating to avoid issues when not accounting for paymaster extra gas ( we should really pass the paymaster input above for better accuracy )
198
+
constbaseFee=toBigInt(result.max_fee_per_gas);
199
+
maxFeePerGas=baseFee*2n;// bumping the base fee per gas to ensure fast inclusion
0 commit comments