diff --git a/cosmpy/aerial/coins.py b/cosmpy/aerial/coins.py index 19325621..ddfff712 100644 --- a/cosmpy/aerial/coins.py +++ b/cosmpy/aerial/coins.py @@ -40,7 +40,7 @@ def parse_coins(value: str) -> List[Coin]: if part == "": continue - match = re.match(r"(\d+)(\w+)", part) + match = re.match(r"^(\d+)(.+)$", part) if match is None: raise RuntimeError(f"Unable to parse value {part}") diff --git a/tests/unit/test_aerial/coins_test.py b/tests/unit/test_aerial/coins_test.py index 18e625f2..ef747b54 100644 --- a/tests/unit/test_aerial/coins_test.py +++ b/tests/unit/test_aerial/coins_test.py @@ -31,11 +31,24 @@ (" ", []), ("50000atestfet", [Coin(amount="50000", denom="atestfet")]), ( - "50000atestfet, 200foobar", - [ - Coin(amount="50000", denom="atestfet"), - Coin(amount="200", denom="foobar"), - ], + "50000atestfet, 200foobar", + [ + Coin(amount="50000", denom="atestfet"), + Coin(amount="200", denom="foobar"), + ], + ), + ( + "500ibc/0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B", + [ + Coin(amount="500", denom="ibc/0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B") + ] + ), + ( + "500ibc/0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B, 50000atestfet", + [ + Coin(amount="500", denom="ibc/0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B"), + Coin(amount="50000", denom="atestfet"), + ] ), ], )