diff --git a/server/api/contract/extensions/accountFactory/write/createAccount.ts b/server/api/contract/extensions/accountFactory/write/createAccount.ts index 2b63b95f5..d34b9fa3a 100644 --- a/server/api/contract/extensions/accountFactory/write/createAccount.ts +++ b/server/api/contract/extensions/accountFactory/write/createAccount.ts @@ -6,8 +6,8 @@ import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { contractParamSchema, standardResponseSchema, - transactionWritesResponseSchema, } from "../../../../../helpers"; +import { prebuiltDeployResponseSchema } from "../../../../../schemas/prebuilts"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; @@ -25,7 +25,7 @@ const BodySchema = Type.Object({ export const createAccount = async (fastify: FastifyInstance) => { fastify.route<{ Params: Static; - Reply: Static; + Reply: Static; Body: Static; }>({ method: "POST", @@ -39,7 +39,7 @@ export const createAccount = async (fastify: FastifyInstance) => { body: BodySchema, response: { ...standardResponseSchema, - [StatusCodes.OK]: transactionWritesResponseSchema, + [StatusCodes.OK]: prebuiltDeployResponseSchema, }, }, handler: async (req, rep) => { @@ -59,14 +59,24 @@ export const createAccount = async (fastify: FastifyInstance) => { admin_address, extra_data, ); - const queueId = await queueTx({ + const deployedAddress = + await contract.accountFactory.predictAccountAddress( + admin_address, + extra_data, + ); + const queuedId = await queueTx({ tx, chainId, extension: "account-factory", + deployedContractAddress: deployedAddress, + deployedContractType: "account", }); rep.status(StatusCodes.OK).send({ - result: queueId, + result: { + queuedId, + deployedAddress, + }, }); }, });