@zerodev/sdk 4.6.9 → 4.6.11
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/cjs/kernel-zerodev/constants.js +1 -0
- package/dist/cjs/kernel-zerodev/constants.js.map +1 -1
- package/dist/cjs/kernel-zerodev/middleware/gas-estimator.js +2 -3
- package/dist/cjs/kernel-zerodev/middleware/gas-estimator.js.map +1 -1
- package/dist/esm/kernel-zerodev/constants.js +1 -0
- package/dist/esm/kernel-zerodev/constants.js.map +1 -1
- package/dist/esm/kernel-zerodev/middleware/gas-estimator.js +2 -3
- package/dist/esm/kernel-zerodev/middleware/gas-estimator.js.map +1 -1
- package/dist/types/kernel-zerodev/constants.d.ts.map +1 -1
- package/dist/types/kernel-zerodev/middleware/gas-estimator.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/kernel-zerodev/constants.ts +1 -0
- package/src/kernel-zerodev/middleware/gas-estimator.ts +2 -3
- package/src/kernel-zerodev/validator/recovery-validator.ts +3 -5
- package/src/kernel-zerodev/validator-provider/recovery-provider.ts +1 -1
|
@@ -53,6 +53,7 @@ exports.CHAIN_ID_TO_NODE = {
|
|
|
53
53
|
11155111: "https://fittest-ultra-aura.ethereum-sepolia.quiknode.pro/3893d01b1dd411fdfa9b6dd372dd2b4f69fcf1ea/",
|
|
54
54
|
137: `https://polygon-mainnet.infura.io/v3/${exports.INFURA_API_KEY}`,
|
|
55
55
|
80001: `https://polygon-mumbai.infura.io/v3/${exports.INFURA_API_KEY}`,
|
|
56
|
+
80002: `https://polygon-amoy.infura.io/v3/${exports.INFURA_API_KEY}`,
|
|
56
57
|
10: `https://optimism-mainnet.infura.io/v3/${exports.INFURA_API_KEY}`,
|
|
57
58
|
420: `https://optimism-goerli.infura.io/v3/${exports.INFURA_API_KEY}`,
|
|
58
59
|
42161: `https://arbitrum-mainnet.infura.io/v3/${exports.INFURA_API_KEY}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{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0CAA0C,sBAAc,EAAE;IACjE,KAAK,EAAE,uCAAuC,sBAAc,EAAE;IAC9D,UAAU,EAAE,uCAAuC,sBAAc,EAAE;IACnE,UAAU,EAAE,uCAAuC,sBAAc,EAAE;IACnE,EAAE,EAAE,wFAAwF;IAC5F,IAAI,EAAE,+FAA+F;IACrG,KAAK,EACH,8FAA8F;IAChG,GAAG,EAAE,2FAA2F;IAChG,KAAK,EAAE,oEAAoE;IAC3E,KAAK,EAAE,sCAAsC,sBAAc,EAAE;IAC7D,KAAK,EAAE,qCAAqC,sBAAc,EAAE;IAC5D,GAAG,EAAE,iEAAiE;IACtE,KAAK,EAAE,uCAAuC;IAC9C,OAAO,EAAE,oCAAoC;IAC7C,KAAK,EACH,gGAAgG;IAClG,MAAM,EAAE,yCAAyC,sBAAc,EAAE;IACjE,QAAQ,EAAE,yCAAyC,sBAAc,EAAE;CAEpE,CAAC","sourcesContent":["import { parseUnits, type Hex } from \"viem\";\nimport type { IGasTokenAddresses } from \"./paymaster/types.js\";\nimport { polygon } from \"viem/chains\";\n\nexport const DEFAULT_SEND_TX_MAX_RETRIES = 3;\nexport const DEFAULT_SEND_TX_RETRY_INTERVAL_MS = 60000; // 1 minutes\nexport const BUNDLER_URL =\n \"https://meta-aa-provider.onrender.com/api/v1/bundler\";\nexport const PAYMASTER_URL =\n \"https://meta-aa-provider.onrender.com/api/v1/paymaster\";\nexport const ENTRYPOINT_ADDRESS: Hex =\n \"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789\";\nexport const MULTISEND_ADDR: Hex = \"0x8ae01fcf7c655655ff2c6ef907b8b4718ab4e17c\";\nexport const BACKEND_URL = \"https://backend-vikp.onrender.com\";\nexport const API_URL = \"https://prod-api.zerodev.app\";\nexport const ECDSA_VALIDATOR_ADDRESS =\n \"0xd9AB5096a832b9ce79914329DAEE236f8Eea0390\";\nexport const KERNEL_FACTORY_ADDRESS =\n \"0x5de4839a76cf55d0c90e2061ef4386d962E15ae3\";\nexport const KERNEL_IMPL_ADDRESS = \"0x0DA6a956B9488eD4dd761E59f52FDc6c8068E6B5\";\nexport const KILL_SWITCH_VALIDATOR_ADDRESS =\n \"0x7393A7dA58CCfFb78f52adb09705BE6E20F704BC\";\nexport const KILL_SWITCH_ACTION = \"0x3f38e479304c7F18F988269a1bDa7d646bd48243\";\nexport const DUMMY_ECDSA_SIG =\n \"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c\";\nexport const ERC165_SESSION_KEY_VALIDATOR_ADDRESS =\n \"0xe149290800De29D4b0BF9dB82c508255D81902E6\";\nexport const TOKEN_ACTION = \"0x2087C7FfD0d0DAE80a00EE74325aBF3449e0eaf1\";\nexport const SESSION_KEY_VALIDATOR_ADDRESS =\n \"0x5C06CE2b673fD5E6e56076e40DD46aB67f5a72A5\";\nexport const RECOVERY_VALIDATOR_ADDRESS =\n \"0xaFA369cA3432e62ACe6bd77B2886F2D588c68dA8\";\nexport const RECOVERY_ACTION = \"0x2f65dB8039fe5CAEE0a8680D2879deB800F31Ae1\";\nexport const oneAddress = \"0x0000000000000000000000000000000000000001\";\n\nexport const gasTokenChainAddresses: IGasTokenAddresses = {\n USDC: {\n 1: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n // 5: \"0x2f3A40A3db8a7e3D09B0adfEfbCe4f6F81927557\",\n 137: \"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174\",\n // 80001: \"\",\n // 420: \"0x7F5c764cBc14f9669B88837ca1490cCa17c31607\",\n 42161: \"0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8\",\n // 421613: \"\",\n 43114: \"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E\",\n // 43113: \"\",\n // 56: \"\",\n // 97: \"\"\n },\n PEPE: {\n 1: \"0x6982508145454Ce325dDbE47a25d4ec3d2311933\",\n },\n};\n\nexport const ERC20_APPROVAL_AMOUNT: { [key: string]: bigint } = {\n // ETH\n [gasTokenChainAddresses[\"USDC\"][1]]: parseUnits(\"100\", 6),\n\n // Goerli\n [gasTokenChainAddresses[\"USDC\"][5]]: parseUnits(\"100\", 6),\n\n // Polygon\n [gasTokenChainAddresses[\"USDC\"][137]]: parseUnits(\"10\", 6),\n\n // Arbitrum\n [gasTokenChainAddresses[\"USDC\"][42161]]: parseUnits(\"10\", 6),\n\n // Avalanche\n [gasTokenChainAddresses[\"USDC\"][43114]]: parseUnits(\"10\", 6),\n\n // ETH\n [gasTokenChainAddresses[\"PEPE\"][1]]: parseUnits(\"50000000\", 18),\n\n \"0x3870419Ba2BBf0127060bCB37f69A1b1C090992B\": parseUnits(\"100\", 18),\n};\n\nexport const minPriorityFeePerBidDefaults = new Map<number, bigint>([\n [polygon.id, 30_000_000_000n],\n]);\n\nexport const INFURA_API_KEY = \"f36f7f706a58477884ce6fe89165666c\";\nexport const CHAIN_ID_TO_NODE: { [key: number]: string } = {\n 1: `https://mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 5: `https://goerli.infura.io/v3/${INFURA_API_KEY}`,\n 11155111:\n \"https://fittest-ultra-aura.ethereum-sepolia.quiknode.pro/3893d01b1dd411fdfa9b6dd372dd2b4f69fcf1ea/\",\n 137: `https://polygon-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 80001: `https://polygon-mumbai.infura.io/v3/${INFURA_API_KEY}`,\n 10: `https://optimism-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 420: `https://optimism-goerli.infura.io/v3/${INFURA_API_KEY}`,\n 42161: `https://arbitrum-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n // 42161: 'https://evocative-stylish-dinghy.arbitrum-mainnet.discover.quiknode.pro/80b526d14fa9fd9a8b0db1e65554acaf00c6a1ab/',\n 421613: `https://arbitrum-goerli.infura.io/v3/${INFURA_API_KEY}`,\n 43114: `https://avalanche-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 43113: `https://avalanche-fuji.infura.io/v3/${INFURA_API_KEY}`,\n 1313161554: `https://aurora-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 1313161555: `https://aurora-testnet.infura.io/v3/${INFURA_API_KEY}`,\n 56: \"https://neat-greatest-layer.bsc.quiknode.pro/9405a499ceee314e5f2f68c9d47518d3537fce6a/\",\n 8453: \"https://twilight-red-tree.base-mainnet.quiknode.pro/dc6eb27bf0f917df215922488dd97f4de7d9b08e/\",\n 84531:\n \"https://icy-long-mountain.base-goerli.quiknode.pro/5b80d93e97cc9412a63c10a30841869abbef9596/\",\n 100: \"https://thrilling-fluent-film.xdai.quiknode.pro/305955cffb9868cdd95b5e3dc9775f20678ad9ac/\",\n 10200: \"https://nd-810-853-201.p2pify.com/e828b09f0d43591de96c297b3f36fffd\",\n 59144: `https://linea-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 59140: `https://linea-goerli.infura.io/v3/${INFURA_API_KEY}`,\n 204: \"https://opbnb.rpc.thirdweb.com/eed98c1f30120c0508f17c1f01d3102b\",\n 42069: \"https://rpc.op-testnet.gelato.digital\",\n 1261120: \"https://rpc.zkatana.gelato.digital\",\n 84532:\n \"https://floral-old-feather.base-sepolia.quiknode.pro/4c3b4295d0c174410872b1e461a91cc33c7969a9/\",\n 421614: `https://arbitrum-sepolia.infura.io/v3/${INFURA_API_KEY}`,\n 11155420: `https://optimism-sepolia.infura.io/v3/${INFURA_API_KEY}`,\n // 5611: 'opBnb-testnet',\n};\n"]}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/kernel-zerodev/constants.ts"],"names":[],"mappings":";;;AAAA,+BAA4C;AAE5C,wCAAsC;AAEzB,QAAA,2BAA2B,GAAG,CAAC,CAAC;AAChC,QAAA,iCAAiC,GAAG,KAAK,CAAC;AAC1C,QAAA,WAAW,GACtB,sDAAsD,CAAC;AAC5C,QAAA,aAAa,GACxB,wDAAwD,CAAC;AAC9C,QAAA,kBAAkB,GAC7B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IAChG,KAAK,EAAE,oEAAoE;IAC3E,KAAK,EAAE,sCAAsC,sBAAc,EAAE;IAC7D,KAAK,EAAE,qCAAqC,sBAAc,EAAE;IAC5D,GAAG,EAAE,iEAAiE;IACtE,KAAK,EAAE,uCAAuC;IAC9C,OAAO,EAAE,oCAAoC;IAC7C,KAAK,EACH,gGAAgG;IAClG,MAAM,EAAE,yCAAyC,sBAAc,EAAE;IACjE,QAAQ,EAAE,yCAAyC,sBAAc,EAAE;CAEpE,CAAC","sourcesContent":["import { parseUnits, type Hex } from \"viem\";\nimport type { IGasTokenAddresses } from \"./paymaster/types.js\";\nimport { polygon } from \"viem/chains\";\n\nexport const DEFAULT_SEND_TX_MAX_RETRIES = 3;\nexport const DEFAULT_SEND_TX_RETRY_INTERVAL_MS = 60000; // 1 minutes\nexport const BUNDLER_URL =\n \"https://meta-aa-provider.onrender.com/api/v1/bundler\";\nexport const PAYMASTER_URL =\n \"https://meta-aa-provider.onrender.com/api/v1/paymaster\";\nexport const ENTRYPOINT_ADDRESS: Hex =\n \"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789\";\nexport const MULTISEND_ADDR: Hex = \"0x8ae01fcf7c655655ff2c6ef907b8b4718ab4e17c\";\nexport const BACKEND_URL = \"https://backend-vikp.onrender.com\";\nexport const API_URL = \"https://prod-api.zerodev.app\";\nexport const ECDSA_VALIDATOR_ADDRESS =\n \"0xd9AB5096a832b9ce79914329DAEE236f8Eea0390\";\nexport const KERNEL_FACTORY_ADDRESS =\n \"0x5de4839a76cf55d0c90e2061ef4386d962E15ae3\";\nexport const KERNEL_IMPL_ADDRESS = \"0x0DA6a956B9488eD4dd761E59f52FDc6c8068E6B5\";\nexport const KILL_SWITCH_VALIDATOR_ADDRESS =\n \"0x7393A7dA58CCfFb78f52adb09705BE6E20F704BC\";\nexport const KILL_SWITCH_ACTION = \"0x3f38e479304c7F18F988269a1bDa7d646bd48243\";\nexport const DUMMY_ECDSA_SIG =\n \"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c\";\nexport const ERC165_SESSION_KEY_VALIDATOR_ADDRESS =\n \"0xe149290800De29D4b0BF9dB82c508255D81902E6\";\nexport const TOKEN_ACTION = \"0x2087C7FfD0d0DAE80a00EE74325aBF3449e0eaf1\";\nexport const SESSION_KEY_VALIDATOR_ADDRESS =\n \"0x5C06CE2b673fD5E6e56076e40DD46aB67f5a72A5\";\nexport const RECOVERY_VALIDATOR_ADDRESS =\n \"0xaFA369cA3432e62ACe6bd77B2886F2D588c68dA8\";\nexport const RECOVERY_ACTION = \"0x2f65dB8039fe5CAEE0a8680D2879deB800F31Ae1\";\nexport const oneAddress = \"0x0000000000000000000000000000000000000001\";\n\nexport const gasTokenChainAddresses: IGasTokenAddresses = {\n USDC: {\n 1: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n // 5: \"0x2f3A40A3db8a7e3D09B0adfEfbCe4f6F81927557\",\n 137: \"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174\",\n // 80001: \"\",\n // 420: \"0x7F5c764cBc14f9669B88837ca1490cCa17c31607\",\n 42161: \"0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8\",\n // 421613: \"\",\n 43114: \"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E\",\n // 43113: \"\",\n // 56: \"\",\n // 97: \"\"\n },\n PEPE: {\n 1: \"0x6982508145454Ce325dDbE47a25d4ec3d2311933\",\n },\n};\n\nexport const ERC20_APPROVAL_AMOUNT: { [key: string]: bigint } = {\n // ETH\n [gasTokenChainAddresses[\"USDC\"][1]]: parseUnits(\"100\", 6),\n\n // Goerli\n [gasTokenChainAddresses[\"USDC\"][5]]: parseUnits(\"100\", 6),\n\n // Polygon\n [gasTokenChainAddresses[\"USDC\"][137]]: parseUnits(\"10\", 6),\n\n // Arbitrum\n [gasTokenChainAddresses[\"USDC\"][42161]]: parseUnits(\"10\", 6),\n\n // Avalanche\n [gasTokenChainAddresses[\"USDC\"][43114]]: parseUnits(\"10\", 6),\n\n // ETH\n [gasTokenChainAddresses[\"PEPE\"][1]]: parseUnits(\"50000000\", 18),\n\n \"0x3870419Ba2BBf0127060bCB37f69A1b1C090992B\": parseUnits(\"100\", 18),\n};\n\nexport const minPriorityFeePerBidDefaults = new Map<number, bigint>([\n [polygon.id, 30_000_000_000n],\n]);\n\nexport const INFURA_API_KEY = \"f36f7f706a58477884ce6fe89165666c\";\nexport const CHAIN_ID_TO_NODE: { [key: number]: string } = {\n 1: `https://mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 5: `https://goerli.infura.io/v3/${INFURA_API_KEY}`,\n 11155111:\n \"https://fittest-ultra-aura.ethereum-sepolia.quiknode.pro/3893d01b1dd411fdfa9b6dd372dd2b4f69fcf1ea/\",\n 137: `https://polygon-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 80001: `https://polygon-mumbai.infura.io/v3/${INFURA_API_KEY}`,\n 80002: `https://polygon-amoy.infura.io/v3/${INFURA_API_KEY}`,\n 10: `https://optimism-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 420: `https://optimism-goerli.infura.io/v3/${INFURA_API_KEY}`,\n 42161: `https://arbitrum-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n // 42161: 'https://evocative-stylish-dinghy.arbitrum-mainnet.discover.quiknode.pro/80b526d14fa9fd9a8b0db1e65554acaf00c6a1ab/',\n 421613: `https://arbitrum-goerli.infura.io/v3/${INFURA_API_KEY}`,\n 43114: `https://avalanche-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 43113: `https://avalanche-fuji.infura.io/v3/${INFURA_API_KEY}`,\n 1313161554: `https://aurora-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 1313161555: `https://aurora-testnet.infura.io/v3/${INFURA_API_KEY}`,\n 56: \"https://neat-greatest-layer.bsc.quiknode.pro/9405a499ceee314e5f2f68c9d47518d3537fce6a/\",\n 8453: \"https://twilight-red-tree.base-mainnet.quiknode.pro/dc6eb27bf0f917df215922488dd97f4de7d9b08e/\",\n 84531:\n \"https://icy-long-mountain.base-goerli.quiknode.pro/5b80d93e97cc9412a63c10a30841869abbef9596/\",\n 100: \"https://thrilling-fluent-film.xdai.quiknode.pro/305955cffb9868cdd95b5e3dc9775f20678ad9ac/\",\n 10200: \"https://nd-810-853-201.p2pify.com/e828b09f0d43591de96c297b3f36fffd\",\n 59144: `https://linea-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 59140: `https://linea-goerli.infura.io/v3/${INFURA_API_KEY}`,\n 204: \"https://opbnb.rpc.thirdweb.com/eed98c1f30120c0508f17c1f01d3102b\",\n 42069: \"https://rpc.op-testnet.gelato.digital\",\n 1261120: \"https://rpc.zkatana.gelato.digital\",\n 84532:\n \"https://floral-old-feather.base-sepolia.quiknode.pro/4c3b4295d0c174410872b1e461a91cc33c7969a9/\",\n 421614: `https://arbitrum-sepolia.infura.io/v3/${INFURA_API_KEY}`,\n 11155420: `https://optimism-sepolia.infura.io/v3/${INFURA_API_KEY}`,\n // 5611: 'opBnb-testnet',\n};\n"]}
|
|
@@ -57,11 +57,10 @@ const withZeroDevGasEstimator = (provider) => {
|
|
|
57
57
|
userOpGasEstimates = await provider.rpcClient.estimateUserOperationGas(request, constants_js_1.ENTRYPOINT_ADDRESS);
|
|
58
58
|
const { preVerificationGas, verificationGasLimit, callGasLimit } = userOpGasEstimates;
|
|
59
59
|
request.preVerificationGas =
|
|
60
|
-
|
|
60
|
+
BigInt(preVerificationGas) ?? request.preVerificationGas;
|
|
61
61
|
request.verificationGasLimit =
|
|
62
62
|
BigInt(verificationGasLimit) ?? request.verificationGasLimit;
|
|
63
|
-
request.callGasLimit =
|
|
64
|
-
(BigInt(callGasLimit) * 12n) / 10n ?? request.callGasLimit;
|
|
63
|
+
request.callGasLimit = BigInt(callGasLimit) ?? request.callGasLimit;
|
|
65
64
|
return {
|
|
66
65
|
...struct,
|
|
67
66
|
...request,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gas-estimator.js","sourceRoot":"","sources":["../../../../src/kernel-zerodev/middleware/gas-estimator.ts"],"names":[],"mappings":";;;AACA,8CAO0B;AAC1B,kDAAqD;AACrD,wFAA+E;AAGxE,MAAM,uBAAuB,GAAG,CACrC,QAAyB,EACR,EAAE;IACnB,QAAQ,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAC1C,IAAI,SAAS,GAAG,MAAM,IAAA,2BAAiB,EAAC;YACtC,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,oBAAoB,EAAE,MAAM,CAAC,oBAAoB;SAClD,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,eAAe,KAAK,QAAQ,EAAE;YACzC,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,oBAAoB,EAAE,EAAE,EAAE,CAAC;SACvD;QAED,IAAI,YAAY,EAAE,oBAAoB,CAAC;QAEvC,IAAI;YACF,CAAC,EAAE,YAAY,EAAE,oBAAoB,EAAE,GAAG,MAAM,IAAA,uBAAe,EAC7D,QAAQ,CACT,CAAC,CAAC;SACJ;QAAC,OAAO,KAAU,EAAE;YACnB,OAAO,CAAC,IAAI,CACV,4EAA4E,CAC7E,CAAC;SACH;QAED,IAAI,YAAY,KAAK,SAAS,IAAI,oBAAoB,KAAK,SAAS,EAAE;YACpE,MAAM,OAAO,GAAG,MAAM,IAAA,kBAAU,EAAC,QAAQ,CAAC,CAAC;YAC3C,YAAY,GAAG,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1E,oBAAoB,GAAG,OAAO,CAAC,oBAAoB;gBACjD,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC;gBACtC,CAAC,CAAC,EAAE,CAAC;SACR;QAED,IAAI,SAAS,CAAC,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AC,QAAQ,CAAC,oBAAoB;gBAC/B,CAAC,CAAC,oBAAoB,CAAC;QAC3B,YAAY;YACV,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,oBAAoB,IAAI,CAAC,CAAC,CAAC;KACjE;IAED,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,CAAC;AAChD,CAAC,CAAC;AAlCW,QAAA,UAAU,cAkCrB","sourcesContent":["import type { ZeroDevProvider } from \"../provider.js\";\nimport {\n deepHexlify,\n type Hex,\n type UserOperationStruct,\n resolveProperties,\n type BigNumberish,\n type UserOperationEstimateGasResponse,\n} from \"@alchemy/aa-core\";\nimport { ENTRYPOINT_ADDRESS } from \"../constants.js\";\nimport { calcPreVerificationGas } from \"../utils/calc-pre-verification-gas.js\";\nimport { type PaymasterAndBundlerProviders } from \"../paymaster/types.js\";\n\nexport const withZeroDevGasEstimator = (\n provider: ZeroDevProvider\n): ZeroDevProvider => {\n provider.withFeeDataGetter(async (struct) => {\n let overrides = await resolveProperties({\n maxFeePerGas: struct.maxFeePerGas,\n maxPriorityFeePerGas: struct.maxPriorityFeePerGas,\n });\n\n if (provider.bundlerProvider === \"GELATO\") {\n return { maxFeePerGas: 0n, maxPriorityFeePerGas: 0n };\n }\n\n let maxFeePerGas, maxPriorityFeePerGas;\n\n try {\n ({ maxFeePerGas, maxPriorityFeePerGas } = await eip1559GasPrice(\n provider\n ));\n } catch (error: any) {\n console.warn(\n \"getGas: eth_maxPriorityFeePerGas failed, falling back to legacy gas price.\"\n );\n }\n\n if (maxFeePerGas === undefined || maxPriorityFeePerGas === undefined) {\n const feeData = await getFeeData(provider);\n maxFeePerGas = feeData?.maxFeePerGas ? BigInt(feeData?.maxFeePerGas) : 0n;\n maxPriorityFeePerGas = feeData.maxPriorityFeePerGas\n ? BigInt(feeData.maxPriorityFeePerGas)\n : 0n;\n }\n\n if (overrides.maxFeePerGas || overrides.maxPriorityFeePerGas) {\n return {\n maxFeePerGas: overrides.maxFeePerGas ?? maxFeePerGas,\n maxPriorityFeePerGas:\n overrides.maxPriorityFeePerGas ?? maxPriorityFeePerGas,\n };\n }\n return { maxFeePerGas, maxPriorityFeePerGas };\n });\n\n provider.withGasEstimator(async (struct) => {\n if (\n struct.callGasLimit !== undefined &&\n struct.verificationGasLimit !== undefined &&\n struct.preVerificationGas !== undefined\n ) {\n return struct;\n }\n const initCode = await provider.account?.getInitCode();\n const initGas = await estimateCreationGas(provider, initCode);\n const partialStruct: UserOperationStruct = {\n ...struct,\n callGasLimit:\n initCode !== undefined && initCode.length > 2\n ? BigInt(\"1000000\")\n : BigInt(55000),\n verificationGasLimit: BigInt(110000) + initGas,\n preVerificationGas: BigInt(100000),\n };\n\n partialStruct.preVerificationGas = await getPreVerificationGas(\n partialStruct\n );\n\n const request = deepHexlify(await resolveProperties(partialStruct));\n let userOpGasEstimates: UserOperationEstimateGasResponse | undefined;\n userOpGasEstimates = await provider.rpcClient.estimateUserOperationGas(\n request,\n ENTRYPOINT_ADDRESS\n );\n const { preVerificationGas, verificationGasLimit, callGasLimit } =\n userOpGasEstimates;\n request.preVerificationGas =\n (BigInt(preVerificationGas) * 12n) / 10n ?? request.preVerificationGas;\n request.verificationGasLimit =\n BigInt(verificationGasLimit) ?? request.verificationGasLimit;\n request.callGasLimit =\n (BigInt(callGasLimit) * 12n) / 10n ?? request.callGasLimit;\n\n return {\n ...struct,\n ...request,\n };\n });\n\n return provider;\n};\n\nexport const estimateCreationGas = async (\n provider: ZeroDevProvider,\n initCode?: string\n): Promise<bigint> => {\n if (initCode == null || initCode === \"0x\") return BigInt(0);\n const deployerAddress = initCode.substring(0, 42) as Hex;\n const deployerCallData = (\"0x\" + initCode.substring(42)) as Hex;\n return await provider.rpcClient.estimateGas({\n account: ENTRYPOINT_ADDRESS,\n to: deployerAddress,\n data: deployerCallData,\n });\n};\n\n/**\n * should cover cost of putting calldata on-chain, and some overhead.\n * actual overhead depends on the expected bundle size\n */\nexport const getPreVerificationGas = async (\n userOp: Partial<UserOperationStruct>\n): Promise<number> => {\n const p = await resolveProperties(userOp);\n return calcPreVerificationGas(p);\n};\n\nexport const GAS_PRICE_RPC_METHODS_BY_BUNDLER: {\n [K in PaymasterAndBundlerProviders]: string;\n} = {\n STACKUP: \"eth_maxPriorityFeePerGas\",\n ALCHEMY: \"rundler_maxPriorityFeePerGas\",\n PIMLICO: \"pimlico_getUserOperationGasPrice\",\n GELATO: \"eth_maxPriorityFeePerGas\",\n};\n\nexport const eip1559GasPrice = async (provider: ZeroDevProvider) => {\n let [fee, block] = await Promise.all([\n provider.rpcClient.request({\n method:\n // @ts-expect-error\n GAS_PRICE_RPC_METHODS_BY_BUNDLER[provider.bundlerProvider] ??\n \"eth_maxPriorityFeePerGas\",\n params: [],\n }) as any,\n provider.rpcClient.getBlock({ blockTag: \"latest\" }),\n ]);\n\n if (provider.bundlerProvider === \"PIMLICO\") {\n fee = fee.standard.maxPriorityFeePerGas;\n }\n\n const tip = BigInt(fee);\n const buffer =\n (tip / 100n) *\n BigInt(provider.feeOptions.maxPriorityFeePerGasBufferPercentage);\n let maxPriorityFeePerGas = tip + buffer;\n maxPriorityFeePerGas =\n maxPriorityFeePerGas < provider.minPriorityFeePerBid\n ? provider.minPriorityFeePerBid\n : maxPriorityFeePerGas;\n const maxFeePerGas =\n ((block.baseFeePerGas\n ? BigInt(block.baseFeePerGas) * 2n + maxPriorityFeePerGas\n : maxPriorityFeePerGas) *\n (BigInt(100) +\n BigInt(provider.feeOptions.maxFeePerGasBufferPercentage))) /\n 100n;\n\n return { maxFeePerGas, maxPriorityFeePerGas };\n};\ninterface FeeData {\n maxFeePerGas: BigNumberish | null;\n maxPriorityFeePerGas: BigNumberish | null;\n}\n\nexport const getFeeData = async (\n provider: ZeroDevProvider\n): Promise<FeeData> => {\n const { block, gasPrice } = await resolveProperties({\n block: provider.rpcClient.getBlock({ blockTag: \"latest\" }),\n gasPrice: provider.rpcClient.getGasPrice().catch((error) => {\n console.warn(\"Legacy: Failed to get gas price\", error);\n return null;\n }),\n });\n\n let maxFeePerGas = null;\n let maxPriorityFeePerGas = null;\n\n if (block && block.baseFeePerGas != null) {\n // Set the tip to the min of the tip for the last block and 1.5 gwei\n const minimumTip = BigInt(\"1500000000\");\n maxPriorityFeePerGas = gasPrice ? gasPrice - block.baseFeePerGas : null;\n if (\n maxPriorityFeePerGas == null ||\n maxPriorityFeePerGas - BigInt(0) ||\n maxPriorityFeePerGas > minimumTip\n ) {\n maxPriorityFeePerGas = minimumTip;\n }\n maxPriorityFeePerGas =\n maxPriorityFeePerGas < provider.minPriorityFeePerBid\n ? provider.minPriorityFeePerBid\n : maxPriorityFeePerGas;\n maxFeePerGas =\n block.baseFeePerGas * BigInt(2) + (maxPriorityFeePerGas ?? 0);\n }\n\n return { maxFeePerGas, maxPriorityFeePerGas };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"gas-estimator.js","sourceRoot":"","sources":["../../../../src/kernel-zerodev/middleware/gas-estimator.ts"],"names":[],"mappings":";;;AACA,8CAO0B;AAC1B,kDAAqD;AACrD,wFAA+E;AAGxE,MAAM,uBAAuB,GAAG,CACrC,QAAyB,EACR,EAAE;IACnB,QAAQ,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAC1C,IAAI,SAAS,GAAG,MAAM,IAAA,2BAAiB,EAAC;YACtC,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,oBAAoB,EAAE,MAAM,CAAC,oBAAoB;SAClD,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,eAAe,KAAK,QAAQ,EAAE;YACzC,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,oBAAoB,EAAE,EAAE,EAAE,CAAC;SACvD;QAED,IAAI,YAAY,EAAE,oBAAoB,CAAC;QAEvC,IAAI;YACF,CAAC,EAAE,YAAY,EAAE,oBAAoB,EAAE,GAAG,MAAM,IAAA,uBAAe,EAC7D,QAAQ,CACT,CAAC,CAAC;SACJ;QAAC,OAAO,KAA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aAAa,IAAI,IAAI,EAAE;QAExC,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;QACxC,oBAAoB,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC;QACxE,IACE,oBAAoB,IAAI,IAAI;YAC5B,oBAAoB,GAAG,MAAM,CAAC,CAAC,CAAC;YAChC,oBAAoB,GAAG,UAAU,EACjC;YACA,oBAAoB,GAAG,UAAU,CAAC;SACnC;QACD,oBAAoB;YAClB,oBAAoB,GAAG,QAAQ,CAAC,oBAAoB;gBAClD,CAAC,CAAC,QAAQ,CAAC,oBAAoB;gBAC/B,CAAC,CAAC,oBAAoB,CAAC;QAC3B,YAAY;YACV,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,oBAAoB,IAAI,CAAC,CAAC,CAAC;KACjE;IAED,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,CAAC;AAChD,CAAC,CAAC;AAlCW,QAAA,UAAU,cAkCrB","sourcesContent":["import type { ZeroDevProvider } from \"../provider.js\";\nimport {\n deepHexlify,\n type Hex,\n type UserOperationStruct,\n resolveProperties,\n type BigNumberish,\n type UserOperationEstimateGasResponse,\n} from \"@alchemy/aa-core\";\nimport { ENTRYPOINT_ADDRESS } from \"../constants.js\";\nimport { calcPreVerificationGas } from \"../utils/calc-pre-verification-gas.js\";\nimport { type PaymasterAndBundlerProviders } from \"../paymaster/types.js\";\n\nexport const withZeroDevGasEstimator = (\n provider: ZeroDevProvider\n): ZeroDevProvider => {\n provider.withFeeDataGetter(async (struct) => {\n let overrides = await resolveProperties({\n maxFeePerGas: struct.maxFeePerGas,\n maxPriorityFeePerGas: struct.maxPriorityFeePerGas,\n });\n\n if (provider.bundlerProvider === \"GELATO\") {\n return { maxFeePerGas: 0n, maxPriorityFeePerGas: 0n };\n }\n\n let maxFeePerGas, maxPriorityFeePerGas;\n\n try {\n ({ maxFeePerGas, maxPriorityFeePerGas } = await eip1559GasPrice(\n provider\n ));\n } catch (error: any) {\n console.warn(\n \"getGas: eth_maxPriorityFeePerGas failed, falling back to legacy gas price.\"\n );\n }\n\n if (maxFeePerGas === undefined || maxPriorityFeePerGas === undefined) {\n const feeData = await getFeeData(provider);\n maxFeePerGas = feeData?.maxFeePerGas ? BigInt(feeData?.maxFeePerGas) : 0n;\n maxPriorityFeePerGas = feeData.maxPriorityFeePerGas\n ? BigInt(feeData.maxPriorityFeePerGas)\n : 0n;\n }\n\n if (overrides.maxFeePerGas || overrides.maxPriorityFeePerGas) {\n return {\n maxFeePerGas: overrides.maxFeePerGas ?? maxFeePerGas,\n maxPriorityFeePerGas:\n overrides.maxPriorityFeePerGas ?? maxPriorityFeePerGas,\n };\n }\n return { maxFeePerGas, maxPriorityFeePerGas };\n });\n\n provider.withGasEstimator(async (struct) => {\n if (\n struct.callGasLimit !== undefined &&\n struct.verificationGasLimit !== undefined &&\n struct.preVerificationGas !== undefined\n ) {\n return struct;\n }\n const initCode = await provider.account?.getInitCode();\n const initGas = await estimateCreationGas(provider, initCode);\n const partialStruct: UserOperationStruct = {\n ...struct,\n callGasLimit:\n initCode !== undefined && initCode.length > 2\n ? BigInt(\"1000000\")\n : BigInt(55000),\n verificationGasLimit: BigInt(110000) + initGas,\n preVerificationGas: BigInt(100000),\n };\n\n partialStruct.preVerificationGas = await getPreVerificationGas(\n partialStruct\n );\n\n const request = deepHexlify(await resolveProperties(partialStruct));\n let userOpGasEstimates: UserOperationEstimateGasResponse | undefined;\n userOpGasEstimates = await provider.rpcClient.estimateUserOperationGas(\n request,\n ENTRYPOINT_ADDRESS\n );\n const { preVerificationGas, verificationGasLimit, callGasLimit } =\n userOpGasEstimates;\n request.preVerificationGas =\n BigInt(preVerificationGas) ?? request.preVerificationGas;\n request.verificationGasLimit =\n BigInt(verificationGasLimit) ?? request.verificationGasLimit;\n request.callGasLimit = BigInt(callGasLimit) ?? request.callGasLimit;\n\n return {\n ...struct,\n ...request,\n };\n });\n\n return provider;\n};\n\nexport const estimateCreationGas = async (\n provider: ZeroDevProvider,\n initCode?: string\n): Promise<bigint> => {\n if (initCode == null || initCode === \"0x\") return BigInt(0);\n const deployerAddress = initCode.substring(0, 42) as Hex;\n const deployerCallData = (\"0x\" + initCode.substring(42)) as Hex;\n return await provider.rpcClient.estimateGas({\n account: ENTRYPOINT_ADDRESS,\n to: deployerAddress,\n data: deployerCallData,\n });\n};\n\n/**\n * should cover cost of putting calldata on-chain, and some overhead.\n * actual overhead depends on the expected bundle size\n */\nexport const getPreVerificationGas = async (\n userOp: Partial<UserOperationStruct>\n): Promise<number> => {\n const p = await resolveProperties(userOp);\n return calcPreVerificationGas(p);\n};\n\nexport const GAS_PRICE_RPC_METHODS_BY_BUNDLER: {\n [K in PaymasterAndBundlerProviders]: string;\n} = {\n STACKUP: \"eth_maxPriorityFeePerGas\",\n ALCHEMY: \"rundler_maxPriorityFeePerGas\",\n PIMLICO: \"pimlico_getUserOperationGasPrice\",\n GELATO: \"eth_maxPriorityFeePerGas\",\n};\n\nexport const eip1559GasPrice = async (provider: ZeroDevProvider) => {\n let [fee, block] = await Promise.all([\n provider.rpcClient.request({\n method:\n // @ts-expect-error\n GAS_PRICE_RPC_METHODS_BY_BUNDLER[provider.bundlerProvider] ??\n \"eth_maxPriorityFeePerGas\",\n params: [],\n }) as any,\n provider.rpcClient.getBlock({ blockTag: \"latest\" }),\n ]);\n\n if (provider.bundlerProvider === \"PIMLICO\") {\n fee = fee.standard.maxPriorityFeePerGas;\n }\n\n const tip = BigInt(fee);\n const buffer =\n (tip / 100n) *\n BigInt(provider.feeOptions.maxPriorityFeePerGasBufferPercentage);\n let maxPriorityFeePerGas = tip + buffer;\n maxPriorityFeePerGas =\n maxPriorityFeePerGas < provider.minPriorityFeePerBid\n ? provider.minPriorityFeePerBid\n : maxPriorityFeePerGas;\n const maxFeePerGas =\n ((block.baseFeePerGas\n ? BigInt(block.baseFeePerGas) * 2n + maxPriorityFeePerGas\n : maxPriorityFeePerGas) *\n (BigInt(100) +\n BigInt(provider.feeOptions.maxFeePerGasBufferPercentage))) /\n 100n;\n\n return { maxFeePerGas, maxPriorityFeePerGas };\n};\ninterface FeeData {\n maxFeePerGas: BigNumberish | null;\n maxPriorityFeePerGas: BigNumberish | null;\n}\n\nexport const getFeeData = async (\n provider: ZeroDevProvider\n): Promise<FeeData> => {\n const { block, gasPrice } = await resolveProperties({\n block: provider.rpcClient.getBlock({ blockTag: \"latest\" }),\n gasPrice: provider.rpcClient.getGasPrice().catch((error) => {\n console.warn(\"Legacy: Failed to get gas price\", error);\n return null;\n }),\n });\n\n let maxFeePerGas = null;\n let maxPriorityFeePerGas = null;\n\n if (block && block.baseFeePerGas != null) {\n // Set the tip to the min of the tip for the last block and 1.5 gwei\n const minimumTip = BigInt(\"1500000000\");\n maxPriorityFeePerGas = gasPrice ? gasPrice - block.baseFeePerGas : null;\n if (\n maxPriorityFeePerGas == null ||\n maxPriorityFeePerGas - BigInt(0) ||\n maxPriorityFeePerGas > minimumTip\n ) {\n maxPriorityFeePerGas = minimumTip;\n }\n maxPriorityFeePerGas =\n maxPriorityFeePerGas < provider.minPriorityFeePerBid\n ? provider.minPriorityFeePerBid\n : maxPriorityFeePerGas;\n maxFeePerGas =\n block.baseFeePerGas * BigInt(2) + (maxPriorityFeePerGas ?? 0);\n }\n\n return { maxFeePerGas, maxPriorityFeePerGas };\n};\n"]}
|
|
@@ -50,6 +50,7 @@ export const CHAIN_ID_TO_NODE = {
|
|
|
50
50
|
11155111: "https://fittest-ultra-aura.ethereum-sepolia.quiknode.pro/3893d01b1dd411fdfa9b6dd372dd2b4f69fcf1ea/",
|
|
51
51
|
137: `https://polygon-mainnet.infura.io/v3/${INFURA_API_KEY}`,
|
|
52
52
|
80001: `https://polygon-mumbai.infura.io/v3/${INFURA_API_KEY}`,
|
|
53
|
+
80002: `https://polygon-amoy.infura.io/v3/${INFURA_API_KEY}`,
|
|
53
54
|
10: `https://optimism-mainnet.infura.io/v3/${INFURA_API_KEY}`,
|
|
54
55
|
420: `https://optimism-goerli.infura.io/v3/${INFURA_API_KEY}`,
|
|
55
56
|
42161: `https://arbitrum-mainnet.infura.io/v3/${INFURA_API_KEY}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/kernel-zerodev/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAY,MAAM,MAAM,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAC7C,MAAM,CAAC,MAAM,iCAAiC,GAAG,KAAK,CAAC;AACvD,MAAM,CAAC,MAAM,WAAW,GACtB,sDAAsD,CAAC;AACzD,MAAM,CAAC,MAAM,aAAa,GACxB,wDAAwD,CAAC;AAC3D,MAAM,CAAC,MAAM,kBAAkB,GAC7B,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,cAAc,GAAQ,4CAA4C,CAAC;AAChF,MAAM,CAAC,MAAM,WAAW,GAAG,mCAAmC,CAAC;AAC/D,MAAM,CAAC,MAAM,OAAO,GAAG,8BAA8B,CAAC;AACtD,MAAM,CAAC,MAAM,uBAAuB,GAClC,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,sBAAsB,GACjC,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,mBAAmB,GAAG,4CAA4C,CAAC;AAChF,MAAM,CAAC,MAAM,6BAA6B,GACxC,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,4CAA4C,CAAC;AAC/E,MAAM,CAAC,MAAM,eAAe,GAC1B,sIAAsI,CAAC;AACzI,MAAM,CAAC,MAAM,oCAAoC,GAC/C,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,YAAY,GAAG,4CAA4C,CAAC;AACzE,MAAM,CAAC,MAAM,6BAA6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AAO,CAAC,EAAE,EAAE,YAAe,CAAC;CAC9B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,kCAAkC,CAAC;AACjE,MAAM,CAAC,MAAM,gBAAgB,GAA8B;IACzD,CAAC,EAAE,gCAAgC,cAAc,EAAE;IACnD,CAAC,EAAE,+BAA+B,cAAc,EAAE;IAClD,QAAQ,EACN,oGAAoG;IACtG,GAAG,EAAE,wCAAwC,cAAc,EAAE;IAC7D,KAAK,EAAE,uCAAuC,cAAc,EAAE;IAC9D,EAAE,EAAE,yCAAyC,cAAc,EAAE;IAC7D,GAAG,EAAE,wCAAwC,cAAc,EAAE;IAC7D,KAAK,EAAE,yCAAyC,cAAc,EAAE;IAEhE,MAAM,EAAE,wCAAwC,cAAc,EAAE;IAChE,KAAK,EAAE,0CAA0C,cAAc,EAAE;IACjE,KAAK,EAAE,uCAAuC,cAAc,EAAE;IAC9D,UAAU,EAAE,uCAAuC,cAAc,EAAE;IACnE,UAAU,EAAE,uCAAuC,cAAc,EAAE;IACnE,EAAE,EAAE,wFAAwF;IAC5F,IAAI,EAAE,+FAA+F;IACrG,KAAK,EACH,8FAA8F;IAChG,GAAG,EAAE,2FAA2F;IAChG,KAAK,EAAE,oEAAoE;IAC3E,KAAK,EAAE,sCAAsC,cAAc,EAAE;IAC7D,KAAK,EAAE,qCAAqC,cAAc,EAAE;IAC5D,GAAG,EAAE,iEAAiE;IACtE,KAAK,EAAE,uCAAuC;IAC9C,OAAO,EAAE,oCAAoC;IAC7C,KAAK,EACH,gGAAgG;IAClG,MAAM,EAAE,yCAAyC,cAAc,EAAE;IACjE,QAAQ,EAAE,yCAAyC,cAAc,EAAE;CAEpE,CAAC","sourcesContent":["import { parseUnits, type Hex } from \"viem\";\nimport type { IGasTokenAddresses } from \"./paymaster/types.js\";\nimport { polygon } from \"viem/chains\";\n\nexport const DEFAULT_SEND_TX_MAX_RETRIES = 3;\nexport const DEFAULT_SEND_TX_RETRY_INTERVAL_MS = 60000; // 1 minutes\nexport const BUNDLER_URL =\n \"https://meta-aa-provider.onrender.com/api/v1/bundler\";\nexport const PAYMASTER_URL =\n \"https://meta-aa-provider.onrender.com/api/v1/paymaster\";\nexport const ENTRYPOINT_ADDRESS: Hex =\n \"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789\";\nexport const MULTISEND_ADDR: Hex = \"0x8ae01fcf7c655655ff2c6ef907b8b4718ab4e17c\";\nexport const BACKEND_URL = \"https://backend-vikp.onrender.com\";\nexport const API_URL = \"https://prod-api.zerodev.app\";\nexport const ECDSA_VALIDATOR_ADDRESS =\n \"0xd9AB5096a832b9ce79914329DAEE236f8Eea0390\";\nexport const KERNEL_FACTORY_ADDRESS =\n \"0x5de4839a76cf55d0c90e2061ef4386d962E15ae3\";\nexport const KERNEL_IMPL_ADDRESS = \"0x0DA6a956B9488eD4dd761E59f52FDc6c8068E6B5\";\nexport const KILL_SWITCH_VALIDATOR_ADDRESS =\n \"0x7393A7dA58CCfFb78f52adb09705BE6E20F704BC\";\nexport const KILL_SWITCH_ACTION = \"0x3f38e479304c7F18F988269a1bDa7d646bd48243\";\nexport const DUMMY_ECDSA_SIG =\n \"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c\";\nexport const ERC165_SESSION_KEY_VALIDATOR_ADDRESS =\n \"0xe149290800De29D4b0BF9dB82c508255D81902E6\";\nexport const TOKEN_ACTION = \"0x2087C7FfD0d0DAE80a00EE74325aBF3449e0eaf1\";\nexport const SESSION_KEY_VALIDATOR_ADDRESS =\n \"0x5C06CE2b673fD5E6e56076e40DD46aB67f5a72A5\";\nexport const RECOVERY_VALIDATOR_ADDRESS =\n \"0xaFA369cA3432e62ACe6bd77B2886F2D588c68dA8\";\nexport const RECOVERY_ACTION = \"0x2f65dB8039fe5CAEE0a8680D2879deB800F31Ae1\";\nexport const oneAddress = \"0x0000000000000000000000000000000000000001\";\n\nexport const gasTokenChainAddresses: IGasTokenAddresses = {\n USDC: {\n 1: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n // 5: \"0x2f3A40A3db8a7e3D09B0adfEfbCe4f6F81927557\",\n 137: \"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174\",\n // 80001: \"\",\n // 420: \"0x7F5c764cBc14f9669B88837ca1490cCa17c31607\",\n 42161: \"0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8\",\n // 421613: \"\",\n 43114: \"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E\",\n // 43113: \"\",\n // 56: \"\",\n // 97: \"\"\n },\n PEPE: {\n 1: \"0x6982508145454Ce325dDbE47a25d4ec3d2311933\",\n },\n};\n\nexport const ERC20_APPROVAL_AMOUNT: { [key: string]: bigint } = {\n // ETH\n [gasTokenChainAddresses[\"USDC\"][1]]: parseUnits(\"100\", 6),\n\n // Goerli\n [gasTokenChainAddresses[\"USDC\"][5]]: parseUnits(\"100\", 6),\n\n // Polygon\n [gasTokenChainAddresses[\"USDC\"][137]]: parseUnits(\"10\", 6),\n\n // Arbitrum\n [gasTokenChainAddresses[\"USDC\"][42161]]: parseUnits(\"10\", 6),\n\n // Avalanche\n [gasTokenChainAddresses[\"USDC\"][43114]]: parseUnits(\"10\", 6),\n\n // ETH\n [gasTokenChainAddresses[\"PEPE\"][1]]: parseUnits(\"50000000\", 18),\n\n \"0x3870419Ba2BBf0127060bCB37f69A1b1C090992B\": parseUnits(\"100\", 18),\n};\n\nexport const minPriorityFeePerBidDefaults = new Map<number, bigint>([\n [polygon.id, 30_000_000_000n],\n]);\n\nexport const INFURA_API_KEY = \"f36f7f706a58477884ce6fe89165666c\";\nexport const CHAIN_ID_TO_NODE: { [key: number]: string } = {\n 1: `https://mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 5: `https://goerli.infura.io/v3/${INFURA_API_KEY}`,\n 11155111:\n \"https://fittest-ultra-aura.ethereum-sepolia.quiknode.pro/3893d01b1dd411fdfa9b6dd372dd2b4f69fcf1ea/\",\n 137: `https://polygon-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 80001: `https://polygon-mumbai.infura.io/v3/${INFURA_API_KEY}`,\n 10: `https://optimism-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 420: `https://optimism-goerli.infura.io/v3/${INFURA_API_KEY}`,\n 42161: `https://arbitrum-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n // 42161: 'https://evocative-stylish-dinghy.arbitrum-mainnet.discover.quiknode.pro/80b526d14fa9fd9a8b0db1e65554acaf00c6a1ab/',\n 421613: `https://arbitrum-goerli.infura.io/v3/${INFURA_API_KEY}`,\n 43114: `https://avalanche-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 43113: `https://avalanche-fuji.infura.io/v3/${INFURA_API_KEY}`,\n 1313161554: `https://aurora-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 1313161555: `https://aurora-testnet.infura.io/v3/${INFURA_API_KEY}`,\n 56: \"https://neat-greatest-layer.bsc.quiknode.pro/9405a499ceee314e5f2f68c9d47518d3537fce6a/\",\n 8453: \"https://twilight-red-tree.base-mainnet.quiknode.pro/dc6eb27bf0f917df215922488dd97f4de7d9b08e/\",\n 84531:\n \"https://icy-long-mountain.base-goerli.quiknode.pro/5b80d93e97cc9412a63c10a30841869abbef9596/\",\n 100: \"https://thrilling-fluent-film.xdai.quiknode.pro/305955cffb9868cdd95b5e3dc9775f20678ad9ac/\",\n 10200: \"https://nd-810-853-201.p2pify.com/e828b09f0d43591de96c297b3f36fffd\",\n 59144: `https://linea-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 59140: `https://linea-goerli.infura.io/v3/${INFURA_API_KEY}`,\n 204: \"https://opbnb.rpc.thirdweb.com/eed98c1f30120c0508f17c1f01d3102b\",\n 42069: \"https://rpc.op-testnet.gelato.digital\",\n 1261120: \"https://rpc.zkatana.gelato.digital\",\n 84532:\n \"https://floral-old-feather.base-sepolia.quiknode.pro/4c3b4295d0c174410872b1e461a91cc33c7969a9/\",\n 421614: `https://arbitrum-sepolia.infura.io/v3/${INFURA_API_KEY}`,\n 11155420: `https://optimism-sepolia.infura.io/v3/${INFURA_API_KEY}`,\n // 5611: 'opBnb-testnet',\n};\n"]}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/kernel-zerodev/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAY,MAAM,MAAM,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAC7C,MAAM,CAAC,MAAM,iCAAiC,GAAG,KAAK,CAAC;AACvD,MAAM,CAAC,MAAM,WAAW,GACtB,sDAAsD,CAAC;AACzD,MAAM,CAAC,MAAM,aAAa,GACxB,wDAAwD,CAAC;AAC3D,MAAM,CAAC,MAAM,kBAAkB,GAC7B,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,cAAc,GAAQ,4CAA4C,CAAC;AAChF,MAAM,CAAC,MAAM,WAAW,GAAG,mCAAmC,CAAC;AAC/D,MAAM,CAAC,MAAM,OAAO,GAAG,8BAA8B,CAAC;AACtD,MAAM,CAAC,MAAM,uBAAuB,GAClC,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,sBAAsB,GACjC,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,mBAAmB,GAAG,4CAA4C,CAAC;AAChF,MAAM,CAAC,MAAM,6BAA6B,GACxC,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,4CAA4C,CAAC;AAC/E,MAAM,CAAC,MAAM,eAAe,GAC1B,sIAAsI,CAAC;AACzI,MAAM,CAAC,MAAM,oCAAoC,GAC/C,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,YAAY,GAAG,4CAA4C,CAAC;AACzE,MAAM,CAAC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IAClE,CAAC,OAAO,CAAC,EAAE,EAAE,YAAe,CAAC;CAC9B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,kCAAkC,CAAC;AACjE,MAAM,CAAC,MAAM,gBAAgB,GAA8B;IACzD,CAAC,EAAE,gCAAgC,cAAc,EAAE;IACnD,CAAC,EAAE,+BAA+B,cAAc,EAAE;IAClD,QAAQ,EACN,oGAAoG;IACtG,GAAG,EAAE,wCAAwC,cAAc,EAAE;IAC7D,KAAK,EAAE,uCAAuC,cAAc,EAAE;IAC9D,KAAK,EAAE,qCAAqC,cAAc,EAAE;IAC5D,EAAE,EAAE,yCAAyC,cAAc,EAAE;IAC7D,GAAG,EAAE,wCAAwC,cAAc,EAAE;IAC7D,KAAK,EAAE,yCAAyC,cAAc,EAAE;IAEhE,MAAM,EAAE,wCAAwC,cAAc,EAAE;IAChE,KAAK,EAAE,0CAA0C,cAAc,EAAE;IACjE,KAAK,EAAE,uCAAuC,cAAc,EAAE;IAC9D,UAAU,EAAE,uCAAuC,cAAc,EAAE;IACnE,UAAU,EAAE,uCAAuC,cAAc,EAAE;IACnE,EAAE,EAAE,wFAAwF;IAC5F,IAAI,EAAE,+FAA+F;IACrG,KAAK,EACH,8FAA8F;IAChG,GAAG,EAAE,2FAA2F;IAChG,KAAK,EAAE,oEAAoE;IAC3E,KAAK,EAAE,sCAAsC,cAAc,EAAE;IAC7D,KAAK,EAAE,qCAAqC,cAAc,EAAE;IAC5D,GAAG,EAAE,iEAAiE;IACtE,KAAK,EAAE,uCAAuC;IAC9C,OAAO,EAAE,oCAAoC;IAC7C,KAAK,EACH,gGAAgG;IAClG,MAAM,EAAE,yCAAyC,cAAc,EAAE;IACjE,QAAQ,EAAE,yCAAyC,cAAc,EAAE;CAEpE,CAAC","sourcesContent":["import { parseUnits, type Hex } from \"viem\";\nimport type { IGasTokenAddresses } from \"./paymaster/types.js\";\nimport { polygon } from \"viem/chains\";\n\nexport const DEFAULT_SEND_TX_MAX_RETRIES = 3;\nexport const DEFAULT_SEND_TX_RETRY_INTERVAL_MS = 60000; // 1 minutes\nexport const BUNDLER_URL =\n \"https://meta-aa-provider.onrender.com/api/v1/bundler\";\nexport const PAYMASTER_URL =\n \"https://meta-aa-provider.onrender.com/api/v1/paymaster\";\nexport const ENTRYPOINT_ADDRESS: Hex =\n \"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789\";\nexport const MULTISEND_ADDR: Hex = \"0x8ae01fcf7c655655ff2c6ef907b8b4718ab4e17c\";\nexport const BACKEND_URL = \"https://backend-vikp.onrender.com\";\nexport const API_URL = \"https://prod-api.zerodev.app\";\nexport const ECDSA_VALIDATOR_ADDRESS =\n \"0xd9AB5096a832b9ce79914329DAEE236f8Eea0390\";\nexport const KERNEL_FACTORY_ADDRESS =\n \"0x5de4839a76cf55d0c90e2061ef4386d962E15ae3\";\nexport const KERNEL_IMPL_ADDRESS = \"0x0DA6a956B9488eD4dd761E59f52FDc6c8068E6B5\";\nexport const KILL_SWITCH_VALIDATOR_ADDRESS =\n \"0x7393A7dA58CCfFb78f52adb09705BE6E20F704BC\";\nexport const KILL_SWITCH_ACTION = \"0x3f38e479304c7F18F988269a1bDa7d646bd48243\";\nexport const DUMMY_ECDSA_SIG =\n \"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c\";\nexport const ERC165_SESSION_KEY_VALIDATOR_ADDRESS =\n \"0xe149290800De29D4b0BF9dB82c508255D81902E6\";\nexport const TOKEN_ACTION = \"0x2087C7FfD0d0DAE80a00EE74325aBF3449e0eaf1\";\nexport const SESSION_KEY_VALIDATOR_ADDRESS =\n \"0x5C06CE2b673fD5E6e56076e40DD46aB67f5a72A5\";\nexport const RECOVERY_VALIDATOR_ADDRESS =\n \"0xaFA369cA3432e62ACe6bd77B2886F2D588c68dA8\";\nexport const RECOVERY_ACTION = \"0x2f65dB8039fe5CAEE0a8680D2879deB800F31Ae1\";\nexport const oneAddress = \"0x0000000000000000000000000000000000000001\";\n\nexport const gasTokenChainAddresses: IGasTokenAddresses = {\n USDC: {\n 1: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n // 5: \"0x2f3A40A3db8a7e3D09B0adfEfbCe4f6F81927557\",\n 137: \"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174\",\n // 80001: \"\",\n // 420: \"0x7F5c764cBc14f9669B88837ca1490cCa17c31607\",\n 42161: \"0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8\",\n // 421613: \"\",\n 43114: \"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E\",\n // 43113: \"\",\n // 56: \"\",\n // 97: \"\"\n },\n PEPE: {\n 1: \"0x6982508145454Ce325dDbE47a25d4ec3d2311933\",\n },\n};\n\nexport const ERC20_APPROVAL_AMOUNT: { [key: string]: bigint } = {\n // ETH\n [gasTokenChainAddresses[\"USDC\"][1]]: parseUnits(\"100\", 6),\n\n // Goerli\n [gasTokenChainAddresses[\"USDC\"][5]]: parseUnits(\"100\", 6),\n\n // Polygon\n [gasTokenChainAddresses[\"USDC\"][137]]: parseUnits(\"10\", 6),\n\n // Arbitrum\n [gasTokenChainAddresses[\"USDC\"][42161]]: parseUnits(\"10\", 6),\n\n // Avalanche\n [gasTokenChainAddresses[\"USDC\"][43114]]: parseUnits(\"10\", 6),\n\n // ETH\n [gasTokenChainAddresses[\"PEPE\"][1]]: parseUnits(\"50000000\", 18),\n\n \"0x3870419Ba2BBf0127060bCB37f69A1b1C090992B\": parseUnits(\"100\", 18),\n};\n\nexport const minPriorityFeePerBidDefaults = new Map<number, bigint>([\n [polygon.id, 30_000_000_000n],\n]);\n\nexport const INFURA_API_KEY = \"f36f7f706a58477884ce6fe89165666c\";\nexport const CHAIN_ID_TO_NODE: { [key: number]: string } = {\n 1: `https://mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 5: `https://goerli.infura.io/v3/${INFURA_API_KEY}`,\n 11155111:\n \"https://fittest-ultra-aura.ethereum-sepolia.quiknode.pro/3893d01b1dd411fdfa9b6dd372dd2b4f69fcf1ea/\",\n 137: `https://polygon-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 80001: `https://polygon-mumbai.infura.io/v3/${INFURA_API_KEY}`,\n 80002: `https://polygon-amoy.infura.io/v3/${INFURA_API_KEY}`,\n 10: `https://optimism-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 420: `https://optimism-goerli.infura.io/v3/${INFURA_API_KEY}`,\n 42161: `https://arbitrum-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n // 42161: 'https://evocative-stylish-dinghy.arbitrum-mainnet.discover.quiknode.pro/80b526d14fa9fd9a8b0db1e65554acaf00c6a1ab/',\n 421613: `https://arbitrum-goerli.infura.io/v3/${INFURA_API_KEY}`,\n 43114: `https://avalanche-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 43113: `https://avalanche-fuji.infura.io/v3/${INFURA_API_KEY}`,\n 1313161554: `https://aurora-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 1313161555: `https://aurora-testnet.infura.io/v3/${INFURA_API_KEY}`,\n 56: \"https://neat-greatest-layer.bsc.quiknode.pro/9405a499ceee314e5f2f68c9d47518d3537fce6a/\",\n 8453: \"https://twilight-red-tree.base-mainnet.quiknode.pro/dc6eb27bf0f917df215922488dd97f4de7d9b08e/\",\n 84531:\n \"https://icy-long-mountain.base-goerli.quiknode.pro/5b80d93e97cc9412a63c10a30841869abbef9596/\",\n 100: \"https://thrilling-fluent-film.xdai.quiknode.pro/305955cffb9868cdd95b5e3dc9775f20678ad9ac/\",\n 10200: \"https://nd-810-853-201.p2pify.com/e828b09f0d43591de96c297b3f36fffd\",\n 59144: `https://linea-mainnet.infura.io/v3/${INFURA_API_KEY}`,\n 59140: `https://linea-goerli.infura.io/v3/${INFURA_API_KEY}`,\n 204: \"https://opbnb.rpc.thirdweb.com/eed98c1f30120c0508f17c1f01d3102b\",\n 42069: \"https://rpc.op-testnet.gelato.digital\",\n 1261120: \"https://rpc.zkatana.gelato.digital\",\n 84532:\n \"https://floral-old-feather.base-sepolia.quiknode.pro/4c3b4295d0c174410872b1e461a91cc33c7969a9/\",\n 421614: `https://arbitrum-sepolia.infura.io/v3/${INFURA_API_KEY}`,\n 11155420: `https://optimism-sepolia.infura.io/v3/${INFURA_API_KEY}`,\n // 5611: 'opBnb-testnet',\n};\n"]}
|
|
@@ -55,11 +55,10 @@ export const withZeroDevGasEstimator = (provider) => {
|
|
|
55
55
|
userOpGasEstimates = await provider.rpcClient.estimateUserOperationGas(request, ENTRYPOINT_ADDRESS);
|
|
56
56
|
const { preVerificationGas, verificationGasLimit, callGasLimit } = userOpGasEstimates;
|
|
57
57
|
request.preVerificationGas =
|
|
58
|
-
|
|
58
|
+
BigInt(preVerificationGas) ?? request.preVerificationGas;
|
|
59
59
|
request.verificationGasLimit =
|
|
60
60
|
BigInt(verificationGasLimit) ?? request.verificationGasLimit;
|
|
61
|
-
request.callGasLimit =
|
|
62
|
-
(BigInt(callGasLimit) * 12n) / 10n ?? request.callGasLimit;
|
|
61
|
+
request.callGasLimit = BigInt(callGasLimit) ?? request.callGasLimit;
|
|
63
62
|
return {
|
|
64
63
|
...struct,
|
|
65
64
|
...request,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gas-estimator.js","sourceRoot":"","sources":["../../../../src/kernel-zerodev/middleware/gas-estimator.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EAGX,iBAAiB,GAGlB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAqC,MAAM,uBAAuB,CAAC;AAE1E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,QAAyB,EACR,EAAE;IACnB,QAAQ,CAAC,iBA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iBAAiB,CAAC;QAClD,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;QAC1D,QAAQ,EAAE,QAAQ,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACzD,OAAO,CAAC,IAAI,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;YACvD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;KACH,CAAC,CAAC;IAEH,IAAI,YAAY,GAAG,IAAI,CAAC;IACxB,IAAI,oBAAoB,GAAG,IAAI,CAAC;IAEhC,IAAI,KAAK,IAAI,KAAK,CAAC,aAAa,IAAI,IAAI,EAAE;QAExC,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;QACxC,oBAAoB,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC;QACxE,IACE,oBAAoB,IAAI,IAAI;YAC5B,oBAAoB,GAAG,MAAM,CAAC,CAAC,CAAC;YAChC,oBAAoB,GAAG,UAAU,EACjC;YACA,oBAAoB,GAAG,UAAU,CAAC;SACnC;QACD,oBAAoB;YAClB,oBAAoB,GAAG,QAAQ,CAAC,oBAAoB;gBAClD,CAAC,CAAC,QAAQ,CAAC,oBAAoB;gBAC/B,CAAC,CAAC,oBAAoB,CAAC;QAC3B,YAAY;YACV,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,oBAAoB,IAAI,CAAC,CAAC,CAAC;KACjE;IAED,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,CAAC;AAChD,CAAC,CAAC","sourcesContent":["import type { ZeroDevProvider } from \"../provider.js\";\nimport {\n deepHexlify,\n type Hex,\n type UserOperationStruct,\n resolveProperties,\n type BigNumberish,\n type UserOperationEstimateGasResponse,\n} from \"@alchemy/aa-core\";\nimport { ENTRYPOINT_ADDRESS } from \"../constants.js\";\nimport { calcPreVerificationGas } from \"../utils/calc-pre-verification-gas.js\";\nimport { type PaymasterAndBundlerProviders } from \"../paymaster/types.js\";\n\nexport const withZeroDevGasEstimator = (\n provider: ZeroDevProvider\n): ZeroDevProvider => {\n provider.withFeeDataGetter(async (struct) => {\n let overrides = await resolveProperties({\n maxFeePerGas: struct.maxFeePerGas,\n maxPriorityFeePerGas: struct.maxPriorityFeePerGas,\n });\n\n if (provider.bundlerProvider === \"GELATO\") {\n return { maxFeePerGas: 0n, maxPriorityFeePerGas: 0n };\n }\n\n let maxFeePerGas, maxPriorityFeePerGas;\n\n try {\n ({ maxFeePerGas, maxPriorityFeePerGas } = await eip1559GasPrice(\n provider\n ));\n } catch (error: any) {\n console.warn(\n \"getGas: eth_maxPriorityFeePerGas failed, falling back to legacy gas price.\"\n );\n }\n\n if (maxFeePerGas === undefined || maxPriorityFeePerGas === undefined) {\n const feeData = await getFeeData(provider);\n maxFeePerGas = feeData?.maxFeePerGas ? BigInt(feeData?.maxFeePerGas) : 0n;\n maxPriorityFeePerGas = feeData.maxPriorityFeePerGas\n ? BigInt(feeData.maxPriorityFeePerGas)\n : 0n;\n }\n\n if (overrides.maxFeePerGas || overrides.maxPriorityFeePerGas) {\n return {\n maxFeePerGas: overrides.maxFeePerGas ?? maxFeePerGas,\n maxPriorityFeePerGas:\n overrides.maxPriorityFeePerGas ?? maxPriorityFeePerGas,\n };\n }\n return { maxFeePerGas, maxPriorityFeePerGas };\n });\n\n provider.withGasEstimator(async (struct) => {\n if (\n struct.callGasLimit !== undefined &&\n struct.verificationGasLimit !== undefined &&\n struct.preVerificationGas !== undefined\n ) {\n return struct;\n }\n const initCode = await provider.account?.getInitCode();\n const initGas = await estimateCreationGas(provider, initCode);\n const partialStruct: UserOperationStruct = {\n ...struct,\n callGasLimit:\n initCode !== undefined && initCode.length > 2\n ? BigInt(\"1000000\")\n : BigInt(55000),\n verificationGasLimit: BigInt(110000) + initGas,\n preVerificationGas: BigInt(100000),\n };\n\n partialStruct.preVerificationGas = await getPreVerificationGas(\n partialStruct\n );\n\n const request = deepHexlify(await resolveProperties(partialStruct));\n let userOpGasEstimates: UserOperationEstimateGasResponse | undefined;\n userOpGasEstimates = await provider.rpcClient.estimateUserOperationGas(\n request,\n ENTRYPOINT_ADDRESS\n );\n const { preVerificationGas, verificationGasLimit, callGasLimit } =\n userOpGasEstimates;\n request.preVerificationGas =\n (BigInt(preVerificationGas) * 12n) / 10n ?? request.preVerificationGas;\n request.verificationGasLimit =\n BigInt(verificationGasLimit) ?? request.verificationGasLimit;\n request.callGasLimit =\n (BigInt(callGasLimit) * 12n) / 10n ?? request.callGasLimit;\n\n return {\n ...struct,\n ...request,\n };\n });\n\n return provider;\n};\n\nexport const estimateCreationGas = async (\n provider: ZeroDevProvider,\n initCode?: string\n): Promise<bigint> => {\n if (initCode == null || initCode === \"0x\") return BigInt(0);\n const deployerAddress = initCode.substring(0, 42) as Hex;\n const deployerCallData = (\"0x\" + initCode.substring(42)) as Hex;\n return await provider.rpcClient.estimateGas({\n account: ENTRYPOINT_ADDRESS,\n to: deployerAddress,\n data: deployerCallData,\n });\n};\n\n/**\n * should cover cost of putting calldata on-chain, and some overhead.\n * actual overhead depends on the expected bundle size\n */\nexport const getPreVerificationGas = async (\n userOp: Partial<UserOperationStruct>\n): Promise<number> => {\n const p = await resolveProperties(userOp);\n return calcPreVerificationGas(p);\n};\n\nexport const GAS_PRICE_RPC_METHODS_BY_BUNDLER: {\n [K in PaymasterAndBundlerProviders]: string;\n} = {\n STACKUP: \"eth_maxPriorityFeePerGas\",\n ALCHEMY: \"rundler_maxPriorityFeePerGas\",\n PIMLICO: \"pimlico_getUserOperationGasPrice\",\n GELATO: \"eth_maxPriorityFeePerGas\",\n};\n\nexport const eip1559GasPrice = async (provider: ZeroDevProvider) => {\n let [fee, block] = await Promise.all([\n provider.rpcClient.request({\n method:\n // @ts-expect-error\n GAS_PRICE_RPC_METHODS_BY_BUNDLER[provider.bundlerProvider] ??\n \"eth_maxPriorityFeePerGas\",\n params: [],\n }) as any,\n provider.rpcClient.getBlock({ blockTag: \"latest\" }),\n ]);\n\n if (provider.bundlerProvider === \"PIMLICO\") {\n fee = fee.standard.maxPriorityFeePerGas;\n }\n\n const tip = BigInt(fee);\n const buffer =\n (tip / 100n) *\n BigInt(provider.feeOptions.maxPriorityFeePerGasBufferPercentage);\n let maxPriorityFeePerGas = tip + buffer;\n maxPriorityFeePerGas =\n maxPriorityFeePerGas < provider.minPriorityFeePerBid\n ? provider.minPriorityFeePerBid\n : maxPriorityFeePerGas;\n const maxFeePerGas =\n ((block.baseFeePerGas\n ? BigInt(block.baseFeePerGas) * 2n + maxPriorityFeePerGas\n : maxPriorityFeePerGas) *\n (BigInt(100) +\n BigInt(provider.feeOptions.maxFeePerGasBufferPercentage))) /\n 100n;\n\n return { maxFeePerGas, maxPriorityFeePerGas };\n};\ninterface FeeData {\n maxFeePerGas: BigNumberish | null;\n maxPriorityFeePerGas: BigNumberish | null;\n}\n\nexport const getFeeData = async (\n provider: ZeroDevProvider\n): Promise<FeeData> => {\n const { block, gasPrice } = await resolveProperties({\n block: provider.rpcClient.getBlock({ blockTag: \"latest\" }),\n gasPrice: provider.rpcClient.getGasPrice().catch((error) => {\n console.warn(\"Legacy: Failed to get gas price\", error);\n return null;\n }),\n });\n\n let maxFeePerGas = null;\n let maxPriorityFeePerGas = null;\n\n if (block && block.baseFeePerGas != null) {\n // Set the tip to the min of the tip for the last block and 1.5 gwei\n const minimumTip = BigInt(\"1500000000\");\n maxPriorityFeePerGas = gasPrice ? gasPrice - block.baseFeePerGas : null;\n if (\n maxPriorityFeePerGas == null ||\n maxPriorityFeePerGas - BigInt(0) ||\n maxPriorityFeePerGas > minimumTip\n ) {\n maxPriorityFeePerGas = minimumTip;\n }\n maxPriorityFeePerGas =\n maxPriorityFeePerGas < provider.minPriorityFeePerBid\n ? provider.minPriorityFeePerBid\n : maxPriorityFeePerGas;\n maxFeePerGas =\n block.baseFeePerGas * BigInt(2) + (maxPriorityFeePerGas ?? 0);\n }\n\n return { maxFeePerGas, maxPriorityFeePerGas };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"gas-estimator.js","sourceRoot":"","sources":["../../../../src/kernel-zerodev/middleware/gas-estimator.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EAGX,iBAAiB,GAGlB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAqC,MAAM,uBAAuB,CAAC;AAE1E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,QAAyB,EACR,EAAE;IACnB,QAAQ,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAC1C,IAAI,SAAS,GAAG,MAAM,iBAAiB,CAAC;YACtC,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,oBAAoB,EAAE,MAAM,CAAC,oBAAoB;SAClD,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,eAAe,KAAK,QAAQ,EAAE;YACzC,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,oBAAoB,EAAE,EAAE,EAAE,CAAC;SACvD;QAED,IAAI,YAAY,EAAE,oBAAoB,CAAC;QAEvC,IAAI;YACF,CAAC,EAAE,YAAY,EAAE,oBAAoB,EAAE,GAAG,MAAM,eAAe,CAC7D,QAAQ,CACT,CAAC,CAAC;SACJ;QAAC,OAAO,KAAU,EAAE;YACnB,OAAO,CAAC,IAAI,CACV,4EAA4E,CAC7E,CAAC;SACH;QAED,IAAI,YAAY,KAAK,SAAS,IAAI,oBAAoB,KAAK,SAAS,EAAE;YACpE,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC,CAAC;YAC3C,YAAY,GAAG,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,MAAM,CA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B,GAAG,QAAQ,CAAC,oBAAoB;gBAClD,CAAC,CAAC,QAAQ,CAAC,oBAAoB;gBAC/B,CAAC,CAAC,oBAAoB,CAAC;QAC3B,YAAY;YACV,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,oBAAoB,IAAI,CAAC,CAAC,CAAC;KACjE;IAED,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,CAAC;AAChD,CAAC,CAAC","sourcesContent":["import type { ZeroDevProvider } from \"../provider.js\";\nimport {\n deepHexlify,\n type Hex,\n type UserOperationStruct,\n resolveProperties,\n type BigNumberish,\n type UserOperationEstimateGasResponse,\n} from \"@alchemy/aa-core\";\nimport { ENTRYPOINT_ADDRESS } from \"../constants.js\";\nimport { calcPreVerificationGas } from \"../utils/calc-pre-verification-gas.js\";\nimport { type PaymasterAndBundlerProviders } from \"../paymaster/types.js\";\n\nexport const withZeroDevGasEstimator = (\n provider: ZeroDevProvider\n): ZeroDevProvider => {\n provider.withFeeDataGetter(async (struct) => {\n let overrides = await resolveProperties({\n maxFeePerGas: struct.maxFeePerGas,\n maxPriorityFeePerGas: struct.maxPriorityFeePerGas,\n });\n\n if (provider.bundlerProvider === \"GELATO\") {\n return { maxFeePerGas: 0n, maxPriorityFeePerGas: 0n };\n }\n\n let maxFeePerGas, maxPriorityFeePerGas;\n\n try {\n ({ maxFeePerGas, maxPriorityFeePerGas } = await eip1559GasPrice(\n provider\n ));\n } catch (error: any) {\n console.warn(\n \"getGas: eth_maxPriorityFeePerGas failed, falling back to legacy gas price.\"\n );\n }\n\n if (maxFeePerGas === undefined || maxPriorityFeePerGas === undefined) {\n const feeData = await getFeeData(provider);\n maxFeePerGas = feeData?.maxFeePerGas ? BigInt(feeData?.maxFeePerGas) : 0n;\n maxPriorityFeePerGas = feeData.maxPriorityFeePerGas\n ? BigInt(feeData.maxPriorityFeePerGas)\n : 0n;\n }\n\n if (overrides.maxFeePerGas || overrides.maxPriorityFeePerGas) {\n return {\n maxFeePerGas: overrides.maxFeePerGas ?? maxFeePerGas,\n maxPriorityFeePerGas:\n overrides.maxPriorityFeePerGas ?? maxPriorityFeePerGas,\n };\n }\n return { maxFeePerGas, maxPriorityFeePerGas };\n });\n\n provider.withGasEstimator(async (struct) => {\n if (\n struct.callGasLimit !== undefined &&\n struct.verificationGasLimit !== undefined &&\n struct.preVerificationGas !== undefined\n ) {\n return struct;\n }\n const initCode = await provider.account?.getInitCode();\n const initGas = await estimateCreationGas(provider, initCode);\n const partialStruct: UserOperationStruct = {\n ...struct,\n callGasLimit:\n initCode !== undefined && initCode.length > 2\n ? BigInt(\"1000000\")\n : BigInt(55000),\n verificationGasLimit: BigInt(110000) + initGas,\n preVerificationGas: BigInt(100000),\n };\n\n partialStruct.preVerificationGas = await getPreVerificationGas(\n partialStruct\n );\n\n const request = deepHexlify(await resolveProperties(partialStruct));\n let userOpGasEstimates: UserOperationEstimateGasResponse | undefined;\n userOpGasEstimates = await provider.rpcClient.estimateUserOperationGas(\n request,\n ENTRYPOINT_ADDRESS\n );\n const { preVerificationGas, verificationGasLimit, callGasLimit } =\n userOpGasEstimates;\n request.preVerificationGas =\n BigInt(preVerificationGas) ?? request.preVerificationGas;\n request.verificationGasLimit =\n BigInt(verificationGasLimit) ?? request.verificationGasLimit;\n request.callGasLimit = BigInt(callGasLimit) ?? request.callGasLimit;\n\n return {\n ...struct,\n ...request,\n };\n });\n\n return provider;\n};\n\nexport const estimateCreationGas = async (\n provider: ZeroDevProvider,\n initCode?: string\n): Promise<bigint> => {\n if (initCode == null || initCode === \"0x\") return BigInt(0);\n const deployerAddress = initCode.substring(0, 42) as Hex;\n const deployerCallData = (\"0x\" + initCode.substring(42)) as Hex;\n return await provider.rpcClient.estimateGas({\n account: ENTRYPOINT_ADDRESS,\n to: deployerAddress,\n data: deployerCallData,\n });\n};\n\n/**\n * should cover cost of putting calldata on-chain, and some overhead.\n * actual overhead depends on the expected bundle size\n */\nexport const getPreVerificationGas = async (\n userOp: Partial<UserOperationStruct>\n): Promise<number> => {\n const p = await resolveProperties(userOp);\n return calcPreVerificationGas(p);\n};\n\nexport const GAS_PRICE_RPC_METHODS_BY_BUNDLER: {\n [K in PaymasterAndBundlerProviders]: string;\n} = {\n STACKUP: \"eth_maxPriorityFeePerGas\",\n ALCHEMY: \"rundler_maxPriorityFeePerGas\",\n PIMLICO: \"pimlico_getUserOperationGasPrice\",\n GELATO: \"eth_maxPriorityFeePerGas\",\n};\n\nexport const eip1559GasPrice = async (provider: ZeroDevProvider) => {\n let [fee, block] = await Promise.all([\n provider.rpcClient.request({\n method:\n // @ts-expect-error\n GAS_PRICE_RPC_METHODS_BY_BUNDLER[provider.bundlerProvider] ??\n \"eth_maxPriorityFeePerGas\",\n params: [],\n }) as any,\n provider.rpcClient.getBlock({ blockTag: \"latest\" }),\n ]);\n\n if (provider.bundlerProvider === \"PIMLICO\") {\n fee = fee.standard.maxPriorityFeePerGas;\n }\n\n const tip = BigInt(fee);\n const buffer =\n (tip / 100n) *\n BigInt(provider.feeOptions.maxPriorityFeePerGasBufferPercentage);\n let maxPriorityFeePerGas = tip + buffer;\n maxPriorityFeePerGas =\n maxPriorityFeePerGas < provider.minPriorityFeePerBid\n ? provider.minPriorityFeePerBid\n : maxPriorityFeePerGas;\n const maxFeePerGas =\n ((block.baseFeePerGas\n ? BigInt(block.baseFeePerGas) * 2n + maxPriorityFeePerGas\n : maxPriorityFeePerGas) *\n (BigInt(100) +\n BigInt(provider.feeOptions.maxFeePerGasBufferPercentage))) /\n 100n;\n\n return { maxFeePerGas, maxPriorityFeePerGas };\n};\ninterface FeeData {\n maxFeePerGas: BigNumberish | null;\n maxPriorityFeePerGas: BigNumberish | null;\n}\n\nexport const getFeeData = async (\n provider: ZeroDevProvider\n): Promise<FeeData> => {\n const { block, gasPrice } = await resolveProperties({\n block: provider.rpcClient.getBlock({ blockTag: \"latest\" }),\n gasPrice: provider.rpcClient.getGasPrice().catch((error) => {\n console.warn(\"Legacy: Failed to get gas price\", error);\n return null;\n }),\n });\n\n let maxFeePerGas = null;\n let maxPriorityFeePerGas = null;\n\n if (block && block.baseFeePerGas != null) {\n // Set the tip to the min of the tip for the last block and 1.5 gwei\n const minimumTip = BigInt(\"1500000000\");\n maxPriorityFeePerGas = gasPrice ? gasPrice - block.baseFeePerGas : null;\n if (\n maxPriorityFeePerGas == null ||\n maxPriorityFeePerGas - BigInt(0) ||\n maxPriorityFeePerGas > minimumTip\n ) {\n maxPriorityFeePerGas = minimumTip;\n }\n maxPriorityFeePerGas =\n maxPriorityFeePerGas < provider.minPriorityFeePerBid\n ? provider.minPriorityFeePerBid\n : maxPriorityFeePerGas;\n maxFeePerGas =\n block.baseFeePerGas * BigInt(2) + (maxPriorityFeePerGas ?? 0);\n }\n\n return { maxFeePerGas, maxPriorityFeePerGas };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/kernel-zerodev/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG/D,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAC7C,eAAO,MAAM,iCAAiC,QAAQ,CAAC;AACvD,eAAO,MAAM,WAAW,yDACgC,CAAC;AACzD,eAAO,MAAM,aAAa,2DACgC,CAAC;AAC3D,eAAO,MAAM,kBAAkB,EAAE,GACa,CAAC;AAC/C,eAAO,MAAM,cAAc,EAAE,GAAkD,CAAC;AAChF,eAAO,MAAM,WAAW,sCAAsC,CAAC;AAC/D,eAAO,MAAM,OAAO,iCAAiC,CAAC;AACtD,eAAO,MAAM,uBAAuB,+CACU,CAAC;AAC/C,eAAO,MAAM,sBAAsB,+CACW,CAAC;AAC/C,eAAO,MAAM,mBAAmB,+CAA+C,CAAC;AAChF,eAAO,MAAM,6BAA6B,+CACI,CAAC;AAC/C,eAAO,M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BAAmB,+CAA+C,CAAC;AAChF,eAAO,MAAM,6BAA6B,+CACI,CAAC;AAC/C,eAAO,MAAM,kBAAkB,+CAA+C,CAAC;AAC/E,eAAO,MAAM,eAAe,yIAC4G,CAAC;AACzI,eAAO,MAAM,oCAAoC,+CACH,CAAC;AAC/C,eAAO,MAAM,YAAY,+CAA+C,CAAC;AACzE,eAAO,MAAM,6BAA6B,+CACI,CAAC;AAC/C,eAAO,MAAM,0BAA0B,+CACO,CAAC;AAC/C,eAAO,MAAM,eAAe,+CAA+C,CAAC;AAC5E,eAAO,MAAM,UAAU,+CAA+C,CAAC;AAEvE,eAAO,MAAM,sBAAsB,EAAE,kBAiBpC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAoB1D,CAAC;AAEF,eAAO,MAAM,4BAA4B,qBAEvC,CAAC;AAEH,eAAO,MAAM,cAAc,qCAAqC,CAAC;AACjE,eAAO,MAAM,gBAAgB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAiCrD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gas-estimator.d.ts","sourceRoot":"","sources":["../../../../src/kernel-zerodev/middleware/gas-estimator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAGL,KAAK,mBAAmB,EAExB,KAAK,YAAY,EAElB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAE1E,eAAO,MAAM,uBAAuB,aACxB,eAAe,KACxB,
|
|
1
|
+
{"version":3,"file":"gas-estimator.d.ts","sourceRoot":"","sources":["../../../../src/kernel-zerodev/middleware/gas-estimator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAGL,KAAK,mBAAmB,EAExB,KAAK,YAAY,EAElB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAE1E,eAAO,MAAM,uBAAuB,aACxB,eAAe,KACxB,eAsFF,CAAC;AAEF,eAAO,MAAM,mBAAmB,aACpB,eAAe,aACd,MAAM,KAChB,QAAQ,MAAM,CAShB,CAAC;AAMF,eAAO,MAAM,qBAAqB,WACxB,QAAQ,mBAAmB,CAAC,KACnC,QAAQ,MAAM,CAGhB,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE;KAC5C,CAAC,IAAI,4BAA4B,GAAG,MAAM;CAM5C,CAAC;AAEF,eAAO,MAAM,eAAe,aAAoB,eAAe;;;EAkC9D,CAAC;AACF,UAAU,OAAO;IACf,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,oBAAoB,EAAE,YAAY,GAAG,IAAI,CAAC;CAC3C;AAED,eAAO,MAAM,UAAU,aACX,eAAe,KACxB,QAAQ,OAAO,CAgCjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -86,6 +86,7 @@ export const CHAIN_ID_TO_NODE: { [key: number]: string } = {
|
|
|
86
86
|
"https://fittest-ultra-aura.ethereum-sepolia.quiknode.pro/3893d01b1dd411fdfa9b6dd372dd2b4f69fcf1ea/",
|
|
87
87
|
137: `https://polygon-mainnet.infura.io/v3/${INFURA_API_KEY}`,
|
|
88
88
|
80001: `https://polygon-mumbai.infura.io/v3/${INFURA_API_KEY}`,
|
|
89
|
+
80002: `https://polygon-amoy.infura.io/v3/${INFURA_API_KEY}`,
|
|
89
90
|
10: `https://optimism-mainnet.infura.io/v3/${INFURA_API_KEY}`,
|
|
90
91
|
420: `https://optimism-goerli.infura.io/v3/${INFURA_API_KEY}`,
|
|
91
92
|
42161: `https://arbitrum-mainnet.infura.io/v3/${INFURA_API_KEY}`,
|
|
@@ -87,11 +87,10 @@ export const withZeroDevGasEstimator = (
|
|
|
87
87
|
const { preVerificationGas, verificationGasLimit, callGasLimit } =
|
|
88
88
|
userOpGasEstimates;
|
|
89
89
|
request.preVerificationGas =
|
|
90
|
-
|
|
90
|
+
BigInt(preVerificationGas) ?? request.preVerificationGas;
|
|
91
91
|
request.verificationGasLimit =
|
|
92
92
|
BigInt(verificationGasLimit) ?? request.verificationGasLimit;
|
|
93
|
-
request.callGasLimit =
|
|
94
|
-
(BigInt(callGasLimit) * 12n) / 10n ?? request.callGasLimit;
|
|
93
|
+
request.callGasLimit = BigInt(callGasLimit) ?? request.callGasLimit;
|
|
95
94
|
|
|
96
95
|
return {
|
|
97
96
|
...struct,
|
|
@@ -287,10 +287,8 @@ export class RecoveryValidator extends KernelBaseValidator {
|
|
|
287
287
|
const guardians: WeightedGuardians = {};
|
|
288
288
|
|
|
289
289
|
let nextGuardian = firstGuardian;
|
|
290
|
-
const sentinelValue = "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF";
|
|
291
|
-
while (
|
|
292
|
-
nextGuardian.toLowerCase() !== sentinelValue.toLowerCase()
|
|
293
|
-
) {
|
|
290
|
+
const sentinelValue = "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF";
|
|
291
|
+
while (nextGuardian.toLowerCase() !== sentinelValue.toLowerCase()) {
|
|
294
292
|
const guardianStorage = await publicClient.readContract({
|
|
295
293
|
abi: WeightedValidatorAbi,
|
|
296
294
|
address: RECOVERY_VALIDATOR_ADDRESS,
|
|
@@ -434,7 +432,7 @@ export class RecoveryValidator extends KernelBaseValidator {
|
|
|
434
432
|
if (this.isSignerSmartContract) {
|
|
435
433
|
return this.signatures ?? DUMMY_ECDSA_SIG;
|
|
436
434
|
}
|
|
437
|
-
|
|
435
|
+
|
|
438
436
|
const hash = getUserOperationHash(
|
|
439
437
|
{
|
|
440
438
|
...userOp,
|