Skip to content

Commit 7b29b7a

Browse files
committed
Rename invoice stream method to watch
Rename synchronous and asynchronous invoice SSE method from wait_for_settlement to watch in src/lnbot/client.py and update code examples (also change API key placeholder from "lnbot_..." to "key_..."). Update README to reflect the new method name and add SDK/PyPI/SDK links. Update openapi.json server URL to https://api.ln.bot and expand keywords in pyproject.toml.
1 parent 3de1242 commit 7b29b7a

File tree

4 files changed

+30
-18
lines changed

4 files changed

+30
-18
lines changed

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ Give your AI agents, apps, and services access to Bitcoin over the Lightning Net
1212
```python
1313
from lnbot import LnBot
1414

15-
ln = LnBot(api_key="lnbot_...")
15+
ln = LnBot(api_key="key_...")
1616

1717
invoice = ln.invoices.create(amount=1000, memo="Coffee")
1818
ln.payments.create(target="alice@ln.bot", amount=500)
1919
```
2020

21-
> LnBot also ships a **[TypeScript SDK](https://www.npmjs.com/package/@lnbot/sdk)**, **[CLI](https://ln.bot/docs)**, and **[MCP server](https://ln.bot/docs)**.
21+
> LnBot also ships a **[TypeScript SDK](https://www.npmjs.com/package/@lnbot/sdk)**, **[Go SDK](https://pkg.go.dev/github.com/lnbotdev/go-sdk)**, **[Rust SDK](https://crates.io/crates/lnbot)**, **[CLI](https://ln.bot/docs)**, and **[MCP server](https://ln.bot/docs)**.
2222
2323
---
2424

@@ -57,7 +57,7 @@ print(invoice.bolt11)
5757
### 3. Wait for payment
5858

5959
```python
60-
for event in ln.invoices.wait_for_settlement(invoice.number):
60+
for event in ln.invoices.watch(invoice.number):
6161
if event.event == "settled":
6262
print("Paid!")
6363
```
@@ -85,11 +85,11 @@ Every method has an async equivalent via `AsyncLnBot`:
8585
```python
8686
from lnbot import AsyncLnBot
8787

88-
async with AsyncLnBot(api_key="lnbot_...") as ln:
88+
async with AsyncLnBot(api_key="key_...") as ln:
8989
wallet = await ln.wallets.current()
9090
invoice = await ln.invoices.create(amount=1000)
9191

92-
async for event in ln.invoices.wait_for_settlement(invoice.number):
92+
async for event in ln.invoices.watch(invoice.number):
9393
if event.event == "settled":
9494
print("Paid!")
9595
```
@@ -121,7 +121,7 @@ except LnBotError as e:
121121
from lnbot import LnBot
122122

123123
ln = LnBot(
124-
api_key="lnbot_...", # or set LNBOT_API_KEY env var
124+
api_key="key_...", # or set LNBOT_API_KEY env var
125125
base_url="https://api.ln.bot", # optional — this is the default
126126
timeout=30.0, # optional — request timeout in seconds
127127
)
@@ -148,7 +148,7 @@ The API key can also be provided via the `LNBOT_API_KEY` environment variable. I
148148
| `ln.invoices.create(amount=, memo=, reference=)` | Create a BOLT11 invoice |
149149
| `ln.invoices.list(limit=, after=)` | List invoices |
150150
| `ln.invoices.get(number)` | Get invoice by number |
151-
| `ln.invoices.wait_for_settlement(number, timeout=)` | SSE stream for settlement/expiry |
151+
| `ln.invoices.watch(number, timeout=)` | SSE stream for settlement/expiry |
152152

153153
### Payments
154154

@@ -211,7 +211,13 @@ The API key can also be provided via the `LNBOT_API_KEY` environment variable. I
211211
- [ln.bot](https://ln.bot) — website
212212
- [Documentation](https://ln.bot/docs)
213213
- [GitHub](https://github.com/lnbotdev)
214-
- [TypeScript SDK](https://www.npmjs.com/package/@lnbot/sdk)
214+
- [PyPI](https://pypi.org/project/lnbot/)
215+
216+
## Other SDKs
217+
218+
- [TypeScript SDK](https://github.com/lnbotdev/typescript-sdk) · [npm](https://www.npmjs.com/package/@lnbot/sdk)
219+
- [Go SDK](https://github.com/lnbotdev/go-sdk) · [pkg.go.dev](https://pkg.go.dev/github.com/lnbotdev/go-sdk)
220+
- [Rust SDK](https://github.com/lnbotdev/rust-sdk) · [crates.io](https://crates.io/crates/lnbot) · [docs.rs](https://docs.rs/lnbot)
215221

216222
## License
217223

openapi.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
},
77
"servers": [
88
{
9-
"url": "https://localhost:52749"
10-
},
11-
{
12-
"url": "http://localhost:52750"
9+
"url": "https://api.ln.bot"
1310
}
1411
],
1512
"paths": {

pyproject.toml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,22 @@ keywords = [
1414
"lnbot",
1515
"lightning",
1616
"lightning-network",
17+
"lightning-payments",
18+
"lightning-address",
19+
"lightning-wallet",
1720
"bitcoin",
18-
"payments",
19-
"wallet",
21+
"bitcoin-payments",
2022
"bolt11",
23+
"lnurl",
2124
"sats",
25+
"payments",
26+
"invoices",
27+
"wallet",
28+
"micropayments",
2229
"ai-agent",
30+
"ai-payments",
2331
"mcp",
32+
"model-context-protocol",
2433
"sdk",
2534
]
2635
classifiers = [

src/lnbot/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def get(self, number: int) -> InvoiceResponse:
137137
"""Get a single invoice by its number."""
138138
return parse(InvoiceResponse, self._c._get(f"/v1/invoices/{number}"))
139139

140-
def wait_for_settlement(self, number: int, *, timeout: int | None = None) -> Iterator[InvoiceEvent]:
140+
def watch(self, number: int, *, timeout: int | None = None) -> Iterator[InvoiceEvent]:
141141
"""Stream SSE events until the invoice is settled or expires."""
142142
params = _qs({"timeout": timeout})
143143
headers = {"Accept": "text/event-stream", "User-Agent": _USER_AGENT}
@@ -280,7 +280,7 @@ def passkey_complete(self, *, session_id: str, assertion: dict[str, Any]) -> Res
280280
class LnBot:
281281
"""Synchronous LnBot API client.
282282
283-
>>> with LnBot(api_key="lnbot_...") as ln:
283+
>>> with LnBot(api_key="key_...") as ln:
284284
... wallet = ln.wallets.current()
285285
"""
286286

@@ -397,7 +397,7 @@ async def get(self, number: int) -> InvoiceResponse:
397397
"""Get a single invoice by its number."""
398398
return parse(InvoiceResponse, await self._c._get(f"/v1/invoices/{number}"))
399399

400-
async def wait_for_settlement(self, number: int, *, timeout: int | None = None) -> AsyncIterator[InvoiceEvent]:
400+
async def watch(self, number: int, *, timeout: int | None = None) -> AsyncIterator[InvoiceEvent]:
401401
"""Stream SSE events until the invoice is settled or expires."""
402402
params = _qs({"timeout": timeout})
403403
headers = {"Accept": "text/event-stream", "User-Agent": _USER_AGENT}
@@ -540,7 +540,7 @@ async def passkey_complete(self, *, session_id: str, assertion: dict[str, Any])
540540
class AsyncLnBot:
541541
"""Asynchronous LnBot API client.
542542
543-
>>> async with AsyncLnBot(api_key="lnbot_...") as ln:
543+
>>> async with AsyncLnBot(api_key="key_...") as ln:
544544
... wallet = await ln.wallets.current()
545545
"""
546546

0 commit comments

Comments
 (0)