@@ -12,54 +12,93 @@ import { router } from './router.js'
1212vi . mock ( './config/verbs.js' ,  ( )  =>  ( { 
1313  initializeVerbs : vi . fn ( ) , 
1414  getVerbs : vi . fn ( ( )  =>  ( { 
15-     createWallet : vi . fn ( ( userId : string )  => 
16-       Promise . resolve ( { 
17-         id : `wallet-${ userId }  ` , 
18-         address : `0x${ userId . padEnd ( 40 ,  '0' ) }  ` , 
19-         getBalance : ( )  => 
20-           Promise . resolve ( [ 
21-             {  symbol : 'USDC' ,  balance : 1000000n  } , 
22-             {  symbol : 'MORPHO' ,  balance : 500000n  } , 
23-           ] ) , 
24-       } ) , 
25-     ) , 
26-     getWallet : vi . fn ( ( userId : string )  =>  { 
27-       // Simulate some users existing and others not 
28-       if  ( userId . includes ( 'non-existent' ) )  { 
29-         return  Promise . resolve ( null ) 
30-       } 
31-       return  Promise . resolve ( { 
32-         id : `wallet-${ userId }  ` , 
33-         address : `0x${ userId . padEnd ( 40 ,  '0' ) }  ` , 
34-         getBalance : ( )  => 
35-           Promise . resolve ( [ 
36-             {  symbol : 'USDC' ,  balance : 1000000n  } , 
37-             {  symbol : 'MORPHO' ,  balance : 500000n  } , 
38-           ] ) , 
39-       } ) 
40-     } ) , 
41-     getAllWallets : vi . fn ( ( )  => 
42-       Promise . resolve ( [ 
43-         { 
44-           id : 'wallet-1' , 
45-           address : '0x1111111111111111111111111111111111111111' , 
15+     wallet : { 
16+       createWalletWithEmbeddedSigner : vi . fn ( ( )  => 
17+         Promise . resolve ( { 
18+           id : `wallet-1` , 
19+           signer : { 
20+             address : `0x1111111111111111111111111111111111111111` , 
21+           } , 
22+           getAddress : ( )  => 
23+             Promise . resolve ( `0x1111111111111111111111111111111111111111` ) , 
4624          getBalance : ( )  => 
4725            Promise . resolve ( [ 
4826              {  symbol : 'USDC' ,  balance : 1000000n  } , 
4927              {  symbol : 'MORPHO' ,  balance : 500000n  } , 
5028            ] ) , 
29+         } ) , 
30+       ) , 
31+       getSmartWalletWithEmbeddedSigner : vi . fn ( 
32+         ( {  walletId : userId  } : {  walletId : string  } )  =>  { 
33+           // Simulate some users existing and others not 
34+           if  ( userId . includes ( 'non-existent' ) )  { 
35+             return  Promise . resolve ( null ) 
36+           } 
37+           return  Promise . resolve ( { 
38+             id : `wallet-${ userId }  ` , 
39+             getAddress : ( )  =>  Promise . resolve ( `0x${ userId . padEnd ( 40 ,  '0' ) }  ` ) , 
40+             getBalance : ( )  => 
41+               Promise . resolve ( [ 
42+                 {  symbol : 'USDC' ,  balance : 1000000n  } , 
43+                 {  symbol : 'MORPHO' ,  balance : 500000n  } , 
44+               ] ) , 
45+           } ) 
5146        } , 
52-         { 
53-           id : 'wallet-2' , 
54-           address : '0x2222222222222222222222222222222222222222' , 
55-           getBalance : ( )  => 
56-             Promise . resolve ( [ 
57-               {  symbol : 'USDC' ,  balance : 2000000n  } , 
58-               {  symbol : 'MORPHO' ,  balance : 750000n  } , 
59-             ] ) , 
60-         } , 
61-       ] ) , 
62-     ) , 
47+       ) , 
48+       smartWalletProvider : { 
49+         getWalletAddress : vi . fn ( ( {  owners } : {  owners : string [ ]  } )  =>  { 
50+           return  Promise . resolve ( owners [ 0 ] ) 
51+         } ) , 
52+         getWallet : vi . fn ( 
53+           ( { 
54+             walletAddress, 
55+             signer, 
56+             ownerIndex, 
57+           } : { 
58+             walletAddress : string 
59+             signer : string 
60+             ownerIndex : number 
61+           } )  =>  { 
62+             return  { 
63+               address : walletAddress , 
64+               getAddress : ( )  =>  Promise . resolve ( walletAddress ) , 
65+               signer, 
66+               ownerIndex, 
67+             } 
68+           } , 
69+         ) , 
70+       } , 
71+       embeddedWalletProvider : { 
72+         getAllWallets : vi . fn ( ( )  => 
73+           Promise . resolve ( [ 
74+             { 
75+               id : 'wallet-1' , 
76+               address : '0x1111111111111111111111111111111111111111' , 
77+               getBalance : ( )  => 
78+                 Promise . resolve ( [ 
79+                   {  symbol : 'USDC' ,  balance : 1000000n  } , 
80+                   {  symbol : 'MORPHO' ,  balance : 500000n  } , 
81+                 ] ) , 
82+               signer : vi . fn ( ) . mockResolvedValue ( { 
83+                 address : '0x1111111111111111111111111111111111111111' , 
84+               } ) , 
85+             } , 
86+             { 
87+               id : 'wallet-2' , 
88+               address : '0x2222222222222222222222222222222222222222' , 
89+               getBalance : ( )  => 
90+                 Promise . resolve ( [ 
91+                   {  symbol : 'USDC' ,  balance : 2000000n  } , 
92+                   {  symbol : 'MORPHO' ,  balance : 750000n  } , 
93+                 ] ) , 
94+               signer : vi . fn ( ) . mockResolvedValue ( { 
95+                 address : '0x2222222222222222222222222222222222222222' , 
96+               } ) , 
97+             } , 
98+           ] ) , 
99+         ) , 
100+       } , 
101+     } , 
63102    lend : { 
64103      getVaults : vi . fn ( ( )  => 
65104        Promise . resolve ( [ 
@@ -186,11 +225,12 @@ describe('HTTP API Integration', () => {
186225
187226      expect ( response . statusCode ) . toBe ( 200 ) 
188227      const  data  =  ( await  response . body . json ( ) )  as  any 
189- 
190-       expect ( data ) . toHaveProperty ( 'address ' ) 
228+        expect ( data ) . toHaveProperty ( 'privyAddress' ) 
229+       expect ( data ) . toHaveProperty ( 'smartWalletAddress ' ) 
191230      expect ( data ) . toHaveProperty ( 'userId' ) 
192231      expect ( data . userId ) . toBe ( testUserId ) 
193-       expect ( data . address ) . toMatch ( / ^ 0 x [ a - z A - Z 0 - 9 \- ] { 1 , } $ / )  // Basic address format validation 
232+       expect ( data . smartWalletAddress ) . toMatch ( / ^ 0 x [ a - z A - Z 0 - 9 \- ] { 1 , } $ / ) 
233+       expect ( data . privyAddress ) . toMatch ( / ^ 0 x [ a - z A - Z 0 - 9 \- ] { 1 , } $ / ) 
194234    } ) 
195235
196236    it ( 'should get an existing wallet' ,  async  ( )  =>  { 
0 commit comments