@alchemy/aa-core
Version:
viem based SDK that enables interactions with ERC-4337 Smart Accounts. ABIs are based off the definitions generated in @account-abstraction/contracts
49 lines • 1.86 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const viem_1 = require("viem");
const EntryPointAbi_v6_js_1 = require("../abis/EntryPointAbi_v6.js");
const packUserOperation = (request) => {
const hashedInitCode = (0, viem_1.keccak256)(request.initCode);
const hashedCallData = (0, viem_1.keccak256)(request.callData);
const hashedPaymasterAndData = (0, viem_1.keccak256)(request.paymasterAndData);
return (0, viem_1.encodeAbiParameters)([
{ type: "address" },
{ type: "uint256" },
{ type: "bytes32" },
{ type: "bytes32" },
{ type: "uint256" },
{ type: "uint256" },
{ type: "uint256" },
{ type: "uint256" },
{ type: "uint256" },
{ type: "bytes32" },
], [
request.sender,
(0, viem_1.hexToBigInt)(request.nonce),
hashedInitCode,
hashedCallData,
(0, viem_1.hexToBigInt)(request.callGasLimit),
(0, viem_1.hexToBigInt)(request.verificationGasLimit),
(0, viem_1.hexToBigInt)(request.preVerificationGas),
(0, viem_1.hexToBigInt)(request.maxFeePerGas),
(0, viem_1.hexToBigInt)(request.maxPriorityFeePerGas),
hashedPaymasterAndData,
]);
};
exports.default = {
version: "0.6.0",
address: {
default: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
},
abi: EntryPointAbi_v6_js_1.EntryPointAbi_v6,
getUserOperationHash: (request, entryPointAddress, chainId) => {
const encoded = (0, viem_1.encodeAbiParameters)([{ type: "bytes32" }, { type: "address" }, { type: "uint256" }], [
(0, viem_1.keccak256)(packUserOperation(request)),
entryPointAddress,
BigInt(chainId),
]);
return (0, viem_1.keccak256)(encoded);
},
packUserOperation,
};
//# sourceMappingURL=0.6.js.map