@@ -4,15 +4,14 @@ import { parseAbi } from "viem";
44import { privateKeyToAccount } from "viem/accounts" ;
55
66import { SsoAccount } from "./account" ;
7- import { contractAddresses , toEOASigner , createClients , randomAddress , deployContract } from "./utils" ;
7+ import { contractAddresses , toEOASigner , createClients , randomAddress , deployContract , chainId , rpcPort } from "./utils" ;
88
9- const anvilPort = 8545 ;
109const altoPort = require ( "../../alto.json" ) . port ;
1110const privateKey = "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6" ;
1211
1312test ( "executes a simple transfer signed using EOA" , { timeout : 120_000 } , async ( ) => {
1413 const { account } = contractAddresses ( ) ;
15- const { client, bundlerClient } = createClients ( anvilPort , altoPort ) ;
14+ const { client, bundlerClient } = createClients ( rpcPort ( ) , altoPort ) ;
1615 const sso = await SsoAccount . create ( client , account , toEOASigner ( privateKey ) ) ;
1716
1817 const target = randomAddress ( ) ;
@@ -24,7 +23,7 @@ test("executes a simple transfer signed using EOA", { timeout: 120_000 }, async
2423 } ] ,
2524 } ) ;
2625
27- const receipt = await bundlerClient . waitForUserOperationReceipt ( { hash, timeout : 0 } ) ;
26+ const receipt = await bundlerClient . waitForUserOperationReceipt ( { hash, timeout : 2_000 } ) ;
2827 assert . equal (
2928 receipt . receipt . status ,
3029 "success" ,
@@ -37,7 +36,7 @@ test("executes a simple transfer signed using EOA", { timeout: 120_000 }, async
3736
3837test ( "executes a transaction sponsored by a paymaster" , { timeout : 120_000 } , async ( ) => {
3938 const { account } = contractAddresses ( ) ;
40- const { client, bundlerClient } = createClients ( anvilPort , altoPort ) ;
39+ const { client, bundlerClient } = createClients ( rpcPort ( ) , altoPort ) ;
4140 const sso = await SsoAccount . create ( client , account , toEOASigner ( privateKey ) ) ;
4241 const deployer = privateKeyToAccount ( privateKey ) ;
4342 const paymaster = await deployContract ( client , privateKey , "MockPaymaster" ) ;
@@ -47,9 +46,9 @@ test("executes a transaction sponsored by a paymaster", { timeout: 120_000 }, as
4746 abi : parseAbi ( [ "function deposit() external payable" ] ) ,
4847 functionName : "deposit" ,
4948 args : [ ] ,
50- value : 10n ** 18n , // 1 ETH
49+ value : 10n ** 17n , // 0. 1 ETH
5150 } )
52- await client . waitForTransactionReceipt ( { hash : depositHash , timeout : 0 } ) ;
51+ await client . waitForTransactionReceipt ( { hash : depositHash , timeout : 2_000 } ) ;
5352
5453 const balanceBefore = await client . getBalance ( { address : account } ) ;
5554 const sponsored = await bundlerClient . sendUserOperation ( {
@@ -58,7 +57,7 @@ test("executes a transaction sponsored by a paymaster", { timeout: 120_000 }, as
5857 paymaster,
5958 } ) ;
6059
61- const receipt = await bundlerClient . waitForUserOperationReceipt ( { hash : sponsored , timeout : 0 } ) ;
60+ const receipt = await bundlerClient . waitForUserOperationReceipt ( { hash : sponsored , timeout : 2_000 } ) ;
6261 const balanceAfter = await client . getBalance ( { address : account } ) ;
6362
6463 assert . equal ( receipt . receipt . status , "success" , "sponsored user operation should execute successfully" ) ;
@@ -67,7 +66,7 @@ test("executes a transaction sponsored by a paymaster", { timeout: 120_000 }, as
6766
6867test ( "checks ERC7739 EOA signature using ERC1271" , { timeout : 120_000 } , async ( ) => {
6968 const { account } = contractAddresses ( ) ;
70- const { client } = createClients ( anvilPort , altoPort ) ;
69+ const { client } = createClients ( rpcPort ( ) , altoPort ) ;
7170 const sso = await SsoAccount . create ( client , account , toEOASigner ( privateKey ) ) ;
7271
7372 const erc1271Caller = await deployContract ( client , privateKey , "MockERC1271Caller" ) ;
@@ -84,7 +83,7 @@ test("checks ERC7739 EOA signature using ERC1271", { timeout: 120_000 }, async (
8483 ]
8584 } ,
8685 domain : {
87- chainId : 1337 ,
86+ chainId : chainId ( ) ,
8887 name : "ERC1271Caller" ,
8988 version : "1.0.0" ,
9089 verifyingContract : erc1271Caller ,
0 commit comments