hi, how do I get the deployed contract address if I deploy it with the ERC4337? In the tx.receipt I get contract address null... Thank you
Maybe you can precompute the address using CREATE2 rules.
well Im trying to, but the address I get is wrong/non-existent...
const deploy = async () => {
const client = createThirdwebClient({
clientId,
secretKey,
})
const personalAccount = privateKeyToAccount({
client,
privateKey: 'myPK',
})
const wallet = smartWallet({
chain: sepolia,
sponsorGas: true,
})
const smartAccount = await wallet.connect({
client,
personalAccount,
})
// const address = await deployContract({
// abi: abi as Abi,
// account: smartAccount,
// bytecode,
// chain: sepolia,
// client,
// constructorParams: { id: 0n, maxSupply: 100n, baseURI: '' },
// })
const salt = solidityPackedKeccak256(['address', 'uint256'], [smartAccount.address, sepolia.id])
const entryPointAddress = '0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789'
const iface = new Interface(abi)
const encodedArgs = iface.encodeDeploy([0n, 100n, ''])
const fullBytecode = bytecode.object + encodedArgs.slice(2)
const initCodeHash = keccak256(fullBytecode)
const contractAddress = getCreate2Address(entryPointAddress, salt, initCodeHash)
console.log(contractAddress)
const tx = await smartAccount.sendTransaction({
chainId: sepolia.id,
data: fullBytecode as any,
})
console.log(tx)
}
deploy()
maybe you could tell what I'm doing wrong?