Translate expiry to expirySeconds for Phoenixd (#2901)

This commit is contained in:
blackcoffeexbt 2025-01-28 09:54:33 +00:00 committed by GitHub
parent cc33a49b12
commit 73e716085b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,7 +3,7 @@ import base64
import hashlib import hashlib
import json import json
import urllib.parse import urllib.parse
from typing import AsyncGenerator, Dict, Optional from typing import Any, AsyncGenerator, Dict, Optional
import httpx import httpx
from loguru import logger from loguru import logger
@ -100,7 +100,7 @@ class PhoenixdWallet(Wallet):
try: try:
msats_amount = amount msats_amount = amount
data: Dict = { data: Dict[str, Any] = {
"amountSat": f"{msats_amount}", "amountSat": f"{msats_amount}",
"externalId": "", "externalId": "",
} }
@ -119,6 +119,9 @@ class PhoenixdWallet(Wallet):
else: else:
data["description"] = desc data["description"] = desc
# if expiry is not set, it defaults to 3600 seconds (1 hour)
data["expirySeconds"] = int(kwargs.get("expiry", 3600))
r = await self.client.post( r = await self.client.post(
"/createinvoice", "/createinvoice",
data=data, data=data,