@@ -15,13 +15,7 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f'
1515describe ( 'Accounts: Startale' , ( ) => {
1616 describe ( 'Deploy Args' , ( ) => {
1717 test ( 'ECDSA owners' , ( ) => {
18- const {
19- factory,
20- factoryData,
21- salt,
22- implementation,
23- initializationCallData,
24- } = getDeployArgs ( {
18+ const result = getDeployArgs ( {
2519 account : {
2620 type : 'startale' ,
2721 } ,
@@ -30,6 +24,14 @@ describe('Accounts: Startale', () => {
3024 accounts : [ accountA , accountB ] ,
3125 } ,
3226 } )
27+ expect ( result ) . not . toBeNull ( )
28+ const {
29+ factory,
30+ factoryData,
31+ salt,
32+ implementation,
33+ initializationCallData,
34+ } = result !
3335
3436 expect ( factory ) . toEqual ( '0x0000003b3e7b530b4f981ae80d9350392defef90' )
3537 expect ( factoryData ) . toEqual (
@@ -47,13 +49,7 @@ describe('Accounts: Startale', () => {
4749 } )
4850
4951 test ( 'Passkey owner' , ( ) => {
50- const {
51- factory,
52- factoryData,
53- salt,
54- implementation,
55- initializationCallData,
56- } = getDeployArgs ( {
52+ const result = getDeployArgs ( {
5753 account : {
5854 type : 'startale' ,
5955 } ,
@@ -62,6 +58,14 @@ describe('Accounts: Startale', () => {
6258 accounts : [ passkeyAccount ] ,
6359 } ,
6460 } )
61+ expect ( result ) . not . toBeNull ( )
62+ const {
63+ factory,
64+ factoryData,
65+ salt,
66+ implementation,
67+ initializationCallData,
68+ } = result !
6569
6670 expect ( factory ) . toEqual ( '0x0000003b3e7b530b4f981ae80d9350392defef90' )
6771 expect ( factoryData ) . toEqual (
@@ -106,6 +110,48 @@ describe('Accounts: Startale', () => {
106110
107111 expect ( address ) . toEqual ( '0x4d78f6b273d07f2fd24433ebc7a90d89f0d061ae' )
108112 } )
113+
114+ test ( 'initData with address fallback' , ( ) => {
115+ const expectedAddress = '0x229ca553b9863b0c8f2f03d4287cb8c73e2bede7'
116+ const address = getAddress ( {
117+ account : {
118+ type : 'startale' ,
119+ } ,
120+ owners : {
121+ type : 'ecdsa' ,
122+ accounts : [ accountA ] ,
123+ } ,
124+ initData : {
125+ address : expectedAddress ,
126+ } ,
127+ } )
128+ expect ( address ) . toEqual ( expectedAddress )
129+ } )
130+
131+ test ( 'initData with factory decodes correctly' , ( ) => {
132+ // First get the real deploy args to get valid factory/factoryData
133+ const deployArgs = getDeployArgs ( {
134+ account : { type : 'startale' } ,
135+ owners : { type : 'ecdsa' , accounts : [ accountA , accountB ] } ,
136+ } )
137+ expect ( deployArgs ) . not . toBeNull ( )
138+ const { factory, factoryData } = deployArgs !
139+
140+ // Now use initData path with a different owners set (simulating mock signer)
141+ const address = getAddress ( {
142+ account : { type : 'startale' } ,
143+ owners : { type : 'ecdsa' , accounts : [ accountA ] } ,
144+ initData : {
145+ address : '0x614ea8885429c480a83deddd2e050d411da36d4b' ,
146+ factory,
147+ factoryData,
148+ intentExecutorInstalled : true ,
149+ } ,
150+ } )
151+
152+ // Should derive the same address from factoryData, not from the mock owners
153+ expect ( address ) . toEqual ( '0x614ea8885429c480a83deddd2e050d411da36d4b' )
154+ } )
109155 } )
110156
111157 describe ( 'Get Install Data' , ( ) => {
0 commit comments