55
66from src .chain .kvstore import register_in_kvstore
77from src .core .config import Config
8-
9- LOCAL_MANIFEST_FILES = set ()
8+ from src .services import cloud
9+ from src .services .cloud import BucketAccessInfo
10+ from src .utils .logging import get_function_logger
1011
1112
1213def apply_local_development_patches ():
@@ -24,9 +25,15 @@ def apply_local_development_patches():
2425 from human_protocol_sdk .constants import ChainId
2526 from human_protocol_sdk .escrow import EscrowData , EscrowUtils
2627
28+ logger = get_function_logger (apply_local_development_patches .__name__ )
29+
30+ minio_client = cloud .make_client (BucketAccessInfo .parse_obj (Config .storage_config ))
31+
2732 def get_local_escrow (chain_id : int , escrow_address : str ) -> EscrowData :
2833 possible_manifest_name = escrow_address .split (":" )[0 ]
29- if possible_manifest_name in LOCAL_MANIFEST_FILES :
34+ local_manifests = minio_client .list_files (bucket = "manifests" )
35+ logger .info (f"Local manifests: { local_manifests } " )
36+ if possible_manifest_name in local_manifests :
3037 return EscrowData (
3138 chain_id = ChainId (chain_id ),
3239 id = "test" ,
@@ -47,14 +54,6 @@ def get_local_escrow(chain_id: int, escrow_address: str) -> EscrowData:
4754 original_get_escrow = EscrowUtils .get_escrow
4855 EscrowUtils .get_escrow = get_local_escrow
4956
50- from src .services import cloud
51- from src .services .cloud import BucketAccessInfo
52-
53- manifests = cloud .make_client (BucketAccessInfo .parse_obj (Config .storage_config )).list_files (
54- bucket = "manifests"
55- )
56- LOCAL_MANIFEST_FILES .update (manifests )
57-
5857 import src .schemas .webhook
5958 from src .core .types import OracleWebhookTypes
6059
0 commit comments