From 1e5d63ad3195e6942e96abfeac2be5feb5fd4a41 Mon Sep 17 00:00:00 2001 From: Uxio Fuentefria <6909403+Uxio0@users.noreply.github.com> Date: Tue, 5 Mar 2024 14:38:25 +0100 Subject: [PATCH] Update 4337 bundler mock --- .../test_e2e_bundler_client.py | 21 +++++++++++++++++++ gnosis/eth/tests/mocks/mock_bundler.py | 5 ++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/gnosis/eth/tests/account_abstraction/test_e2e_bundler_client.py b/gnosis/eth/tests/account_abstraction/test_e2e_bundler_client.py index 850f3d395..027e8c746 100644 --- a/gnosis/eth/tests/account_abstraction/test_e2e_bundler_client.py +++ b/gnosis/eth/tests/account_abstraction/test_e2e_bundler_client.py @@ -9,6 +9,7 @@ safe_4337_user_operation_hash_mock, supported_entrypoint_mock, user_operation_mock, + user_operation_receipt_mock, user_operation_receipt_parsed_mock, ) @@ -22,6 +23,26 @@ def setUp(self): self.bundler = BundlerClient(bundler_client_url) + def test_get_user_operation_by_hash(self): + user_operation_hash = safe_4337_user_operation_hash_mock.hex() + + expected_user_operation = UserOperation.from_bundler_response( + user_operation_hash, user_operation_mock["result"] + ) + self.assertEqual( + self.bundler.get_user_operation_by_hash(user_operation_hash), + expected_user_operation, + ) + + def test_get_user_operation_receipt(self): + user_operation_hash = safe_4337_user_operation_hash_mock.hex() + + self.assertEqual( + self.bundler.get_user_operation_receipt(user_operation_hash), + user_operation_receipt_mock["result"], + ) + + @pytest.mark.xfail(reason="Some bundlers don't support batch requests") def test_get_user_operation_and_receipt(self): user_operation_hash = safe_4337_user_operation_hash_mock.hex() diff --git a/gnosis/eth/tests/mocks/mock_bundler.py b/gnosis/eth/tests/mocks/mock_bundler.py index e9aeea558..b8f1c8d34 100644 --- a/gnosis/eth/tests/mocks/mock_bundler.py +++ b/gnosis/eth/tests/mocks/mock_bundler.py @@ -728,5 +728,8 @@ supported_entrypoint_mock = { "jsonrpc": "2.0", "id": 1, - "result": ["0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"], + "result": [ + "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", + "0x0000000071727De22E5E9d8BAf0edAc6f37da032", + ], }