TypeError: Cannot read properties of undefined (reading 'validateInputParameters')
sreeshmashaji opened this issue · 1 comments
import { ethers } from 'ethers'
import { SimpleAccountAPI,DeterministicDeployer } from '../src'
import { wrapProvider } from '@account-abstraction/sdk'
import { SampleRecipient__factory } from '@account-abstraction/utils'
import {IEntryPoint, SimpleAccountFactory__factory } from '@account-abstraction/contracts'
const abi=require('./abi')
const {HttpRpcClient,sendUserOpToBundler}=require("../src/HttpRpcClient")
const {ExecutionManager}=require('../../bundler/src/modules/ExecutionManager')
const { UserOpMethodHandler } =require('../../bundler/src/UserOpMethodHandler')
const { BundlerReputationParams, ReputationManager } =require( '../../bundler/src/modules/ReputationManager')
const { MempoolManager }= require( '../../bundler/src/modules/MempoolManager')
import { EntryPoint, EntryPoint__factory } from '@account-abstraction/contracts'
const { BundlerConfig } = require('../../bundler/src/BundlerConfig')
import { ValidationManager ,supportsDebugTraceCall} from '@account-abstraction/validation-manager'
const { BundleManager } =require('../../bundler/src/modules/BundleManager')
import {IEntryPoint__factory } from '@account-abstraction/utils'
import { parseEther } from 'ethers/lib/utils'
const { createSigner } =require('../../bundler/test/testUtils')
describe('SimpleAccountAPI', () => {
let provider = new ethers.providers.JsonRpcProvider("https://polygon-mumbai.g.alchemy.com/v2/HncKchA59IsmRnWlOMaNq3YYSCp5DIr0");
const private_key = "7a8daa8561f32e139966ac8d35359af89be277c8707aa630ce71f24bfa8c2fee"
const signer = new ethers.Wallet(private_key, provider)
let op:any;
const entryPointAddress = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
let factoryAddress:any;
let recipient:any;
let entryPoint:IEntryPoint
let config:any;
it('deploying', async () => {
recipient = await new SampleRecipient__factory(signer).deploy()
console.log("rec", recipient.address);
DeterministicDeployer.init(provider)
factoryAddress = await DeterministicDeployer.deploy(new SimpleAccountFactory__factory(), 0, [entryPointAddress])
console.log(factoryAddress)
entryPoint = IEntryPoint__factory.connect(entryPointAddress, provider)
})
it("userop creation",async function(){
const api = new SimpleAccountAPI({
provider,
entryPointAddress,
owner: signer,
factoryAddress
})
op = await api.createSignedUserOp({
target: recipient.address,
data: recipient.interface.encodeFunctionData('something', ['hello']),
gasLimit: 1e6
})
console.log(op)
})
it('send to bundler',async function(){
const config = {
chainId: await provider.getNetwork().then(net => net.chainId),
entryPointAddress,
bundlerUrl: 'http://localhost:3000/rpc'
}
const httpRpcClient = new HttpRpcClient(config.bundlerUrl, config.entryPointAddress, config.chainId)
const resp= await httpRpcClient.sendUserOpToBundler(op);
console.log("response",resp)
})
it ("send userop to mempool or attempt to bundle",async function() {
config = {
beneficiary: await signer.getAddress(),
entryPoint: entryPointAddress,
gasFactor: '0.2',
minBalance: '0',
mnemonic: '',
network: '',
port: '3000',
unsafe: !await supportsDebugTraceCall(provider as any),
autoBundleInterval: 0,
autoBundleMempoolSize: 0,
maxBundleGas: 5e6,
// minstake zero, since we don't fund deployer.
minStake: '0',
minUnstakeDelay: 0
}
// const unsafe =!await supportsDebugTraceCall(provider as any)
const repMgr = new ReputationManager(provider, BundlerReputationParams, parseEther(config.minStake), config.minUnstakeDelay)
const mempoolMgr = new MempoolManager(repMgr)
const validMgr = new ValidationManager(entryPoint ,config.unsafe)
const Bundlemngr = new BundleManager(entryPointAddress, mempoolMgr, validMgr, repMgr, config.beneficiary, parseEther(config.minBalance), config.maxBundleGas)
// console.log("bu",Bundlemngr);
const executionmanager=new ExecutionManager(mempoolMgr,Bundlemngr,validMgr);
// const bundlerSigner = await createSigner()
const _entryPoint = entryPoint.connect(signer)
const methodHandler = new UserOpMethodHandler(
executionmanager,
provider,
signer,
config,
_entryPoint
)
const a= await methodHandler.sendUserOperation(op, entryPointAddress)
console.log("send userop", a)
})
// })
when running const a= await methodHandler.sendUserOperation(op, entryPointAddress) this error occured: TypeError: Cannot read properties of undefined (reading 'validateInputParameters')
sorry for late response. if you still encounter an error, please provide exactly what test did you run, and with what command-line.