@@ -6,8 +6,8 @@ import { queueTx } from "../../../../../../src/db/transactions/queueTx";
6
6
import {
7
7
contractParamSchema ,
8
8
standardResponseSchema ,
9
- transactionWritesResponseSchema ,
10
9
} from "../../../../../helpers" ;
10
+ import { prebuiltDeployResponseSchema } from "../../../../../schemas/prebuilts" ;
11
11
import { getChainIdFromChain } from "../../../../../utilities/chain" ;
12
12
import { getContract } from "../../../../../utils/cache/getContract" ;
13
13
@@ -25,7 +25,7 @@ const BodySchema = Type.Object({
25
25
export const createAccount = async ( fastify : FastifyInstance ) => {
26
26
fastify . route < {
27
27
Params : Static < typeof contractParamSchema > ;
28
- Reply : Static < typeof transactionWritesResponseSchema > ;
28
+ Reply : Static < typeof prebuiltDeployResponseSchema > ;
29
29
Body : Static < typeof BodySchema > ;
30
30
} > ( {
31
31
method : "POST" ,
@@ -39,7 +39,7 @@ export const createAccount = async (fastify: FastifyInstance) => {
39
39
body : BodySchema ,
40
40
response : {
41
41
...standardResponseSchema ,
42
- [ StatusCodes . OK ] : transactionWritesResponseSchema ,
42
+ [ StatusCodes . OK ] : prebuiltDeployResponseSchema ,
43
43
} ,
44
44
} ,
45
45
handler : async ( req , rep ) => {
@@ -59,14 +59,24 @@ export const createAccount = async (fastify: FastifyInstance) => {
59
59
admin_address ,
60
60
extra_data ,
61
61
) ;
62
- const queueId = await queueTx ( {
62
+ const deployedAddress =
63
+ await contract . accountFactory . predictAccountAddress (
64
+ admin_address ,
65
+ extra_data ,
66
+ ) ;
67
+ const queuedId = await queueTx ( {
63
68
tx,
64
69
chainId,
65
70
extension : "account-factory" ,
71
+ deployedContractAddress : deployedAddress ,
72
+ deployedContractType : "account" ,
66
73
} ) ;
67
74
68
75
rep . status ( StatusCodes . OK ) . send ( {
69
- result : queueId ,
76
+ result : {
77
+ queuedId,
78
+ deployedAddress,
79
+ } ,
70
80
} ) ;
71
81
} ,
72
82
} ) ;
0 commit comments