@@ -12,7 +12,13 @@ import {
1212import { conditions , domains , initialize , signUserOp } from '@nucypher/taco' ;
1313import * as dotenv from 'dotenv' ;
1414import { ethers } from 'ethers' ;
15- import { Address , createPublicClient , http , parseEther } from 'viem' ;
15+ import {
16+ Address ,
17+ createPublicClient ,
18+ http ,
19+ parseEther ,
20+ PublicClient ,
21+ } from 'viem' ;
1622import {
1723 createBundlerClient ,
1824 createPaymasterClient ,
@@ -28,8 +34,8 @@ const COHORT_ID = 1;
2834const AA_VERSION = 'mdt' ;
2935
3036async function createTacoSmartAccount (
31- publicClient : any ,
32- localAccount : any ,
37+ publicClient : PublicClient ,
38+ localAccount : ReturnType < typeof privateKeyToAccount > ,
3339 provider : ethers . providers . JsonRpcProvider ,
3440) {
3541 await initialize ( ) ;
@@ -46,7 +52,7 @@ async function createTacoSmartAccount(
4652 const signers = participants . map ( ( p : any ) => p . operator as Address ) . sort ( ) ;
4753
4854 const smartAccount = await toMetaMaskSmartAccount ( {
49- client : publicClient ,
55+ client : publicClient as any ,
5056 implementation : Implementation . MultiSig ,
5157 deployParams : [ signers , BigInt ( threshold ) ] ,
5258 deploySalt : '0x' as `0x${ string } ` ,
@@ -107,7 +113,9 @@ async function logBalances(
107113 const eoaBalance = await provider . getBalance ( eoaAddress ) ;
108114 const smartAccountBalance = await provider . getBalance ( smartAccountAddress ) ;
109115 console . log ( `\n💳 EOA Balance: ${ ethers . utils . formatEther ( eoaBalance ) } ETH` ) ;
110- console . log ( `🏦 Smart Account: ${ ethers . utils . formatEther ( smartAccountBalance ) } ETH\n` ) ;
116+ console . log (
117+ `🏦 Smart Account: ${ ethers . utils . formatEther ( smartAccountBalance ) } ETH\n` ,
118+ ) ;
111119}
112120
113121async function main ( ) {
@@ -173,33 +181,39 @@ async function main() {
173181 account : smartAccount ,
174182 calls : [
175183 {
176- target : localAccount . address ,
177- value : transferAmount ,
178- data : '0x' ,
184+ target : localAccount . address as Address ,
185+ value : BigInt ( transferAmount . toString ( ) ) ,
186+ data : '0x' as `0x ${ string } ` ,
179187 } ,
180188 ] ,
181189 ...fee ,
182190 verificationGasLimit : BigInt ( 500_000 ) ,
183- } ) ;
184- console . log ( `💸 Transfer amount: ${ ethers . utils . formatEther ( transferAmount ) } ETH\n` ) ;
191+ } as any ) ;
192+ console . log (
193+ `💸 Transfer amount: ${ ethers . utils . formatEther ( transferAmount ) } ETH\n` ,
194+ ) ;
185195
186196 console . log ( '🔏 Signing with TACo...' ) ;
187197 const signature = await signUserOpWithTaco ( userOp , provider ) ;
188- console . log ( `✅ Signature collected (${ signature . aggregatedSignature . length / 2 - 1 } bytes)\n` ) ;
198+ console . log (
199+ `✅ Signature collected (${ signature . aggregatedSignature . length / 2 - 1 } bytes)\n` ,
200+ ) ;
189201
190202 console . log ( '🚀 Executing transaction...' ) ;
191203 const userOpHash = await bundlerClient . sendUserOperation ( {
192204 ...userOp ,
193205 signature : signature . aggregatedSignature as `0x${ string } ` ,
194- } ) ;
206+ } as any ) ;
195207 console . log ( `📝 UserOp Hash: ${ userOpHash } ` ) ;
196208
197209 const { receipt } = await bundlerClient . waitForUserOperationReceipt ( {
198210 hash : userOpHash ,
199211 } ) ;
200212 console . log ( `\n🎉 Transaction successful!` ) ;
201213 console . log ( `🔗 Tx: ${ receipt . transactionHash } ` ) ;
202- console . log ( `🌐 View on Etherscan: https://sepolia.etherscan.io/tx/${ receipt . transactionHash } \n` ) ;
214+ console . log (
215+ `🌐 View on Etherscan: https://sepolia.etherscan.io/tx/${ receipt . transactionHash } \n` ,
216+ ) ;
203217
204218 await logBalances ( provider , localAccount . address , smartAccount . address ) ;
205219 console . log ( '✨ Demo completed successfully! ✨' ) ;
@@ -211,5 +225,10 @@ async function main() {
211225}
212226
213227if ( require . main === module ) {
228+ // Check if --dry-run flag is present (used for CI syntax checking)
229+ if ( process . argv . includes ( '--dry-run' ) ) {
230+ console . log ( '✓ Syntax check passed' ) ;
231+ process . exit ( 0 ) ;
232+ }
214233 main ( ) ;
215234}
0 commit comments