Skip to content

Commit 9f7b8e3

Browse files
authored
Merge pull request #352 from InjectiveLabs/fix/sync_dev_after_v1_7_1
fix/sync_dev_after_v1_7_1
2 parents 387b1fc + c54d107 commit 9f7b8e3

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## [1.7.0] - 2024-09-18
5+
## [1.7.1] - 2024-09-24
6+
### Fixed
7+
- Fixed logic to get the absolute ofac.json file path
8+
9+
## [1.7.0] - 2024-09-19
610
### Added
711
- Added OFAC restricted addresses validations
812

pyinjective/ofac.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,17 @@
1212
class OfacChecker:
1313
def __init__(self):
1414
self._ofac_list_path = self.get_ofac_list_path()
15-
if not os.path.exists(self._ofac_list_path):
15+
try:
16+
with open(self._ofac_list_path, "r") as f:
17+
self._ofac_list = set(json.load(f))
18+
except Exception as e:
1619
raise Exception(
17-
"OFAC list is missing on the disk. Please, download it by running python3 pyinjective/ofac_list.py"
20+
f"Error parsing OFAC list. Please, download it by running python3 pyinjective/ofac_list.py ({e})"
1821
)
1922

20-
with open(self._ofac_list_path, "r") as f:
21-
self._ofac_list = set(json.load(f))
22-
2323
@classmethod
2424
def get_ofac_list_path(cls):
25-
current_directory = os.getcwd()
26-
while os.path.basename(current_directory) != "sdk-python":
27-
current_directory = os.path.dirname(current_directory)
28-
return os.path.join(os.path.join(current_directory, "pyinjective"), OFAC_LIST_FILENAME)
25+
return os.path.join(os.path.dirname(__file__), OFAC_LIST_FILENAME)
2926

3027
@classmethod
3128
async def download_ofac_list(cls):

0 commit comments

Comments
 (0)