abi.map is not a function
sreeshmashaji opened this issue · 1 comments
sreeshmashaji commented
import { ethers } from 'ethers'
import { wrapProvider } from '@account-abstraction/sdk'
// import { wrapProvider } from '@account-abstraction/sdk'
import { DeterministicDeployer, SimpleAccountAPI} from '../src'
import { SampleRecipient__factory } from '@account-abstraction/utils'
import { SimpleAccountFactory__factory } from '@account-abstraction/contracts';
const abi=require('./abi')
describe('SimpleAccountAPI', () => {
let provider = new ethers.providers.JsonRpcProvider("http://127.0.0.1:8545");
const signer = provider.getSigner();
it('init', async () => {
const entryPointAddress = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
const recipient = await new SampleRecipient__factory(signer).deploy()
console.log("rec", recipient.address);
DeterministicDeployer.init(provider)
const factoryAddress = await DeterministicDeployer.deploy(new SimpleAccountFactory__factory(), 0, [entryPointAddress])
// console.log(factoryAddress)
const api = new SimpleAccountAPI({
provider,
entryPointAddress,
owner: signer,
factoryAddress
})
const op = await api.createSignedUserOp({
target: recipient.address,
data: recipient.interface.encodeFunctionData('something', ['hello']),
gasLimit: 1e6
})
console.log(op)
})
it("next phase", async function () {
const entryPointAddress="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";
const aaSigner = signer
const config = {
chainId: await provider.getNetwork().then(net => net.chainId),
entryPointAddress,
bundlerUrl: 'http://localhost:3000/rpc'
}
const aaProvider = await wrapProvider(provider, config, aaSigner)
const walletAddress = await aaProvider.getSigner().getAddress()
// console.log("wallwt",aaProvider);
// send some eth to the wallet Address: wallet should have some balance to pay for its own creation, and for calling methods.
// console.log(abi)
const myContract = new ethers.Contract(abi, aaProvider)
// this method will get called from the wallet address, through account-abstraction EntryPoint
await myContract.something("hey")
})
})
when running this test it failed with an error message that abi.map( ) is not a function
drortirosh commented
I guess that the abi you import is not an array.