18 lines
530 B
Python
18 lines
530 B
Python
from __future__ import annotations
|
|
|
|
from typing import Dict, Any
|
|
|
|
|
|
class ContractRegistry:
|
|
def __init__(self):
|
|
self._contracts: Dict[str, Dict[str, Any]] = {}
|
|
|
|
def register(self, adapter_name: str, version: str, contract: Dict[str, Any]) -> None:
|
|
self._contracts[(adapter_name, version)] = contract
|
|
|
|
def get(self, adapter_name: str, version: str) -> Dict[str, Any] | None:
|
|
return self._contracts.get((adapter_name, version))
|
|
|
|
def all(self) -> Dict[str, Any]:
|
|
return self._contracts
|