From a13d27e7c155cf2d04f000f78a64e7c8d5409903 Mon Sep 17 00:00:00 2001 From: blnkoff Date: Mon, 15 Jul 2024 20:58:01 +0300 Subject: [PATCH] **Fixing Bugs**: - If `version` in `load_contracts` was set, there was an issue with path generation - Adding types `NativeToken` and `Token` --- evm_extras/tools.py | 2 +- evm_extras/types.py | 4 ++++ pyproject.toml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/evm_extras/tools.py b/evm_extras/tools.py index 7e55e0d..476da60 100644 --- a/evm_extras/tools.py +++ b/evm_extras/tools.py @@ -85,7 +85,7 @@ def load_contracts( path = os.path.join(contracts_path, folder_name) if version: - path = os.path.join(contracts_path, f'v{version}') + path = os.path.join(path, f'v{version}') contract_data = {} with open(f"{path}/contracts.json") as file: diff --git a/evm_extras/types.py b/evm_extras/types.py index c066eaa..905f017 100644 --- a/evm_extras/types.py +++ b/evm_extras/types.py @@ -1,4 +1,8 @@ +from typing import Literal +from evm_wallet import ERC20Token from web3.contract import AsyncContract, Contract from web3.types import ABI ContractMap = dict[str, AsyncContract | ABI | Contract] +NativeToken = Literal['AVAX', 'ETH', 'BNB', 'FTM', 'MATIC', '0x0000000000000000000000000000000000000000'] +Token = ERC20Token | NativeToken \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index e16b991..fab178f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = 'evm_extras' -version = '0.2.1' +version = '0.2.2' description = 'The package containing utilities to develop Web3-based projects' authors = ['Alexey '] license = 'MIT'