Skip to content

Commit

Permalink
NUT-06: add icon URL (cashubtc#604)
Browse files Browse the repository at this point in the history
* mint info icon

* Update cashu/core/models.py

Co-authored-by: Pavol Rusnak <[email protected]>

* Update cashu/mint/router.py

Co-authored-by: Pavol Rusnak <[email protected]>

* Update cashu/wallet/mint_info.py

Co-authored-by: Pavol Rusnak <[email protected]>

* fix setting

---------

Co-authored-by: Pavol Rusnak <[email protected]>
  • Loading branch information
callebtc and prusnak authored Sep 8, 2024
1 parent 9eb66a4 commit ef5aee9
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions cashu/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class GetInfoResponse(BaseModel):
description_long: Optional[str] = None
contact: Optional[List[MintInfoContact]] = None
motd: Optional[str] = None
icon_url: Optional[str] = None
time: Optional[int] = None
nuts: Optional[Dict[int, Any]] = None

Expand Down
3 changes: 3 additions & 0 deletions cashu/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class MintInformation(CashuSettings):
mint_info_description_long: str = Field(default=None)
mint_info_contact: List[List[str]] = Field(default=[])
mint_info_motd: str = Field(default=None)
mint_info_icon_url: str = Field(default=None)


class WalletSettings(CashuSettings):
Expand Down Expand Up @@ -201,11 +202,13 @@ class LndRestFundingSource(MintSettings):
mint_lnd_rest_invoice_macaroon: Optional[str] = Field(default=None)
mint_lnd_enable_mpp: bool = Field(default=False)


class LndRPCFundingSource(MintSettings):
mint_lnd_rpc_endpoint: Optional[str] = Field(default=None)
mint_lnd_rpc_cert: Optional[str] = Field(default=None)
mint_lnd_rpc_macaroon: Optional[str] = Field(default=None)


class CLNRestFundingSource(MintSettings):
mint_clnrest_url: Optional[str] = Field(default=None)
mint_clnrest_cert: Optional[str] = Field(default=None)
Expand Down
1 change: 1 addition & 0 deletions cashu/mint/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ async def info() -> GetInfoResponse:
description_long=settings.mint_info_description_long,
contact=contact_info,
nuts=mint_features,
icon_url=settings.mint_info_icon_url,
motd=settings.mint_info_motd,
time=int(time.time()),
)
Expand Down
1 change: 1 addition & 0 deletions cashu/wallet/mint_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class MintInfo(BaseModel):
description_long: Optional[str]
contact: Optional[List[MintInfoContact]]
motd: Optional[str]
icon_url: Optional[str]
time: Optional[int]
nuts: Optional[Dict[int, Any]]

Expand Down
2 changes: 1 addition & 1 deletion cashu/wallet/v1_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ async def mint_quote(self, amount: int, unit: Unit) -> PostMintQuoteResponse:
Raises:
Exception: If the mint request fails
"""
logger.trace("Requesting mint: GET /v1/mint/bolt11")
logger.trace("Requesting mint: POST /v1/mint/bolt11")
payload = PostMintQuoteRequest(unit=unit.name, amount=amount)
resp = await self.httpx.post(
join(self.url, "/v1/mint/quote/bolt11"), json=payload.dict()
Expand Down
1 change: 1 addition & 0 deletions cashu/wallet/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def __init__(self, url: str, db: str, name: str = "no_name", unit: str = "sat"):
self.proofs: List[Proof] = []
self.name = name
self.unit = Unit[unit]

url = url.rstrip("/")
super().__init__(url=url, db=self.db)
logger.debug("Wallet initialized")
Expand Down

0 comments on commit ef5aee9

Please sign in to comment.