Skip to content

Commit

Permalink
Update 4337 bundler mock
Browse files Browse the repository at this point in the history
  • Loading branch information
Uxio0 committed Mar 5, 2024
1 parent 4a3f532 commit 1e5d63a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
21 changes: 21 additions & 0 deletions gnosis/eth/tests/account_abstraction/test_e2e_bundler_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand All @@ -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()

Expand Down
5 changes: 4 additions & 1 deletion gnosis/eth/tests/mocks/mock_bundler.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,5 +728,8 @@
supported_entrypoint_mock = {
"jsonrpc": "2.0",
"id": 1,
"result": ["0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"],
"result": [
"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
"0x0000000071727De22E5E9d8BAf0edAc6f37da032",
],
}

0 comments on commit 1e5d63a

Please sign in to comment.