Skip to content

Commit

Permalink
fix: ABI output was wrong when using extra_output (#2190)
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey authored Jul 26, 2024
1 parent eb85855 commit 320f30e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/ape/managers/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -2539,9 +2539,7 @@ def _update_contract_types(self, contract_types: dict[str, ContractType]):
abi_folder.mkdir(parents=True, exist_ok=True)
for name, ct in (self.manifest.contract_types or {}).items():
file = abi_folder / f"{name}.json"
abi_json = json.dumps(
[x.model_dump_json(by_alias=True, mode="json") for x in ct.abi]
)
abi_json = json.dumps([x.model_dump(by_alias=True, mode="json") for x in ct.abi])
file.write_text(abi_json, encoding="utf8")


Expand Down
7 changes: 7 additions & 0 deletions tests/functional/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,13 @@ def test_load_contracts_output_abi(tmp_project):
for file in files:
assert file.suffix == ".json"

# Ensure is usable.
data = json.loads(file.read_text(encoding="utf8"))
assert isinstance(data, list)
assert len(data) >= 1
# There was bug where this was a str.
assert isinstance(data[0], dict)


def test_manifest_path(tmp_project):
assert tmp_project.manifest_path == tmp_project.path / ".build" / "__local__.json"
Expand Down

0 comments on commit 320f30e

Please sign in to comment.