From 6a86c9d42b2d374949088f50b0ca3ce473a3c7ca Mon Sep 17 00:00:00 2001 From: Abhishek Krishna Date: Mon, 1 Jun 2026 14:06:38 +0530 Subject: [PATCH] fix(parse_wei): match WEI key against uppercased currency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The multiplier lookup uppercases the currency suffix, but the dict had a lowercase 'wei' key, so 'X wei' fell through to the default ETH multiplier and returned X * 10**18 instead of X. The existing test_parse_wei case 'parse_wei("1000000000000000000 wei") == 10**18' asserts the correct behavior — this fix makes it actually hold. --- src/payment_protocol.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/payment_protocol.py b/src/payment_protocol.py index 7063c4e..054bec8 100644 --- a/src/payment_protocol.py +++ b/src/payment_protocol.py @@ -507,7 +507,7 @@ def parse_wei(amount: str) -> int: multiplier = { "ETH": 10**18, - "wei": 1, + "WEI": 1, "KETH": 10**21, }.get(currency.upper(), 10**18)