anymal-protocol 1.0.116 → 1.0.117
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +16 -12
- package/dist/index.mjs +16 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1268,34 +1268,38 @@ var ORGANIZATION_IMPL_ABI = [
|
|
|
1268
1268
|
var import_react10 = require("react");
|
|
1269
1269
|
|
|
1270
1270
|
// src/helpers/GasEstimateHelper.tsx
|
|
1271
|
-
function applyBundlerGasEstimator(account, bundlerClient, options) {
|
|
1271
|
+
async function applyBundlerGasEstimator(account, bundlerClient, options) {
|
|
1272
1272
|
const {
|
|
1273
1273
|
callGasMultiplier = 1.2,
|
|
1274
1274
|
verificationGasMultiplier = 1.2,
|
|
1275
1275
|
preVerificationGasMultiplier = 2,
|
|
1276
|
+
maxCallGasPercentOfBlock = 0.1,
|
|
1277
|
+
// 10% for now?
|
|
1276
1278
|
debug = true
|
|
1277
1279
|
} = options || {};
|
|
1280
|
+
const publicClient = bundlerClient.client;
|
|
1281
|
+
const blockGasLimit = (await publicClient.getBlock()).gasLimit;
|
|
1282
|
+
const dynamicCallGasCap = blockGasLimit * BigInt(Math.floor(maxCallGasPercentOfBlock * 100)) / 100n;
|
|
1278
1283
|
account.userOperation = {
|
|
1279
1284
|
estimateGas: async (userOp) => {
|
|
1280
1285
|
const estimate = await bundlerClient.estimateUserOperationGas(userOp);
|
|
1281
|
-
const paddedCallGasLimit = BigInt(
|
|
1282
|
-
|
|
1283
|
-
);
|
|
1284
|
-
const
|
|
1285
|
-
estimate.verificationGasLimit * BigInt(Math.ceil(verificationGasMultiplier * 100)) / 100n
|
|
1286
|
-
);
|
|
1287
|
-
const paddedPreVerificationGas = BigInt(
|
|
1288
|
-
estimate.preVerificationGas * BigInt(Math.ceil(preVerificationGasMultiplier * 100)) / 100n
|
|
1289
|
-
);
|
|
1286
|
+
const paddedCallGasLimit = estimate.callGasLimit * BigInt(Math.ceil(callGasMultiplier * 100)) / 100n;
|
|
1287
|
+
const cappedCallGasLimit = paddedCallGasLimit > dynamicCallGasCap ? dynamicCallGasCap : paddedCallGasLimit;
|
|
1288
|
+
const paddedVerificationGasLimit = estimate.verificationGasLimit * BigInt(Math.ceil(verificationGasMultiplier * 100)) / 100n;
|
|
1289
|
+
const paddedPreVerificationGas = estimate.preVerificationGas * BigInt(Math.ceil(preVerificationGasMultiplier * 100)) / 100n;
|
|
1290
1290
|
if (debug) {
|
|
1291
1291
|
console.log("\u{1F4E6} Bundler Gas Estimates:");
|
|
1292
|
-
console.log("
|
|
1292
|
+
console.log(" blockGasLimit:", blockGasLimit.toString());
|
|
1293
|
+
console.log(" maxCallGasLimit (% cap):", dynamicCallGasCap.toString());
|
|
1294
|
+
console.log(" original callGasLimit:", estimate.callGasLimit.toString());
|
|
1295
|
+
console.log(" padded callGasLimit:", paddedCallGasLimit.toString());
|
|
1296
|
+
console.log(" capped callGasLimit:", cappedCallGasLimit.toString());
|
|
1293
1297
|
console.log(" verificationGasLimit:", paddedVerificationGasLimit.toString());
|
|
1294
1298
|
console.log(" preVerificationGas:", paddedPreVerificationGas.toString());
|
|
1295
1299
|
}
|
|
1296
1300
|
return {
|
|
1297
1301
|
...estimate,
|
|
1298
|
-
callGasLimit:
|
|
1302
|
+
callGasLimit: cappedCallGasLimit,
|
|
1299
1303
|
verificationGasLimit: paddedVerificationGasLimit,
|
|
1300
1304
|
preVerificationGas: paddedPreVerificationGas
|
|
1301
1305
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1205,34 +1205,38 @@ var ORGANIZATION_IMPL_ABI = [
|
|
|
1205
1205
|
import { useCallback as useCallback10 } from "react";
|
|
1206
1206
|
|
|
1207
1207
|
// src/helpers/GasEstimateHelper.tsx
|
|
1208
|
-
function applyBundlerGasEstimator(account, bundlerClient, options) {
|
|
1208
|
+
async function applyBundlerGasEstimator(account, bundlerClient, options) {
|
|
1209
1209
|
const {
|
|
1210
1210
|
callGasMultiplier = 1.2,
|
|
1211
1211
|
verificationGasMultiplier = 1.2,
|
|
1212
1212
|
preVerificationGasMultiplier = 2,
|
|
1213
|
+
maxCallGasPercentOfBlock = 0.1,
|
|
1214
|
+
// 10% for now?
|
|
1213
1215
|
debug = true
|
|
1214
1216
|
} = options || {};
|
|
1217
|
+
const publicClient = bundlerClient.client;
|
|
1218
|
+
const blockGasLimit = (await publicClient.getBlock()).gasLimit;
|
|
1219
|
+
const dynamicCallGasCap = blockGasLimit * BigInt(Math.floor(maxCallGasPercentOfBlock * 100)) / 100n;
|
|
1215
1220
|
account.userOperation = {
|
|
1216
1221
|
estimateGas: async (userOp) => {
|
|
1217
1222
|
const estimate = await bundlerClient.estimateUserOperationGas(userOp);
|
|
1218
|
-
const paddedCallGasLimit = BigInt(
|
|
1219
|
-
|
|
1220
|
-
);
|
|
1221
|
-
const
|
|
1222
|
-
estimate.verificationGasLimit * BigInt(Math.ceil(verificationGasMultiplier * 100)) / 100n
|
|
1223
|
-
);
|
|
1224
|
-
const paddedPreVerificationGas = BigInt(
|
|
1225
|
-
estimate.preVerificationGas * BigInt(Math.ceil(preVerificationGasMultiplier * 100)) / 100n
|
|
1226
|
-
);
|
|
1223
|
+
const paddedCallGasLimit = estimate.callGasLimit * BigInt(Math.ceil(callGasMultiplier * 100)) / 100n;
|
|
1224
|
+
const cappedCallGasLimit = paddedCallGasLimit > dynamicCallGasCap ? dynamicCallGasCap : paddedCallGasLimit;
|
|
1225
|
+
const paddedVerificationGasLimit = estimate.verificationGasLimit * BigInt(Math.ceil(verificationGasMultiplier * 100)) / 100n;
|
|
1226
|
+
const paddedPreVerificationGas = estimate.preVerificationGas * BigInt(Math.ceil(preVerificationGasMultiplier * 100)) / 100n;
|
|
1227
1227
|
if (debug) {
|
|
1228
1228
|
console.log("\u{1F4E6} Bundler Gas Estimates:");
|
|
1229
|
-
console.log("
|
|
1229
|
+
console.log(" blockGasLimit:", blockGasLimit.toString());
|
|
1230
|
+
console.log(" maxCallGasLimit (% cap):", dynamicCallGasCap.toString());
|
|
1231
|
+
console.log(" original callGasLimit:", estimate.callGasLimit.toString());
|
|
1232
|
+
console.log(" padded callGasLimit:", paddedCallGasLimit.toString());
|
|
1233
|
+
console.log(" capped callGasLimit:", cappedCallGasLimit.toString());
|
|
1230
1234
|
console.log(" verificationGasLimit:", paddedVerificationGasLimit.toString());
|
|
1231
1235
|
console.log(" preVerificationGas:", paddedPreVerificationGas.toString());
|
|
1232
1236
|
}
|
|
1233
1237
|
return {
|
|
1234
1238
|
...estimate,
|
|
1235
|
-
callGasLimit:
|
|
1239
|
+
callGasLimit: cappedCallGasLimit,
|
|
1236
1240
|
verificationGasLimit: paddedVerificationGasLimit,
|
|
1237
1241
|
preVerificationGas: paddedPreVerificationGas
|
|
1238
1242
|
};
|
package/package.json
CHANGED