diff --git a/cashu/core/models.py b/cashu/core/models.py index 1fb6067a..eff58176 100644 --- a/cashu/core/models.py +++ b/cashu/core/models.py @@ -25,13 +25,18 @@ class MintMeltMethodSetting(BaseModel): max_amount: Optional[int] = None +class MintInfoContact(BaseModel): + method: str + info: str + + class GetInfoResponse(BaseModel): name: Optional[str] = None pubkey: Optional[str] = None version: Optional[str] = None description: Optional[str] = None description_long: Optional[str] = None - contact: Optional[List[List[str]]] = None + contact: Optional[List[MintInfoContact]] = None motd: Optional[str] = None nuts: Optional[Dict[int, Any]] = None diff --git a/cashu/mint/router.py b/cashu/mint/router.py index d45ea69e..9e54f63f 100644 --- a/cashu/mint/router.py +++ b/cashu/mint/router.py @@ -10,6 +10,7 @@ KeysetsResponseKeyset, KeysResponse, KeysResponseKeyset, + MintInfoContact, PostCheckStateRequest, PostCheckStateResponse, PostMeltQuoteRequest, @@ -41,13 +42,16 @@ async def info() -> GetInfoResponse: logger.trace("> GET /v1/info") mint_features = ledger.mint_features() + contact_info = [ + MintInfoContact(method=m, info=i) for m, i in settings.mint_info_contact + ] return GetInfoResponse( name=settings.mint_info_name, pubkey=ledger.pubkey.serialize().hex() if ledger.pubkey else None, version=f"Nutshell/{settings.version}", description=settings.mint_info_description, description_long=settings.mint_info_description_long, - contact=settings.mint_info_contact, + contact=contact_info, nuts=mint_features, motd=settings.mint_info_motd, ) diff --git a/cashu/wallet/mint_info.py b/cashu/wallet/mint_info.py index 84035beb..734425aa 100644 --- a/cashu/wallet/mint_info.py +++ b/cashu/wallet/mint_info.py @@ -2,10 +2,9 @@ from pydantic import BaseModel -from cashu.core.nuts import MPP_NUT, WEBSOCKETS_NUT - from ..core.base import Method, Unit -from ..core.models import Nut15MppSupport +from ..core.models import MintInfoContact, Nut15MppSupport +from ..core.nuts import MPP_NUT, WEBSOCKETS_NUT class MintInfo(BaseModel): @@ -14,7 +13,7 @@ class MintInfo(BaseModel): version: Optional[str] description: Optional[str] description_long: Optional[str] - contact: Optional[List[List[str]]] + contact: Optional[List[MintInfoContact]] motd: Optional[str] nuts: Optional[Dict[int, Any]] diff --git a/cashu/wallet/wallet_deprecated.py b/cashu/wallet/wallet_deprecated.py index 4efccde3..7db58efa 100644 --- a/cashu/wallet/wallet_deprecated.py +++ b/cashu/wallet/wallet_deprecated.py @@ -136,7 +136,7 @@ async def _get_info_deprecated(self) -> GetInfoResponse: GetInfoResponse_deprecated.parse_obj(data) ) mint_info = GetInfoResponse( - **mint_info_deprecated.dict(exclude={"parameter", "nuts"}) + **mint_info_deprecated.dict(exclude={"parameter", "nuts", "contact"}) ) return mint_info