11import { expect } from 'chai' ;
22import hre from 'hardhat' ;
3- import type { Account , Client , PublicClient , WalletClient } from 'viem' ;
4- import {
5- createClient ,
6- createPublicClient ,
7- hashTypedData ,
8- recoverAddress ,
9- } from 'viem' ;
3+ import type { Account , PublicClient , WalletClient } from 'viem' ;
4+ import { createPublicClient , hashTypedData , recoverAddress } from 'viem' ;
105import { toPackedUserOperation } from 'viem/account-abstraction' ;
116import { generatePrivateKey , privateKeyToAccount } from 'viem/accounts' ;
127import { hardhat as chain } from 'viem/chains' ;
@@ -22,7 +17,6 @@ import type { DeleGatorEnvironment, MetaMaskSmartAccount } from '../src/types';
2217import { SIGNABLE_USER_OP_TYPED_DATA } from '../src/userOp' ;
2318
2419describe ( 'MetaMaskSmartAccount' , ( ) => {
25- let client : Client ;
2620 let publicClient : PublicClient ;
2721 let walletClient : WalletClient ;
2822 let alice : Account ;
@@ -31,7 +25,6 @@ describe('MetaMaskSmartAccount', () => {
3125
3226 beforeEach ( async ( ) => {
3327 const transport = await createHardhatTransport ( ) ;
34- client = createClient ( { transport, chain } ) ;
3528 publicClient = createPublicClient ( { transport, chain } ) ;
3629 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
3730 walletClient = ( await hre . viem . getWalletClients ( ) ) [ 0 ] ! ;
@@ -49,7 +42,7 @@ describe('MetaMaskSmartAccount', () => {
4942 describe ( 'toMetaMaskSmartAccount()' , ( ) => {
5043 it ( 'should create a MetaMaskSmartAccount for Hybrid implementation' , async ( ) => {
5144 const smartAccount = await toMetaMaskSmartAccount ( {
52- client,
45+ client : publicClient ,
5346 implementation : Implementation . Hybrid ,
5447 deployParams : [ alice . address , [ ] , [ ] , [ ] ] ,
5548 deploySalt : '0x0' ,
@@ -85,7 +78,7 @@ describe('MetaMaskSmartAccount', () => {
8578
8679 it ( 'should create a MetaMaskSmartAccount for MultiSig implementation' , async ( ) => {
8780 const smartAccount = await toMetaMaskSmartAccount ( {
88- client,
81+ client : publicClient ,
8982 implementation : Implementation . MultiSig ,
9083 deployParams : [ [ alice . address , bob . address ] , 2n ] ,
9184 deploySalt : '0x0' ,
@@ -121,7 +114,7 @@ describe('MetaMaskSmartAccount', () => {
121114
122115 it ( 'should create a MetaMaskSmartAccount for Stateless7702 implementation with existing address' , async ( ) => {
123116 const smartAccount = await toMetaMaskSmartAccount ( {
124- client,
117+ client : publicClient ,
125118 implementation : Implementation . Stateless7702 ,
126119 address : alice . address ,
127120 signatory : { account : alice } ,
@@ -141,7 +134,7 @@ describe('MetaMaskSmartAccount', () => {
141134 it ( 'should throw error when creating Stateless7702 without address (counterfactual not supported)' , async ( ) => {
142135 await expect (
143136 toMetaMaskSmartAccount ( {
144- client,
137+ client : publicClient ,
145138 implementation : Implementation . Stateless7702 ,
146139 signatory : { account : alice } ,
147140 environment,
@@ -154,7 +147,7 @@ describe('MetaMaskSmartAccount', () => {
154147 it ( 'should throw an error for unsupported implementation' , async ( ) => {
155148 await expect (
156149 toMetaMaskSmartAccount ( {
157- client,
150+ client : publicClient ,
158151 implementation : 99 as any as Implementation ,
159152 deployParams : [ alice . address , [ ] , [ ] , [ ] ] ,
160153 deploySalt : '0x0' ,
@@ -167,7 +160,7 @@ describe('MetaMaskSmartAccount', () => {
167160 it ( 'should have a default for MetaMaskSmartAccount generic TImplementation parameter' , async ( ) => {
168161 // MetaMaskSmartAccount requires a generic parameter, and defaults to `Implementation` which covers all implementations
169162 const smartAccount : MetaMaskSmartAccount = await toMetaMaskSmartAccount ( {
170- client,
163+ client : publicClient ,
171164 implementation : Implementation . MultiSig ,
172165 deployParams : [ [ alice . address , bob . address ] , 2n ] ,
173166 deploySalt : '0x0' ,
@@ -183,7 +176,7 @@ describe('MetaMaskSmartAccount', () => {
183176 // this is a special case test, because as of Framework 1.2, user operations are signed via typed data
184177 it ( 'should sign a user operation' , async ( ) => {
185178 const smartAccount = await toMetaMaskSmartAccount ( {
186- client,
179+ client : publicClient ,
187180 implementation : Implementation . MultiSig ,
188181 deployParams : [ [ alice . address , bob . address ] , 2n ] ,
189182 deploySalt : '0x0' ,
@@ -229,7 +222,7 @@ describe('MetaMaskSmartAccount', () => {
229222
230223 it ( 'should sign a user operation for Stateless7702 implementation' , async ( ) => {
231224 const smartAccount = await toMetaMaskSmartAccount ( {
232- client,
225+ client : publicClient ,
233226 implementation : Implementation . Stateless7702 ,
234227 address : alice . address ,
235228 signatory : { account : alice } ,
0 commit comments