@@ -26,6 +26,8 @@ import {
2626import { privateKeyToAccount } from 'viem/accounts' ;
2727import { sepolia } from 'viem/chains' ;
2828
29+ import { createViemTacoAccount } from './taco-account' ;
30+
2931dotenv . config ( ) ;
3032
3133const SEPOLIA_CHAIN_ID = 11155111 ;
@@ -35,7 +37,6 @@ const AA_VERSION = 'mdt';
3537
3638async function createTacoSmartAccount (
3739 publicClient : PublicClient ,
38- localAccount : ReturnType < typeof privateKeyToAccount > ,
3940 provider : ethers . providers . JsonRpcProvider ,
4041) {
4142 await initialize ( ) ;
@@ -49,21 +50,26 @@ async function createTacoSmartAccount(
4950 TACO_DOMAIN ,
5051 COHORT_ID ,
5152 ) ;
52- const signers = participants . map ( ( p : any ) => p . operator as Address ) . sort ( ) ;
53+ const signers = participants . map ( ( p ) => p . operator as Address ) . sort ( ) ;
54+
55+ // Create a TACo account using the first signer as placeholder address
56+ // This satisfies MetaMask's signatory requirement without using a local wallet
57+ const tacoAccount = createViemTacoAccount ( signers [ 0 ] ) ;
5358
5459 const smartAccount = await toMetaMaskSmartAccount ( {
55- client : publicClient as any ,
60+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
61+ client : publicClient as any , // Required due to viem/delegation-toolkit type incompatibilities
5662 implementation : Implementation . MultiSig ,
5763 deployParams : [ signers , BigInt ( threshold ) ] ,
5864 deploySalt : '0x' as `0x${ string } ` ,
59- signatory : [ { account : localAccount } ] ,
65+ signatory : [ { account : tacoAccount } ] ,
6066 } ) ;
6167
6268 return { smartAccount, threshold } ;
6369}
6470
6571async function signUserOpWithTaco (
66- userOp : any ,
72+ userOp : Record < string , unknown > ,
6773 provider : ethers . providers . JsonRpcProvider ,
6874) {
6975 const signingContext =
@@ -146,7 +152,6 @@ async function main() {
146152 console . log ( '🔧 Creating TACo smart account...\n' ) ;
147153 const { smartAccount, threshold } = await createTacoSmartAccount (
148154 publicClient ,
149- localAccount ,
150155 provider ,
151156 ) ;
152157 console . log ( `✅ Smart account created: ${ smartAccount . address } ` ) ;
@@ -188,7 +193,8 @@ async function main() {
188193 ] ,
189194 ...fee ,
190195 verificationGasLimit : BigInt ( 500_000 ) ,
191- } as any ) ;
196+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
197+ } as any ) ; // Required due to viem/delegation-toolkit type incompatibilities
192198 console . log (
193199 `💸 Transfer amount: ${ ethers . utils . formatEther ( transferAmount ) } ETH\n` ,
194200 ) ;
@@ -203,7 +209,8 @@ async function main() {
203209 const userOpHash = await bundlerClient . sendUserOperation ( {
204210 ...userOp ,
205211 signature : signature . aggregatedSignature as `0x${ string } ` ,
206- } as any ) ;
212+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
213+ } as any ) ; // Required due to viem/delegation-toolkit type incompatibilities
207214 console . log ( `📝 UserOp Hash: ${ userOpHash } ` ) ;
208215
209216 const { receipt } = await bundlerClient . waitForUserOperationReceipt ( {
@@ -218,8 +225,9 @@ async function main() {
218225 await logBalances ( provider , localAccount . address , smartAccount . address ) ;
219226 console . log ( '✨ Demo completed successfully! ✨' ) ;
220227 process . exit ( 0 ) ;
221- } catch ( error : any ) {
222- console . error ( `❌ Demo failed: ${ error . message } ` ) ;
228+ } catch ( error : unknown ) {
229+ const errorMessage = error instanceof Error ? error . message : String ( error ) ;
230+ console . error ( `❌ Demo failed: ${ errorMessage } ` ) ;
223231 process . exit ( 1 ) ;
224232 }
225233}
0 commit comments