@@ -468,15 +468,15 @@ async def save_json(file_path: Path, data: list):
468
468
469
469
async def add_chain_account (new_account : ChainAccount ):
470
470
"""Add a new chain account to the JSON file asynchronously."""
471
- accounts = await load_json (settings .CHAINS_CONFIG_FILE )
471
+ accounts = await load_json (settings .CONFIG_FILE )
472
472
473
473
for account in accounts :
474
474
if account ["name" ] == new_account .name :
475
475
logger .error (f"Account with name { new_account .name } already exists." )
476
476
raise ValueError (f"Account with name { new_account .name } already exists." )
477
477
478
478
accounts .append (new_account .dict ())
479
- await save_json (settings .CHAINS_CONFIG_FILE , accounts )
479
+ await save_json (settings .CONFIG_FILE , accounts )
480
480
481
481
logger .debug (
482
482
f"Added account for { new_account .name } with chain { new_account .chain } and path { new_account .path } ."
@@ -485,7 +485,7 @@ async def add_chain_account(new_account: ChainAccount):
485
485
486
486
async def get_chain_account (name : str ) -> ChainAccount :
487
487
"""Retrieve a chain account by name from the JSON file."""
488
- accounts = await load_json (settings .CHAINS_CONFIG_FILE )
488
+ accounts = await load_json (settings .CONFIG_FILE )
489
489
490
490
for account in accounts :
491
491
if account ["name" ] == name :
@@ -498,7 +498,7 @@ async def get_chain_account(name: str) -> ChainAccount:
498
498
499
499
async def get_chain_account_from_path (path : str ) -> ChainAccount :
500
500
"""Retrieve a chain account by name from the JSON file."""
501
- accounts = await load_json (settings .CHAINS_CONFIG_FILE )
501
+ accounts = await load_json (settings .CONFIG_FILE )
502
502
503
503
for account in accounts :
504
504
if account ["path" ] == path :
@@ -511,12 +511,12 @@ async def get_chain_account_from_path(path: str) -> ChainAccount:
511
511
512
512
async def update_chain_account (updated_account : ChainAccount ):
513
513
"""Update an existing chain account in the JSON file."""
514
- accounts = await load_json (settings .CHAINS_CONFIG_FILE )
514
+ accounts = await load_json (settings .CONFIG_FILE )
515
515
516
516
for index , account in enumerate (accounts ):
517
517
if account ["name" ] == updated_account .name :
518
518
accounts [index ] = updated_account .dict ()
519
- await save_json (settings .CHAINS_CONFIG_FILE , accounts )
519
+ await save_json (settings .CONFIG_FILE , accounts )
520
520
logger .debug (f"Updated account with name { updated_account .name } ." )
521
521
return
522
522
@@ -526,15 +526,15 @@ async def update_chain_account(updated_account: ChainAccount):
526
526
527
527
async def delete_chain_account (name : str ):
528
528
"""Delete a chain account from the JSON file."""
529
- accounts = await load_json (settings .CHAINS_CONFIG_FILE )
529
+ accounts = await load_json (settings .CONFIG_FILE )
530
530
531
531
updated_accounts = [account for account in accounts if account ["name" ] != name ]
532
532
533
533
if len (updated_accounts ) == len (accounts ):
534
534
logger .error (f"No account found with name { name } ." )
535
535
raise ValueError (f"No account found with name { name } ." )
536
536
537
- await save_json (settings .CHAINS_CONFIG_FILE , updated_accounts )
537
+ await save_json (settings .CONFIG_FILE , updated_accounts )
538
538
logger .debug (f"Deleted account with name { name } ." )
539
539
540
540
0 commit comments