@latticexyz/common 2.2.23 → 2.2.24-38fee1657dd544e31a8ea005836205dc3f8dfdd0
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/internal.d.ts +9 -1
- package/dist/internal.js +39 -0
- package/dist/internal.js.map +1 -1
- package/package.json +2 -2
package/dist/internal.d.ts
CHANGED
|
@@ -43,6 +43,14 @@ type WiresawOptions<transport extends Transport> = {
|
|
|
43
43
|
};
|
|
44
44
|
declare function wiresaw<const wiresawTransport extends Transport>(transports?: WiresawOptions<wiresawTransport>): wiresawTransport;
|
|
45
45
|
|
|
46
|
+
type AltoOptions<transport extends Transport> = {
|
|
47
|
+
/** alto-compatible transport */
|
|
48
|
+
altoTransport: transport;
|
|
49
|
+
/** fallback transport for all other RPC methods */
|
|
50
|
+
fallbackDefaultTransport?: Transport;
|
|
51
|
+
};
|
|
52
|
+
declare function alto<const altoTransport extends Transport>(transports?: AltoOptions<altoTransport>): altoTransport;
|
|
53
|
+
|
|
46
54
|
declare function getUserOperationReceipt(userOpHash: Hex, receipt: RpcTransactionReceipt): RpcUserOperationReceipt;
|
|
47
55
|
|
|
48
|
-
export { type Contract, ensureContract, ensureContractsDeployed, ensureDeployer, getContractAddress, getDeployer, getUserOperationReceipt, waitForTransactions, wiresaw };
|
|
56
|
+
export { type Contract, alto, ensureContract, ensureContractsDeployed, ensureDeployer, getContractAddress, getDeployer, getUserOperationReceipt, waitForTransactions, wiresaw };
|
package/dist/internal.js
CHANGED
|
@@ -585,7 +585,46 @@ function getDefaultTransports(chain) {
|
|
|
585
585
|
fallbackDefaultTransport: http2()
|
|
586
586
|
};
|
|
587
587
|
}
|
|
588
|
+
|
|
589
|
+
// src/transports/alto.ts
|
|
590
|
+
import { http as http3 } from "viem";
|
|
591
|
+
function alto(transports) {
|
|
592
|
+
return (opts) => {
|
|
593
|
+
const { altoTransport } = transports ?? getDefaultTransports2(opts.chain);
|
|
594
|
+
const { request: altoRequest, ...rest } = altoTransport(opts);
|
|
595
|
+
return {
|
|
596
|
+
...rest,
|
|
597
|
+
// TODO: type `request` so we don't have to cast
|
|
598
|
+
async request(req) {
|
|
599
|
+
if (req.method === "eth_sendUserOperation") {
|
|
600
|
+
console.log("sending user operation via pimlico_sendUserOperationNow", req);
|
|
601
|
+
const result = await altoRequest({
|
|
602
|
+
...req,
|
|
603
|
+
method: "pimlico_sendUserOperationNow"
|
|
604
|
+
});
|
|
605
|
+
console.log("pimlico_sendUserOperationNow", result);
|
|
606
|
+
return result;
|
|
607
|
+
}
|
|
608
|
+
return await altoRequest(req);
|
|
609
|
+
}
|
|
610
|
+
};
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
function getDefaultTransports2(chain) {
|
|
614
|
+
if (!chain) {
|
|
615
|
+
throw new Error("No chain or transports provided");
|
|
616
|
+
}
|
|
617
|
+
const altoTransport = chainTransport(chain.rpcUrls.alto);
|
|
618
|
+
if (!altoTransport) {
|
|
619
|
+
throw new Error("Provided chain does not support alto");
|
|
620
|
+
}
|
|
621
|
+
return {
|
|
622
|
+
altoTransport,
|
|
623
|
+
fallbackDefaultTransport: http3()
|
|
624
|
+
};
|
|
625
|
+
}
|
|
588
626
|
export {
|
|
627
|
+
alto,
|
|
589
628
|
ensureContract,
|
|
590
629
|
ensureContractsDeployed,
|
|
591
630
|
ensureDeployer,
|
package/dist/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/waitForTransactions.ts","../src/deploy/ensureContract.ts","../src/deploy/common.ts","../src/deploy/debug.ts","../src/deploy/ensureContractsDeployed.ts","../src/deploy/ensureDeployer.ts","../src/deploy/create2/deployment.json","../src/deploy/getDeployer.ts","../src/deploy/getContractAddress.ts","../src/transports/wiresaw.ts","../src/transports/methods/estimateUserOperationGas.ts","../src/transports/entryPointGasSimulations.ts","../src/transports/methods/getUserOperationReceipt.ts","../src/transports/chainTransport.ts"],"sourcesContent":["import { Client, Transport, Chain, Account, Hex } from \"viem\";\nimport { debug } from \"./debug\";\nimport { waitForTransactionReceipt } from \"viem/actions\";\n\nexport async function waitForTransactions({\n client,\n hashes,\n debugLabel = \"transactions\",\n}: {\n readonly client: Client<Transport, Chain | undefined, Account>;\n readonly hashes: readonly Hex[];\n readonly debugLabel?: string;\n}): Promise<void> {\n if (!hashes.length) return;\n\n debug(`waiting for ${debugLabel} to confirm`);\n // wait for each tx separately/serially, because parallelizing results in RPC errors\n for (const hash of hashes) {\n const receipt = await waitForTransactionReceipt(client, { hash });\n // TODO: handle user op failures?\n if (receipt.status === \"reverted\") {\n throw new Error(`Transaction reverted: ${hash}`);\n }\n }\n}\n","import { Client, Transport, Chain, Account, concatHex, getCreate2Address, Hex } from \"viem\";\nimport { getCode } from \"viem/actions\";\nimport { contractSizeLimit, singletonSalt } from \"./common\";\nimport { debug } from \"./debug\";\nimport { sendTransaction } from \"../sendTransaction\";\n\nexport type Contract = {\n bytecode: Hex;\n deployedBytecodeSize?: number;\n debugLabel?: string;\n salt?: Hex;\n};\n\nexport async function ensureContract({\n client,\n deployerAddress,\n bytecode,\n deployedBytecodeSize,\n debugLabel = \"contract\",\n salt = singletonSalt,\n}: {\n readonly client: Client<Transport, Chain | undefined, Account>;\n readonly deployerAddress: Hex;\n} & Contract): Promise<readonly Hex[]> {\n if (bytecode.includes(\"__$\")) {\n throw new Error(`Found unlinked public library in ${debugLabel} bytecode`);\n }\n\n const address = getCreate2Address({ from: deployerAddress, salt, bytecode });\n\n const contractCode = await getCode(client, { address, blockTag: \"pending\" });\n if (contractCode) {\n debug(\"found\", debugLabel, \"at\", address);\n return [];\n }\n\n if (deployedBytecodeSize != null) {\n if (deployedBytecodeSize === 0) {\n throw new Error(`Empty bytecode for ${debugLabel}`);\n }\n\n if (deployedBytecodeSize > contractSizeLimit) {\n console.warn(\n `\\nBytecode for ${debugLabel} (${deployedBytecodeSize} bytes) is over the contract size limit (${contractSizeLimit} bytes). Run \\`forge build --sizes\\` for more info.\\n`,\n );\n } else if (deployedBytecodeSize > contractSizeLimit * 0.95) {\n console.warn(\n // eslint-disable-next-line max-len\n `\\nBytecode for ${debugLabel} (${deployedBytecodeSize} bytes) is almost over the contract size limit (${contractSizeLimit} bytes). Run \\`forge build --sizes\\` for more info.\\n`,\n );\n }\n }\n\n debug(\"deploying\", debugLabel, \"at\", address);\n return [\n await sendTransaction(client, {\n chain: client.chain ?? null,\n to: deployerAddress,\n data: concatHex([salt, bytecode]),\n }),\n ];\n}\n","import { stringToHex } from \"viem\";\n\n// salt for deterministic deploys of singleton contracts\nexport const singletonSalt = stringToHex(\"\", { size: 32 });\n\n// https://eips.ethereum.org/EIPS/eip-170\nexport const contractSizeLimit = parseInt(\"6000\", 16);\n","import { debug as parentDebug } from \"../debug\";\n\nexport const debug = parentDebug.extend(\"deploy\");\nexport const error = parentDebug.extend(\"deploy\");\n\n// Pipe debug output to stdout instead of stderr\ndebug.log = console.debug.bind(console);\n\n// Pipe error output to stderr\nerror.log = console.error.bind(console);\n","import { Client, Transport, Chain, Account, Hex } from \"viem\";\nimport { Contract, ensureContract } from \"./ensureContract\";\nimport { waitForTransactions } from \"../waitForTransactions\";\nimport { uniqueBy } from \"../utils/uniqueBy\";\n\nexport async function ensureContractsDeployed({\n client,\n deployerAddress,\n contracts,\n}: {\n readonly client: Client<Transport, Chain | undefined, Account>;\n readonly deployerAddress: Hex;\n readonly contracts: readonly Contract[];\n}): Promise<readonly Hex[]> {\n // Deployments assume a deterministic deployer, so we only need to deploy the unique bytecode\n const uniqueContracts = uniqueBy(contracts, (contract) => contract.bytecode);\n\n const txs = (\n await Promise.all(uniqueContracts.map((contract) => ensureContract({ client, deployerAddress, ...contract })))\n ).flat();\n\n await waitForTransactions({\n client,\n hashes: txs,\n debugLabel: \"contract deploys\",\n });\n\n return txs;\n}\n","import { Account, Address, Chain, Client, Transport } from \"viem\";\nimport { getBalance, sendRawTransaction, sendTransaction, waitForTransactionReceipt } from \"viem/actions\";\nimport deployment from \"./create2/deployment.json\";\nimport { debug } from \"./debug\";\nimport { getDeployer } from \"./getDeployer\";\n\nconst deployer = `0x${deployment.address}` as const;\n\nexport async function ensureDeployer(client: Client<Transport, Chain | undefined, Account>): Promise<Address> {\n const existingDeployer = await getDeployer(client);\n if (existingDeployer !== undefined) {\n return existingDeployer;\n }\n\n // There's not really a way to simulate a pre-EIP-155 (no chain ID) transaction,\n // so we have to attempt to create the deployer first and, if it fails, fall back\n // to a regular deploy.\n\n // Send gas to deployment signer\n const gasRequired = BigInt(deployment.gasLimit) * BigInt(deployment.gasPrice);\n const currentBalance = await getBalance(client, { address: `0x${deployment.signerAddress}` });\n const gasNeeded = gasRequired - currentBalance;\n if (gasNeeded > 0) {\n debug(\"sending gas for CREATE2 deployer to signer at\", deployment.signerAddress);\n const gasTx = await sendTransaction(client, {\n chain: client.chain ?? null,\n to: `0x${deployment.signerAddress}`,\n value: gasNeeded,\n });\n const gasReceipt = await waitForTransactionReceipt(client, { hash: gasTx });\n if (gasReceipt.status !== \"success\") {\n console.error(\"failed to send gas to deployer signer\", gasReceipt);\n throw new Error(\"failed to send gas to deployer signer\");\n }\n }\n\n // Deploy the deployer\n debug(\"deploying CREATE2 deployer at\", deployer);\n const deployTx = await sendRawTransaction(client, { serializedTransaction: `0x${deployment.transaction}` }).catch(\n (error) => {\n // Do a regular contract create if the presigned transaction doesn't work due to replay protection\n if (String(error).includes(\"only replay-protected (EIP-155) transactions allowed over RPC\")) {\n console.warn(\n // eslint-disable-next-line max-len\n `\\n ⚠️ Your chain or RPC does not allow for non EIP-155 signed transactions, so your deploys will not be determinstic and contract addresses may change between deploys.\\n\\n We recommend running your chain's node with \\`--rpc.allow-unprotected-txs\\` to enable determinstic deployments.\\n`,\n );\n debug(\"deploying CREATE2 deployer\");\n return sendTransaction(client, {\n chain: client.chain ?? null,\n data: `0x${deployment.creationCode}`,\n });\n }\n throw error;\n },\n );\n\n const deployReceipt = await waitForTransactionReceipt(client, { hash: deployTx });\n if (!deployReceipt.contractAddress) {\n throw new Error(\"Deploy receipt did not have contract address, was the deployer not deployed?\");\n }\n\n if (deployReceipt.contractAddress !== deployer) {\n console.warn(\n `\\n ⚠️ CREATE2 deployer created at ${deployReceipt.contractAddress} does not match the CREATE2 determinstic deployer we expected (${deployer})`,\n );\n }\n\n return deployReceipt.contractAddress;\n}\n","{\n \"gasPrice\": 100000000000,\n \"gasLimit\": 100000,\n \"signerAddress\": \"3fab184622dc19b6109349b94811493bf2a45362\",\n \"transaction\": \"f8a58085174876e800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf31ba02222222222222222222222222222222222222222222222222222222222222222a02222222222222222222222222222222222222222222222222222222222222222\",\n \"address\": \"4e59b44847b379578588920ca78fbf26c0b4956c\",\n \"creationCode\": \"604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3\"\n}\n","import { Address, Chain, Client, Transport, sliceHex } from \"viem\";\nimport { getCode } from \"viem/actions\";\nimport deployment from \"./create2/deployment.json\";\nimport { debug } from \"./debug\";\n\nconst deployer = `0x${deployment.address}` as const;\n\nexport async function getDeployer(client: Client<Transport, Chain | undefined>): Promise<Address | undefined> {\n const bytecode = await getCode(client, { address: deployer });\n if (bytecode) {\n debug(\"found deployer bytecode at\", deployer);\n // check if deployed bytecode is the same as the expected bytecode (minus 14-bytes creation code prefix)\n if (bytecode !== sliceHex(`0x${deployment.creationCode}`, 14)) {\n console.warn(\n `\\n ⚠️ Bytecode for deployer at ${deployer} did not match the expected CREATE2 bytecode. You may have unexpected results.\\n`,\n );\n }\n return deployer;\n }\n}\n","import { Hex, getCreate2Address } from \"viem\";\nimport { singletonSalt } from \"./common\";\n\nexport function getContractAddress({\n deployerAddress,\n bytecode,\n salt = singletonSalt,\n}: {\n readonly deployerAddress: Hex;\n readonly bytecode: Hex;\n readonly salt?: Hex;\n}): Hex {\n return getCreate2Address({ from: deployerAddress, bytecode, salt });\n}\n","import { Chain, EIP1193RequestFn, Hex, http, RpcTransactionReceipt, Transport } from \"viem\";\nimport { estimateUserOperationGas } from \"./methods/estimateUserOperationGas\";\nimport { getUserOperationReceipt } from \"./methods/getUserOperationReceipt\";\nimport { chainTransport } from \"./chainTransport\";\n\ntype WiresawSendUserOperationResult = {\n txHash: Hex;\n userOpHash: Hex;\n};\n\ntype WiresawOptions<transport extends Transport> = {\n /** wiresaw-compatible transport */\n wiresawTransport: transport;\n /** fallback transport for bundler RPC methods */\n fallbackBundlerTransport?: Transport;\n /** fallback transport for all other RPC methods */\n fallbackDefaultTransport?: Transport;\n};\n\nexport function wiresaw<const wiresawTransport extends Transport>(\n transports?: WiresawOptions<wiresawTransport>,\n): wiresawTransport {\n return ((opts) => {\n const { wiresawTransport, fallbackBundlerTransport, fallbackDefaultTransport } =\n transports ?? getDefaultTransports(opts.chain);\n\n const { request: wiresawRequest, ...rest } = wiresawTransport(opts);\n\n let chainId: Hex | null = null;\n const transactionHashes: { [userOpHash: Hex]: Hex } = {};\n const transactionReceipts: { [transactionHashes: Hex]: RpcTransactionReceipt } = {};\n\n return {\n ...rest,\n // TODO: type `request` so we don't have to cast\n async request(req): ReturnType<EIP1193RequestFn> {\n try {\n if (req.method === \"eth_chainId\") {\n if (chainId != null) return chainId;\n if (fallbackDefaultTransport) {\n const { request: fallbackRequest } = fallbackDefaultTransport(opts);\n return (chainId = await fallbackRequest(req));\n }\n return (chainId = await wiresawRequest(req));\n }\n\n if (req.method === \"eth_estimateGas\") {\n return await wiresawRequest({ ...req, method: \"wiresaw_estimateGas\" });\n }\n\n if (req.method === \"eth_call\") {\n return await wiresawRequest({ ...req, method: \"wiresaw_call\" });\n }\n\n if (req.method === \"eth_getTransactionCount\") {\n return await wiresawRequest({ ...req, method: \"wiresaw_getTransactionCount\" });\n }\n\n if (req.method === \"eth_getTransactionReceipt\") {\n return await getTransactionReceipt((req.params as [Hex])[0]);\n }\n\n if (req.method === \"eth_sendUserOperation\") {\n const { userOpHash, txHash } = (await wiresawRequest({\n ...req,\n method: \"wiresaw_sendUserOperation\",\n })) as WiresawSendUserOperationResult;\n transactionHashes[userOpHash] = txHash;\n return userOpHash;\n }\n\n if (req.method === \"eth_getUserOperationReceipt\") {\n const userOpHash = (req.params as [Hex])[0];\n const knownTransactionHash = transactionHashes[userOpHash];\n if (!knownTransactionHash) {\n throw new Error(`eth_getUserOperationReceipt only supported for own user operations`);\n }\n const transactionReceipt = await getTransactionReceipt(knownTransactionHash);\n return transactionReceipt && getUserOperationReceipt(userOpHash, transactionReceipt);\n }\n\n if (req.method === \"eth_estimateUserOperationGas\") {\n return await estimateUserOperationGas({\n request: wiresawRequest,\n params: req.params as never,\n });\n }\n\n // Fallback to regular RPC for methods that don't require wiresaw\n if (\n req.method === \"eth_blockNumber\" ||\n req.method === \"eth_getBlockByNumber\" ||\n req.method === \"eth_maxPriorityFeePerGas\"\n ) {\n if (fallbackDefaultTransport) {\n const { request: fallbackRequest } = fallbackDefaultTransport(opts);\n return await fallbackRequest(req);\n }\n return await wiresawRequest(req);\n }\n\n return await wiresawRequest(req);\n } catch (e) {\n console.warn(\"[wiresaw] request failed\", e);\n const bundlerMethods = [\n \"eth_estimateUserOperationGas\",\n \"eth_sendUserOperation\",\n \"eth_getUserOperationReceipt\",\n ];\n if (bundlerMethods.includes(req.method)) {\n if (fallbackBundlerTransport) {\n const { request: fallbackRequest } = fallbackBundlerTransport(opts);\n console.warn(\"[wiresaw] falling back to bundler rpc\", req);\n return fallbackRequest(req);\n }\n }\n if (fallbackDefaultTransport) {\n const { request: fallbackRequest } = fallbackDefaultTransport(opts);\n console.warn(\"[wiresaw] falling back to eth rpc\", req);\n return fallbackRequest(req);\n }\n throw e;\n }\n\n async function getTransactionReceipt(hash: Hex): Promise<RpcTransactionReceipt | undefined> {\n // Return cached receipt if available\n if (transactionReceipts[hash]) return transactionReceipts[hash];\n\n // Fetch pending receipt\n const pendingReceipt = (await wiresawRequest({\n ...req,\n method: \"wiresaw_getTransactionReceipt\",\n params: [hash],\n })) as RpcTransactionReceipt | undefined;\n if (pendingReceipt) {\n transactionReceipts[hash] = pendingReceipt;\n return pendingReceipt;\n }\n\n if (fallbackDefaultTransport) {\n const { request: fallbackRequest } = fallbackDefaultTransport(opts);\n const receipt = (await fallbackRequest({\n ...req,\n method: \"eth_getTransactionReceipt\",\n params: [hash],\n })) as RpcTransactionReceipt | undefined;\n if (receipt) {\n transactionReceipts[hash] = receipt;\n return receipt;\n }\n }\n }\n },\n };\n }) as wiresawTransport;\n}\n\nfunction getDefaultTransports(chain?: Chain): WiresawOptions<Transport> {\n if (!chain) {\n throw new Error(\"No chain or transports provided\");\n }\n\n const wiresawTransport = chainTransport(chain.rpcUrls.wiresaw);\n if (!wiresawTransport) {\n throw new Error(\"Provided chain does not support wiresaw\");\n }\n\n const bundlerHttpUrl = chain.rpcUrls.bundler?.http[0];\n return {\n wiresawTransport,\n fallbackBundlerTransport: bundlerHttpUrl ? http(bundlerHttpUrl) : undefined,\n fallbackDefaultTransport: http(),\n };\n}\n","import {\n BundlerRpcSchema,\n decodeFunctionResult,\n DecodeFunctionResultReturnType,\n EIP1193RequestFn,\n encodeFunctionData,\n Hex,\n zeroAddress,\n} from \"viem\";\nimport { getRpcMethod } from \"../common\";\nimport {\n entryPoint07Address,\n formatUserOperation,\n formatUserOperationRequest,\n toPackedUserOperation,\n UserOperation,\n} from \"viem/account-abstraction\";\nimport { bigIntMax } from \"../../utils\";\nimport { entryPointGasSimulationsAbi } from \"../entryPointGasSimulations\";\n\ntype rpcMethod = getRpcMethod<BundlerRpcSchema, \"eth_estimateUserOperationGas\">;\n\ntype EstimateUserOperationGasOptions = {\n request: EIP1193RequestFn;\n params: rpcMethod[\"Parameters\"];\n};\n\nexport async function estimateUserOperationGas({\n request,\n params,\n}: EstimateUserOperationGasOptions): Promise<rpcMethod[\"ReturnType\"]> {\n const userOp = formatUserOperation(params[0]);\n const gasSimulation = await simulateGas({ userOp, request });\n const gasLimits = {\n verificationGasLimit: gasSimulation.verificationGas * 2n,\n callGasLimit: bigIntMax(gasSimulation.callGas * 2n, 9000n),\n paymasterVerificationGasLimit: gasSimulation.paymasterVerificationGas * 2n,\n paymasterPostOpGasLimit: gasSimulation.paymasterPostOpGas * 2n,\n preVerificationGas: 20_000n,\n };\n\n return formatUserOperationRequest({\n ...gasLimits,\n });\n}\n\ntype SimulateGasOptions = {\n request: EIP1193RequestFn;\n userOp: UserOperation<\"0.7\">;\n};\n\ntype SimulateGasResult = DecodeFunctionResultReturnType<typeof entryPointGasSimulationsAbi>;\n\nasync function simulateGas({ request, userOp }: SimulateGasOptions): Promise<SimulateGasResult> {\n // Prepare user operation for simulation\n const simulationUserOp = {\n ...userOp,\n preVerificationGas: 0n,\n callGasLimit: 10_000_000n,\n verificationGasLimit: 10_000_000n,\n // https://github.com/pimlicolabs/alto/blob/471998695e5ec75ef88dda3f8a534f47c24bcd1a/src/rpc/methods/eth_estimateUserOperationGas.ts#L117\n maxPriorityFeePerGas: userOp.maxFeePerGas,\n paymasterPostOpGasLimit: 2_000_000n,\n paymasterVerificationGasLimit: 5_000_000n,\n } satisfies UserOperation<\"0.7\">;\n\n const packedUserOp = toPackedUserOperation(simulationUserOp);\n const simulationData = encodeFunctionData({\n abi: entryPointGasSimulationsAbi,\n functionName: \"estimateGas\",\n args: [packedUserOp],\n });\n\n const hasPaymaster = userOp.paymaster != null && userOp.paymaster !== zeroAddress;\n const senderBalanceOverride = hasPaymaster ? {} : { [userOp.sender]: { balance: \"0xFFFFFFFFFFFFFFFFFFFF\" } };\n const simulationParams = [\n {\n to: entryPoint07Address,\n data: simulationData,\n },\n \"pending\",\n {\n ...senderBalanceOverride,\n },\n ];\n const encodedSimulationResult: Hex = await request({\n method: \"wiresaw_callEntryPointSimulations\",\n params: simulationParams,\n });\n\n return decodeFunctionResult({\n abi: entryPointGasSimulationsAbi,\n functionName: \"estimateGas\",\n data: encodedSimulationResult,\n });\n}\n","export const entryPointGasSimulationsAbi = [\n {\n inputs: [\n {\n components: [\n {\n internalType: \"address\",\n name: \"sender\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n {\n internalType: \"bytes\",\n name: \"initCode\",\n type: \"bytes\",\n },\n {\n internalType: \"bytes\",\n name: \"callData\",\n type: \"bytes\",\n },\n {\n internalType: \"bytes32\",\n name: \"accountGasLimits\",\n type: \"bytes32\",\n },\n {\n internalType: \"uint256\",\n name: \"preVerificationGas\",\n type: \"uint256\",\n },\n {\n internalType: \"bytes32\",\n name: \"gasFees\",\n type: \"bytes32\",\n },\n {\n internalType: \"bytes\",\n name: \"paymasterAndData\",\n type: \"bytes\",\n },\n {\n internalType: \"bytes\",\n name: \"signature\",\n type: \"bytes\",\n },\n ],\n internalType: \"struct PackedUserOperation\",\n name: \"op\",\n type: \"tuple\",\n },\n ],\n name: \"estimateGas\",\n outputs: [\n {\n components: [\n {\n internalType: \"uint256\",\n name: \"verificationGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"callGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"paymasterVerificationGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"paymasterPostOpGas\",\n type: \"uint256\",\n },\n ],\n internalType: \"struct EntryPoint.GasInfo\",\n name: \"\",\n type: \"tuple\",\n },\n ],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n] as const;\n","import {\n Address,\n ExtractAbiItem,\n Hex,\n RpcTransactionReceipt,\n RpcUserOperationReceipt,\n decodeEventLog,\n encodeEventTopics,\n numberToHex,\n parseEventLogs,\n zeroAddress,\n} from \"viem\";\nimport { entryPoint07Abi } from \"viem/account-abstraction\";\n\nconst userOperationRevertReasonAbi = [\n entryPoint07Abi.find(\n (item): item is ExtractAbiItem<typeof entryPoint07Abi, \"UserOperationRevertReason\"> =>\n item.type === \"event\" && item.name === \"UserOperationRevertReason\",\n )!,\n] as const;\n\nconst userOperationEventTopic = encodeEventTopics({\n abi: entryPoint07Abi,\n eventName: \"UserOperationEvent\",\n});\n\nexport function getUserOperationReceipt(userOpHash: Hex, receipt: RpcTransactionReceipt): RpcUserOperationReceipt {\n const userOperationRevertReasonTopicEvent = encodeEventTopics({\n abi: userOperationRevertReasonAbi,\n })[0];\n\n let entryPoint: Address = zeroAddress;\n let revertReason = undefined;\n\n let startIndex = -1;\n let endIndex = -1;\n receipt.logs.forEach((log, index) => {\n if (log?.topics[0] === userOperationEventTopic[0]) {\n // process UserOperationEvent\n if (log.topics[1] === userOpHash) {\n // it's our userOpHash. save as end of logs array\n endIndex = index;\n entryPoint = log.address;\n } else if (endIndex === -1) {\n // it's a different hash. remember it as beginning index, but only if we didn't find our end index yet.\n startIndex = index;\n }\n }\n\n if (log?.topics[0] === userOperationRevertReasonTopicEvent) {\n // process UserOperationRevertReason\n if (log.topics[1] === userOpHash) {\n // it's our userOpHash. capture revert reason.\n const decodedLog = decodeEventLog({\n abi: userOperationRevertReasonAbi,\n data: log.data,\n topics: log.topics,\n });\n\n revertReason = decodedLog.args.revertReason;\n }\n }\n });\n\n if (endIndex === -1) {\n throw new Error(\"fatal: no UserOperationEvent in logs\");\n }\n\n const logs = receipt.logs.slice(startIndex + 1, endIndex);\n\n const userOperationEvent = parseEventLogs({\n abi: entryPoint07Abi,\n eventName: \"UserOperationEvent\",\n args: {\n userOpHash,\n },\n logs: receipt.logs,\n })[0]!;\n\n let paymaster: Address | undefined = userOperationEvent.args.paymaster;\n paymaster = paymaster === zeroAddress ? undefined : paymaster;\n\n return {\n userOpHash,\n entryPoint,\n sender: userOperationEvent.args.sender,\n nonce: numberToHex(userOperationEvent.args.nonce),\n paymaster,\n actualGasUsed: numberToHex(userOperationEvent.args.actualGasUsed),\n actualGasCost: numberToHex(userOperationEvent.args.actualGasCost),\n success: userOperationEvent.args.success,\n reason: revertReason,\n logs,\n receipt,\n };\n}\n","import { Chain, fallback, http, Transport, webSocket } from \"viem\";\n\nexport function chainTransport(rpcUrls: Chain[\"rpcUrls\"][string]): Transport | undefined {\n const webSocketUrl = rpcUrls?.webSocket?.[0];\n const httpUrl = rpcUrls?.http[0];\n\n if (webSocketUrl) {\n return httpUrl ? fallback([webSocket(webSocketUrl), http(httpUrl)]) : webSocket(webSocketUrl);\n }\n\n if (httpUrl) {\n return http(httpUrl);\n }\n}\n"],"mappings":";;;;;;;;;;;;AAEA,SAAS,iCAAiC;AAE1C,eAAsB,oBAAoB;AAAA,EACxC;AAAA,EACA;AAAA,EACA,aAAa;AACf,GAIkB;AAChB,MAAI,CAAC,OAAO,OAAQ;AAEpB,QAAM,eAAe,UAAU,aAAa;AAE5C,aAAW,QAAQ,QAAQ;AACzB,UAAM,UAAU,MAAM,0BAA0B,QAAQ,EAAE,KAAK,CAAC;AAEhE,QAAI,QAAQ,WAAW,YAAY;AACjC,YAAM,IAAI,MAAM,yBAAyB,IAAI,EAAE;AAAA,IACjD;AAAA,EACF;AACF;;;ACxBA,SAA4C,WAAW,yBAA8B;AACrF,SAAS,eAAe;;;ACDxB,SAAS,mBAAmB;AAGrB,IAAM,gBAAgB,YAAY,IAAI,EAAE,MAAM,GAAG,CAAC;AAGlD,IAAM,oBAAoB,SAAS,QAAQ,EAAE;;;ACJ7C,IAAMA,SAAQ,MAAY,OAAO,QAAQ;AACzC,IAAM,QAAQ,MAAY,OAAO,QAAQ;AAGhDA,OAAM,MAAM,QAAQ,MAAM,KAAK,OAAO;AAGtC,MAAM,MAAM,QAAQ,MAAM,KAAK,OAAO;;;AFItC,eAAsB,eAAe;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,OAAO;AACT,GAGuC;AACrC,MAAI,SAAS,SAAS,KAAK,GAAG;AAC5B,UAAM,IAAI,MAAM,oCAAoC,UAAU,WAAW;AAAA,EAC3E;AAEA,QAAM,UAAU,kBAAkB,EAAE,MAAM,iBAAiB,MAA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AM,IAAI,MAAM,iCAAiC;AAAA,EACnD;AAEA,QAAM,mBAAmB,eAAe,MAAM,QAAQ,OAAO;AAC7D,MAAI,CAAC,kBAAkB;AACrB,UAAM,IAAI,MAAM,yCAAyC;AAAA,EAC3D;AAEA,QAAM,iBAAiB,MAAM,QAAQ,SAAS,KAAK,CAAC;AACpD,SAAO;AAAA,IACL;AAAA,IACA,0BAA0B,iBAAiBC,MAAK,cAAc,IAAI;AAAA,IAClE,0BAA0BA,MAAK;AAAA,EACjC;AACF;","names":["debug","debug","sendTransaction","waitForTransactionReceipt","getCode","getCode","debug","deployer","debug","sendTransaction","waitForTransactionReceipt","error","getCreate2Address","getCreate2Address","http","zeroAddress","http"]}
|
|
1
|
+
{"version":3,"sources":["../src/waitForTransactions.ts","../src/deploy/ensureContract.ts","../src/deploy/common.ts","../src/deploy/debug.ts","../src/deploy/ensureContractsDeployed.ts","../src/deploy/ensureDeployer.ts","../src/deploy/create2/deployment.json","../src/deploy/getDeployer.ts","../src/deploy/getContractAddress.ts","../src/transports/wiresaw.ts","../src/transports/methods/estimateUserOperationGas.ts","../src/transports/entryPointGasSimulations.ts","../src/transports/methods/getUserOperationReceipt.ts","../src/transports/chainTransport.ts","../src/transports/alto.ts"],"sourcesContent":["import { Client, Transport, Chain, Account, Hex } from \"viem\";\nimport { debug } from \"./debug\";\nimport { waitForTransactionReceipt } from \"viem/actions\";\n\nexport async function waitForTransactions({\n client,\n hashes,\n debugLabel = \"transactions\",\n}: {\n readonly client: Client<Transport, Chain | undefined, Account>;\n readonly hashes: readonly Hex[];\n readonly debugLabel?: string;\n}): Promise<void> {\n if (!hashes.length) return;\n\n debug(`waiting for ${debugLabel} to confirm`);\n // wait for each tx separately/serially, because parallelizing results in RPC errors\n for (const hash of hashes) {\n const receipt = await waitForTransactionReceipt(client, { hash });\n // TODO: handle user op failures?\n if (receipt.status === \"reverted\") {\n throw new Error(`Transaction reverted: ${hash}`);\n }\n }\n}\n","import { Client, Transport, Chain, Account, concatHex, getCreate2Address, Hex } from \"viem\";\nimport { getCode } from \"viem/actions\";\nimport { contractSizeLimit, singletonSalt } from \"./common\";\nimport { debug } from \"./debug\";\nimport { sendTransaction } from \"../sendTransaction\";\n\nexport type Contract = {\n bytecode: Hex;\n deployedBytecodeSize?: number;\n debugLabel?: string;\n salt?: Hex;\n};\n\nexport async function ensureContract({\n client,\n deployerAddress,\n bytecode,\n deployedBytecodeSize,\n debugLabel = \"contract\",\n salt = singletonSalt,\n}: {\n readonly client: Client<Transport, Chain | undefined, Account>;\n readonly deployerAddress: Hex;\n} & Contract): Promise<readonly Hex[]> {\n if (bytecode.includes(\"__$\")) {\n throw new Error(`Found unlinked public library in ${debugLabel} bytecode`);\n }\n\n const address = getCreate2Address({ from: deployerAddress, salt, bytecode });\n\n const contractCode = await getCode(client, { address, blockTag: \"pending\" });\n if (contractCode) {\n debug(\"found\", debugLabel, \"at\", address);\n return [];\n }\n\n if (deployedBytecodeSize != null) {\n if (deployedBytecodeSize === 0) {\n throw new Error(`Empty bytecode for ${debugLabel}`);\n }\n\n if (deployedBytecodeSize > contractSizeLimit) {\n console.warn(\n `\\nBytecode for ${debugLabel} (${deployedBytecodeSize} bytes) is over the contract size limit (${contractSizeLimit} bytes). Run \\`forge build --sizes\\` for more info.\\n`,\n );\n } else if (deployedBytecodeSize > contractSizeLimit * 0.95) {\n console.warn(\n // eslint-disable-next-line max-len\n `\\nBytecode for ${debugLabel} (${deployedBytecodeSize} bytes) is almost over the contract size limit (${contractSizeLimit} bytes). Run \\`forge build --sizes\\` for more info.\\n`,\n );\n }\n }\n\n debug(\"deploying\", debugLabel, \"at\", address);\n return [\n await sendTransaction(client, {\n chain: client.chain ?? null,\n to: deployerAddress,\n data: concatHex([salt, bytecode]),\n }),\n ];\n}\n","import { stringToHex } from \"viem\";\n\n// salt for deterministic deploys of singleton contracts\nexport const singletonSalt = stringToHex(\"\", { size: 32 });\n\n// https://eips.ethereum.org/EIPS/eip-170\nexport const contractSizeLimit = parseInt(\"6000\", 16);\n","import { debug as parentDebug } from \"../debug\";\n\nexport const debug = parentDebug.extend(\"deploy\");\nexport const error = parentDebug.extend(\"deploy\");\n\n// Pipe debug output to stdout instead of stderr\ndebug.log = console.debug.bind(console);\n\n// Pipe error output to stderr\nerror.log = console.error.bind(console);\n","import { Client, Transport, Chain, Account, Hex } from \"viem\";\nimport { Contract, ensureContract } from \"./ensureContract\";\nimport { waitForTransactions } from \"../waitForTransactions\";\nimport { uniqueBy } from \"../utils/uniqueBy\";\n\nexport async function ensureContractsDeployed({\n client,\n deployerAddress,\n contracts,\n}: {\n readonly client: Client<Transport, Chain | undefined, Account>;\n readonly deployerAddress: Hex;\n readonly contracts: readonly Contract[];\n}): Promise<readonly Hex[]> {\n // Deployments assume a deterministic deployer, so we only need to deploy the unique bytecode\n const uniqueContracts = uniqueBy(contracts, (contract) => contract.bytecode);\n\n const txs = (\n await Promise.all(uniqueContracts.map((contract) => ensureContract({ client, deployerAddress, ...contract })))\n ).flat();\n\n await waitForTransactions({\n client,\n hashes: txs,\n debugLabel: \"contract deploys\",\n });\n\n return txs;\n}\n","import { Account, Address, Chain, Client, Transport } from \"viem\";\nimport { getBalance, sendRawTransaction, sendTransaction, waitForTransactionReceipt } from \"viem/actions\";\nimport deployment from \"./create2/deployment.json\";\nimport { debug } from \"./debug\";\nimport { getDeployer } from \"./getDeployer\";\n\nconst deployer = `0x${deployment.address}` as const;\n\nexport async function ensureDeployer(client: Client<Transport, Chain | undefined, Account>): Promise<Address> {\n const existingDeployer = await getDeployer(client);\n if (existingDeployer !== undefined) {\n return existingDeployer;\n }\n\n // There's not really a way to simulate a pre-EIP-155 (no chain ID) transaction,\n // so we have to attempt to create the deployer first and, if it fails, fall back\n // to a regular deploy.\n\n // Send gas to deployment signer\n const gasRequired = BigInt(deployment.gasLimit) * BigInt(deployment.gasPrice);\n const currentBalance = await getBalance(client, { address: `0x${deployment.signerAddress}` });\n const gasNeeded = gasRequired - currentBalance;\n if (gasNeeded > 0) {\n debug(\"sending gas for CREATE2 deployer to signer at\", deployment.signerAddress);\n const gasTx = await sendTransaction(client, {\n chain: client.chain ?? null,\n to: `0x${deployment.signerAddress}`,\n value: gasNeeded,\n });\n const gasReceipt = await waitForTransactionReceipt(client, { hash: gasTx });\n if (gasReceipt.status !== \"success\") {\n console.error(\"failed to send gas to deployer signer\", gasReceipt);\n throw new Error(\"failed to send gas to deployer signer\");\n }\n }\n\n // Deploy the deployer\n debug(\"deploying CREATE2 deployer at\", deployer);\n const deployTx = await sendRawTransaction(client, { serializedTransaction: `0x${deployment.transaction}` }).catch(\n (error) => {\n // Do a regular contract create if the presigned transaction doesn't work due to replay protection\n if (String(error).includes(\"only replay-protected (EIP-155) transactions allowed over RPC\")) {\n console.warn(\n // eslint-disable-next-line max-len\n `\\n ⚠️ Your chain or RPC does not allow for non EIP-155 signed transactions, so your deploys will not be determinstic and contract addresses may change between deploys.\\n\\n We recommend running your chain's node with \\`--rpc.allow-unprotected-txs\\` to enable determinstic deployments.\\n`,\n );\n debug(\"deploying CREATE2 deployer\");\n return sendTransaction(client, {\n chain: client.chain ?? null,\n data: `0x${deployment.creationCode}`,\n });\n }\n throw error;\n },\n );\n\n const deployReceipt = await waitForTransactionReceipt(client, { hash: deployTx });\n if (!deployReceipt.contractAddress) {\n throw new Error(\"Deploy receipt did not have contract address, was the deployer not deployed?\");\n }\n\n if (deployReceipt.contractAddress !== deployer) {\n console.warn(\n `\\n ⚠️ CREATE2 deployer created at ${deployReceipt.contractAddress} does not match the CREATE2 determinstic deployer we expected (${deployer})`,\n );\n }\n\n return deployReceipt.contractAddress;\n}\n","{\n \"gasPrice\": 100000000000,\n \"gasLimit\": 100000,\n \"signerAddress\": \"3fab184622dc19b6109349b94811493bf2a45362\",\n \"transaction\": \"f8a58085174876e800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf31ba02222222222222222222222222222222222222222222222222222222222222222a02222222222222222222222222222222222222222222222222222222222222222\",\n \"address\": \"4e59b44847b379578588920ca78fbf26c0b4956c\",\n \"creationCode\": \"604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3\"\n}\n","import { Address, Chain, Client, Transport, sliceHex } from \"viem\";\nimport { getCode } from \"viem/actions\";\nimport deployment from \"./create2/deployment.json\";\nimport { debug } from \"./debug\";\n\nconst deployer = `0x${deployment.address}` as const;\n\nexport async function getDeployer(client: Client<Transport, Chain | undefined>): Promise<Address | undefined> {\n const bytecode = await getCode(client, { address: deployer });\n if (bytecode) {\n debug(\"found deployer bytecode at\", deployer);\n // check if deployed bytecode is the same as the expected bytecode (minus 14-bytes creation code prefix)\n if (bytecode !== sliceHex(`0x${deployment.creationCode}`, 14)) {\n console.warn(\n `\\n ⚠️ Bytecode for deployer at ${deployer} did not match the expected CREATE2 bytecode. You may have unexpected results.\\n`,\n );\n }\n return deployer;\n }\n}\n","import { Hex, getCreate2Address } from \"viem\";\nimport { singletonSalt } from \"./common\";\n\nexport function getContractAddress({\n deployerAddress,\n bytecode,\n salt = singletonSalt,\n}: {\n readonly deployerAddress: Hex;\n readonly bytecode: Hex;\n readonly salt?: Hex;\n}): Hex {\n return getCreate2Address({ from: deployerAddress, bytecode, salt });\n}\n","import { Chain, EIP1193RequestFn, Hex, http, RpcTransactionReceipt, Transport } from \"viem\";\nimport { estimateUserOperationGas } from \"./methods/estimateUserOperationGas\";\nimport { getUserOperationReceipt } from \"./methods/getUserOperationReceipt\";\nimport { chainTransport } from \"./chainTransport\";\n\ntype WiresawSendUserOperationResult = {\n txHash: Hex;\n userOpHash: Hex;\n};\n\ntype WiresawOptions<transport extends Transport> = {\n /** wiresaw-compatible transport */\n wiresawTransport: transport;\n /** fallback transport for bundler RPC methods */\n fallbackBundlerTransport?: Transport;\n /** fallback transport for all other RPC methods */\n fallbackDefaultTransport?: Transport;\n};\n\nexport function wiresaw<const wiresawTransport extends Transport>(\n transports?: WiresawOptions<wiresawTransport>,\n): wiresawTransport {\n return ((opts) => {\n const { wiresawTransport, fallbackBundlerTransport, fallbackDefaultTransport } =\n transports ?? getDefaultTransports(opts.chain);\n\n const { request: wiresawRequest, ...rest } = wiresawTransport(opts);\n\n let chainId: Hex | null = null;\n const transactionHashes: { [userOpHash: Hex]: Hex } = {};\n const transactionReceipts: { [transactionHashes: Hex]: RpcTransactionReceipt } = {};\n\n return {\n ...rest,\n // TODO: type `request` so we don't have to cast\n async request(req): ReturnType<EIP1193RequestFn> {\n try {\n if (req.method === \"eth_chainId\") {\n if (chainId != null) return chainId;\n if (fallbackDefaultTransport) {\n const { request: fallbackRequest } = fallbackDefaultTransport(opts);\n return (chainId = await fallbackRequest(req));\n }\n return (chainId = await wiresawRequest(req));\n }\n\n if (req.method === \"eth_estimateGas\") {\n return await wiresawRequest({ ...req, method: \"wiresaw_estimateGas\" });\n }\n\n if (req.method === \"eth_call\") {\n return await wiresawRequest({ ...req, method: \"wiresaw_call\" });\n }\n\n if (req.method === \"eth_getTransactionCount\") {\n return await wiresawRequest({ ...req, method: \"wiresaw_getTransactionCount\" });\n }\n\n if (req.method === \"eth_getTransactionReceipt\") {\n return await getTransactionReceipt((req.params as [Hex])[0]);\n }\n\n if (req.method === \"eth_sendUserOperation\") {\n const { userOpHash, txHash } = (await wiresawRequest({\n ...req,\n method: \"wiresaw_sendUserOperation\",\n })) as WiresawSendUserOperationResult;\n transactionHashes[userOpHash] = txHash;\n return userOpHash;\n }\n\n if (req.method === \"eth_getUserOperationReceipt\") {\n const userOpHash = (req.params as [Hex])[0];\n const knownTransactionHash = transactionHashes[userOpHash];\n if (!knownTransactionHash) {\n throw new Error(`eth_getUserOperationReceipt only supported for own user operations`);\n }\n const transactionReceipt = await getTransactionReceipt(knownTransactionHash);\n return transactionReceipt && getUserOperationReceipt(userOpHash, transactionReceipt);\n }\n\n if (req.method === \"eth_estimateUserOperationGas\") {\n return await estimateUserOperationGas({\n request: wiresawRequest,\n params: req.params as never,\n });\n }\n\n // Fallback to regular RPC for methods that don't require wiresaw\n if (\n req.method === \"eth_blockNumber\" ||\n req.method === \"eth_getBlockByNumber\" ||\n req.method === \"eth_maxPriorityFeePerGas\"\n ) {\n if (fallbackDefaultTransport) {\n const { request: fallbackRequest } = fallbackDefaultTransport(opts);\n return await fallbackRequest(req);\n }\n return await wiresawRequest(req);\n }\n\n return await wiresawRequest(req);\n } catch (e) {\n console.warn(\"[wiresaw] request failed\", e);\n const bundlerMethods = [\n \"eth_estimateUserOperationGas\",\n \"eth_sendUserOperation\",\n \"eth_getUserOperationReceipt\",\n ];\n if (bundlerMethods.includes(req.method)) {\n if (fallbackBundlerTransport) {\n const { request: fallbackRequest } = fallbackBundlerTransport(opts);\n console.warn(\"[wiresaw] falling back to bundler rpc\", req);\n return fallbackRequest(req);\n }\n }\n if (fallbackDefaultTransport) {\n const { request: fallbackRequest } = fallbackDefaultTransport(opts);\n console.warn(\"[wiresaw] falling back to eth rpc\", req);\n return fallbackRequest(req);\n }\n throw e;\n }\n\n async function getTransactionReceipt(hash: Hex): Promise<RpcTransactionReceipt | undefined> {\n // Return cached receipt if available\n if (transactionReceipts[hash]) return transactionReceipts[hash];\n\n // Fetch pending receipt\n const pendingReceipt = (await wiresawRequest({\n ...req,\n method: \"wiresaw_getTransactionReceipt\",\n params: [hash],\n })) as RpcTransactionReceipt | undefined;\n if (pendingReceipt) {\n transactionReceipts[hash] = pendingReceipt;\n return pendingReceipt;\n }\n\n if (fallbackDefaultTransport) {\n const { request: fallbackRequest } = fallbackDefaultTransport(opts);\n const receipt = (await fallbackRequest({\n ...req,\n method: \"eth_getTransactionReceipt\",\n params: [hash],\n })) as RpcTransactionReceipt | undefined;\n if (receipt) {\n transactionReceipts[hash] = receipt;\n return receipt;\n }\n }\n }\n },\n };\n }) as wiresawTransport;\n}\n\nfunction getDefaultTransports(chain?: Chain): WiresawOptions<Transport> {\n if (!chain) {\n throw new Error(\"No chain or transports provided\");\n }\n\n const wiresawTransport = chainTransport(chain.rpcUrls.wiresaw);\n if (!wiresawTransport) {\n throw new Error(\"Provided chain does not support wiresaw\");\n }\n\n const bundlerHttpUrl = chain.rpcUrls.bundler?.http[0];\n return {\n wiresawTransport,\n fallbackBundlerTransport: bundlerHttpUrl ? http(bundlerHttpUrl) : undefined,\n fallbackDefaultTransport: http(),\n };\n}\n","import {\n BundlerRpcSchema,\n decodeFunctionResult,\n DecodeFunctionResultReturnType,\n EIP1193RequestFn,\n encodeFunctionData,\n Hex,\n zeroAddress,\n} from \"viem\";\nimport { getRpcMethod } from \"../common\";\nimport {\n entryPoint07Address,\n formatUserOperation,\n formatUserOperationRequest,\n toPackedUserOperation,\n UserOperation,\n} from \"viem/account-abstraction\";\nimport { bigIntMax } from \"../../utils\";\nimport { entryPointGasSimulationsAbi } from \"../entryPointGasSimulations\";\n\ntype rpcMethod = getRpcMethod<BundlerRpcSchema, \"eth_estimateUserOperationGas\">;\n\ntype EstimateUserOperationGasOptions = {\n request: EIP1193RequestFn;\n params: rpcMethod[\"Parameters\"];\n};\n\nexport async function estimateUserOperationGas({\n request,\n params,\n}: EstimateUserOperationGasOptions): Promise<rpcMethod[\"ReturnType\"]> {\n const userOp = formatUserOperation(params[0]);\n const gasSimulation = await simulateGas({ userOp, request });\n const gasLimits = {\n verificationGasLimit: gasSimulation.verificationGas * 2n,\n callGasLimit: bigIntMax(gasSimulation.callGas * 2n, 9000n),\n paymasterVerificationGasLimit: gasSimulation.paymasterVerificationGas * 2n,\n paymasterPostOpGasLimit: gasSimulation.paymasterPostOpGas * 2n,\n preVerificationGas: 20_000n,\n };\n\n return formatUserOperationRequest({\n ...gasLimits,\n });\n}\n\ntype SimulateGasOptions = {\n request: EIP1193RequestFn;\n userOp: UserOperation<\"0.7\">;\n};\n\ntype SimulateGasResult = DecodeFunctionResultReturnType<typeof entryPointGasSimulationsAbi>;\n\nasync function simulateGas({ request, userOp }: SimulateGasOptions): Promise<SimulateGasResult> {\n // Prepare user operation for simulation\n const simulationUserOp = {\n ...userOp,\n preVerificationGas: 0n,\n callGasLimit: 10_000_000n,\n verificationGasLimit: 10_000_000n,\n // https://github.com/pimlicolabs/alto/blob/471998695e5ec75ef88dda3f8a534f47c24bcd1a/src/rpc/methods/eth_estimateUserOperationGas.ts#L117\n maxPriorityFeePerGas: userOp.maxFeePerGas,\n paymasterPostOpGasLimit: 2_000_000n,\n paymasterVerificationGasLimit: 5_000_000n,\n } satisfies UserOperation<\"0.7\">;\n\n const packedUserOp = toPackedUserOperation(simulationUserOp);\n const simulationData = encodeFunctionData({\n abi: entryPointGasSimulationsAbi,\n functionName: \"estimateGas\",\n args: [packedUserOp],\n });\n\n const hasPaymaster = userOp.paymaster != null && userOp.paymaster !== zeroAddress;\n const senderBalanceOverride = hasPaymaster ? {} : { [userOp.sender]: { balance: \"0xFFFFFFFFFFFFFFFFFFFF\" } };\n const simulationParams = [\n {\n to: entryPoint07Address,\n data: simulationData,\n },\n \"pending\",\n {\n ...senderBalanceOverride,\n },\n ];\n const encodedSimulationResult: Hex = await request({\n method: \"wiresaw_callEntryPointSimulations\",\n params: simulationParams,\n });\n\n return decodeFunctionResult({\n abi: entryPointGasSimulationsAbi,\n functionName: \"estimateGas\",\n data: encodedSimulationResult,\n });\n}\n","export const entryPointGasSimulationsAbi = [\n {\n inputs: [\n {\n components: [\n {\n internalType: \"address\",\n name: \"sender\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n {\n internalType: \"bytes\",\n name: \"initCode\",\n type: \"bytes\",\n },\n {\n internalType: \"bytes\",\n name: \"callData\",\n type: \"bytes\",\n },\n {\n internalType: \"bytes32\",\n name: \"accountGasLimits\",\n type: \"bytes32\",\n },\n {\n internalType: \"uint256\",\n name: \"preVerificationGas\",\n type: \"uint256\",\n },\n {\n internalType: \"bytes32\",\n name: \"gasFees\",\n type: \"bytes32\",\n },\n {\n internalType: \"bytes\",\n name: \"paymasterAndData\",\n type: \"bytes\",\n },\n {\n internalType: \"bytes\",\n name: \"signature\",\n type: \"bytes\",\n },\n ],\n internalType: \"struct PackedUserOperation\",\n name: \"op\",\n type: \"tuple\",\n },\n ],\n name: \"estimateGas\",\n outputs: [\n {\n components: [\n {\n internalType: \"uint256\",\n name: \"verificationGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"callGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"paymasterVerificationGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"paymasterPostOpGas\",\n type: \"uint256\",\n },\n ],\n internalType: \"struct EntryPoint.GasInfo\",\n name: \"\",\n type: \"tuple\",\n },\n ],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n] as const;\n","import {\n Address,\n ExtractAbiItem,\n Hex,\n RpcTransactionReceipt,\n RpcUserOperationReceipt,\n decodeEventLog,\n encodeEventTopics,\n numberToHex,\n parseEventLogs,\n zeroAddress,\n} from \"viem\";\nimport { entryPoint07Abi } from \"viem/account-abstraction\";\n\nconst userOperationRevertReasonAbi = [\n entryPoint07Abi.find(\n (item): item is ExtractAbiItem<typeof entryPoint07Abi, \"UserOperationRevertReason\"> =>\n item.type === \"event\" && item.name === \"UserOperationRevertReason\",\n )!,\n] as const;\n\nconst userOperationEventTopic = encodeEventTopics({\n abi: entryPoint07Abi,\n eventName: \"UserOperationEvent\",\n});\n\nexport function getUserOperationReceipt(userOpHash: Hex, receipt: RpcTransactionReceipt): RpcUserOperationReceipt {\n const userOperationRevertReasonTopicEvent = encodeEventTopics({\n abi: userOperationRevertReasonAbi,\n })[0];\n\n let entryPoint: Address = zeroAddress;\n let revertReason = undefined;\n\n let startIndex = -1;\n let endIndex = -1;\n receipt.logs.forEach((log, index) => {\n if (log?.topics[0] === userOperationEventTopic[0]) {\n // process UserOperationEvent\n if (log.topics[1] === userOpHash) {\n // it's our userOpHash. save as end of logs array\n endIndex = index;\n entryPoint = log.address;\n } else if (endIndex === -1) {\n // it's a different hash. remember it as beginning index, but only if we didn't find our end index yet.\n startIndex = index;\n }\n }\n\n if (log?.topics[0] === userOperationRevertReasonTopicEvent) {\n // process UserOperationRevertReason\n if (log.topics[1] === userOpHash) {\n // it's our userOpHash. capture revert reason.\n const decodedLog = decodeEventLog({\n abi: userOperationRevertReasonAbi,\n data: log.data,\n topics: log.topics,\n });\n\n revertReason = decodedLog.args.revertReason;\n }\n }\n });\n\n if (endIndex === -1) {\n throw new Error(\"fatal: no UserOperationEvent in logs\");\n }\n\n const logs = receipt.logs.slice(startIndex + 1, endIndex);\n\n const userOperationEvent = parseEventLogs({\n abi: entryPoint07Abi,\n eventName: \"UserOperationEvent\",\n args: {\n userOpHash,\n },\n logs: receipt.logs,\n })[0]!;\n\n let paymaster: Address | undefined = userOperationEvent.args.paymaster;\n paymaster = paymaster === zeroAddress ? undefined : paymaster;\n\n return {\n userOpHash,\n entryPoint,\n sender: userOperationEvent.args.sender,\n nonce: numberToHex(userOperationEvent.args.nonce),\n paymaster,\n actualGasUsed: numberToHex(userOperationEvent.args.actualGasUsed),\n actualGasCost: numberToHex(userOperationEvent.args.actualGasCost),\n success: userOperationEvent.args.success,\n reason: revertReason,\n logs,\n receipt,\n };\n}\n","import { Chain, fallback, http, Transport, webSocket } from \"viem\";\n\nexport function chainTransport(rpcUrls: Chain[\"rpcUrls\"][string]): Transport | undefined {\n const webSocketUrl = rpcUrls?.webSocket?.[0];\n const httpUrl = rpcUrls?.http[0];\n\n if (webSocketUrl) {\n return httpUrl ? fallback([webSocket(webSocketUrl), http(httpUrl)]) : webSocket(webSocketUrl);\n }\n\n if (httpUrl) {\n return http(httpUrl);\n }\n}\n","import { Chain, EIP1193RequestFn, Hex, http, Transport } from \"viem\";\nimport { chainTransport } from \"./chainTransport\";\n\ntype AltoSendUserOperationResultuest = {\n txHash: Hex;\n userOpHash: Hex;\n};\n\ntype AltoOptions<transport extends Transport> = {\n /** alto-compatible transport */\n altoTransport: transport;\n /** fallback transport for all other RPC methods */\n fallbackDefaultTransport?: Transport;\n};\n\nexport function alto<const altoTransport extends Transport>(transports?: AltoOptions<altoTransport>): altoTransport {\n return ((opts) => {\n const { altoTransport } = transports ?? getDefaultTransports(opts.chain);\n\n const { request: altoRequest, ...rest } = altoTransport(opts);\n\n return {\n ...rest,\n // TODO: type `request` so we don't have to cast\n async request(req): ReturnType<EIP1193RequestFn> {\n if (req.method === \"eth_sendUserOperation\") {\n console.log(\"sending user operation via pimlico_sendUserOperationNow\", req);\n const result = (await altoRequest({\n ...req,\n method: \"pimlico_sendUserOperationNow\",\n })) as AltoSendUserOperationResultuest;\n console.log(\"pimlico_sendUserOperationNow\", result);\n return result;\n }\n\n return await altoRequest(req);\n },\n };\n }) as altoTransport;\n}\n\nfunction getDefaultTransports(chain?: Chain): AltoOptions<Transport> {\n if (!chain) {\n throw new Error(\"No chain or transports provided\");\n }\n\n const altoTransport = chainTransport(chain.rpcUrls.alto);\n if (!altoTransport) {\n throw new Error(\"Provided chain does not support alto\");\n }\n\n return {\n altoTransport,\n fallbackDefaultTransport: http(),\n };\n}\n"],"mappings":";;;;;;;;;;;;AAEA,SAAS,iCAAiC;AAE1C,eAAsB,oBAAoB;AAAA,EACxC;AAAA,EACA;AAAA,EACA,aAAa;AACf,GAIkB;AAChB,MAAI,CAAC,OAAO,OAAQ;AAEpB,QAAM,eAAe,UAAU,aAAa;AAE5C,aAAW,QAAQ,QAAQ;AACzB,UAAM,UAAU,MAAM,0BAA0B,QAAQ,EAAE,KAAK,CAAC;AAEhE,QAAI,QAAQ,WAAW,YAAY;AACjC,YAAM,IAAI,MAAM,yBAAyB,IAAI,EAAE;AAAA,IACjD;AAAA,EACF;AACF;;;ACxBA,SAA4C,WAAW,yBAA8B;AACrF,SAAS,eAAe;;;ACDxB,SAAS,mBAAmB;AAGrB,IAAM,gBAAgB,YAAY,IAAI,EAAE,MAAM,GAAG,CAAC;AAGlD,IAAM,oBAAoB,SAAS,QAAQ,EAAE;;;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AAEA,eAAO,MAAM,YAAY,GAAG;AAAA,MAC9B;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAASA,sBAAqB,OAAuC;AACnE,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,iCAAiC;AAAA,EACnD;AAEA,QAAM,gBAAgB,eAAe,MAAM,QAAQ,IAAI;AACvD,MAAI,CAAC,eAAe;AAClB,UAAM,IAAI,MAAM,sCAAsC;AAAA,EACxD;AAEA,SAAO;AAAA,IACL;AAAA,IACA,0BAA0BC,MAAK;AAAA,EACjC;AACF;","names":["debug","debug","sendTransaction","waitForTransactionReceipt","getCode","getCode","debug","deployer","debug","sendTransaction","waitForTransactionReceipt","error","getCreate2Address","getCreate2Address","http","zeroAddress","http","http","getDefaultTransports","http"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@latticexyz/common",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.24-38fee1657dd544e31a8ea005836205dc3f8dfdd0",
|
|
4
4
|
"description": "Common low level logic shared between packages",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"p-retry": "^5.1.2",
|
|
70
70
|
"prettier": "3.2.5",
|
|
71
71
|
"prettier-plugin-solidity": "1.3.1",
|
|
72
|
-
"@latticexyz/schema-type": "2.2.
|
|
72
|
+
"@latticexyz/schema-type": "2.2.24-38fee1657dd544e31a8ea005836205dc3f8dfdd0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@types/debug": "^4.1.7",
|