diff --git a/lnbits/extensions/example/README.md b/lnbits/extensions/example/README.md deleted file mode 100644 index 27729459..00000000 --- a/lnbits/extensions/example/README.md +++ /dev/null @@ -1,11 +0,0 @@ -
curl -H "Content-type: application/json" -X POST https://YOUR-LNBITS/YOUR-EXTENSION/api/v1/EXAMPLE -d '{"amount":"100","memo":"example"}' -H "X-Api-Key: YOUR_WALLET-ADMIN/INVOICE-KEY"
diff --git a/lnbits/extensions/example/__init__.py b/lnbits/extensions/example/__init__.py
deleted file mode 100644
index a78330e9..00000000
--- a/lnbits/extensions/example/__init__.py
+++ /dev/null
@@ -1,34 +0,0 @@
-import asyncio
-
-from fastapi import APIRouter
-from fastapi.staticfiles import StaticFiles
-
-from lnbits.db import Database
-from lnbits.helpers import template_renderer
-from lnbits.tasks import catch_everything_and_restart
-
-db = Database("ext_example")
-
-example_ext: APIRouter = APIRouter(prefix="/example", tags=["example"])
-
-example_static_files = [
- {
- "path": "/example/static",
- "app": StaticFiles(packages=[("lnbits", "extensions/example/static")]),
- "name": "example_static",
- }
-]
-
-
-def example_renderer():
- return template_renderer(["lnbits/extensions/example/templates"])
-
-
-from .tasks import wait_for_paid_invoices
-from .views import * # noqa: F401,F403
-from .views_api import * # noqa: F401,F403
-
-
-def tpos_start():
- loop = asyncio.get_event_loop()
- loop.create_task(catch_everything_and_restart(wait_for_paid_invoices))
diff --git a/lnbits/extensions/example/config.json b/lnbits/extensions/example/config.json
deleted file mode 100644
index 46e84ce4..00000000
--- a/lnbits/extensions/example/config.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "name": "Build your own!",
- "short_description": "Extension building guide",
- "tile": "/example/static/bitcoin-extension.png",
- "contributors": ["github_username"]
-}
diff --git a/lnbits/extensions/example/crud.py b/lnbits/extensions/example/crud.py
deleted file mode 100644
index 8e5508fb..00000000
--- a/lnbits/extensions/example/crud.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# crud.py is for communication with your extensions database
-
-# add your dependencies here
-
-# add your fnctions here
diff --git a/lnbits/extensions/example/migrations.py b/lnbits/extensions/example/migrations.py
deleted file mode 100644
index 9d37d977..00000000
--- a/lnbits/extensions/example/migrations.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# migrations.py is for building your database
-
-# async def m001_initial(db):
-# await db.execute(
-# f"""
-# CREATE TABLE example.example (
-# id TEXT PRIMARY KEY,
-# wallet TEXT NOT NULL,
-# time TIMESTAMP NOT NULL DEFAULT {db.timestamp_now}
-# );
-# """
-# )
diff --git a/lnbits/extensions/example/models.py b/lnbits/extensions/example/models.py
deleted file mode 100644
index bfeb7517..00000000
--- a/lnbits/extensions/example/models.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# from pydantic import BaseModel
-
-# class Example(BaseModel):
-# id: str
-# wallet: str
diff --git a/lnbits/extensions/example/static/bitcoin-extension.png b/lnbits/extensions/example/static/bitcoin-extension.png
deleted file mode 100644
index 8366c0c2..00000000
Binary files a/lnbits/extensions/example/static/bitcoin-extension.png and /dev/null differ
diff --git a/lnbits/extensions/example/static/conversion-example.png b/lnbits/extensions/example/static/conversion-example.png
deleted file mode 100644
index 544e6335..00000000
Binary files a/lnbits/extensions/example/static/conversion-example.png and /dev/null differ
diff --git a/lnbits/extensions/example/static/conversion-example2.png b/lnbits/extensions/example/static/conversion-example2.png
deleted file mode 100644
index 7543fdc9..00000000
Binary files a/lnbits/extensions/example/static/conversion-example2.png and /dev/null differ
diff --git a/lnbits/extensions/example/static/fastapi-example.png b/lnbits/extensions/example/static/fastapi-example.png
deleted file mode 100644
index ed309bbe..00000000
Binary files a/lnbits/extensions/example/static/fastapi-example.png and /dev/null differ
diff --git a/lnbits/extensions/example/static/fastapi-example2.png b/lnbits/extensions/example/static/fastapi-example2.png
deleted file mode 100644
index ceacf494..00000000
Binary files a/lnbits/extensions/example/static/fastapi-example2.png and /dev/null differ
diff --git a/lnbits/extensions/example/static/fastapi-framework.png b/lnbits/extensions/example/static/fastapi-framework.png
deleted file mode 100644
index b446ce25..00000000
Binary files a/lnbits/extensions/example/static/fastapi-framework.png and /dev/null differ
diff --git a/lnbits/extensions/example/static/fastapilogo.png b/lnbits/extensions/example/static/fastapilogo.png
deleted file mode 100644
index 57eb6a80..00000000
Binary files a/lnbits/extensions/example/static/fastapilogo.png and /dev/null differ
diff --git a/lnbits/extensions/example/static/qrcode-example.png b/lnbits/extensions/example/static/qrcode-example.png
deleted file mode 100644
index 29781f53..00000000
Binary files a/lnbits/extensions/example/static/qrcode-example.png and /dev/null differ
diff --git a/lnbits/extensions/example/static/qrcode-example1.png b/lnbits/extensions/example/static/qrcode-example1.png
deleted file mode 100644
index a6c748f1..00000000
Binary files a/lnbits/extensions/example/static/qrcode-example1.png and /dev/null differ
diff --git a/lnbits/extensions/example/static/quasar-example.png b/lnbits/extensions/example/static/quasar-example.png
deleted file mode 100644
index 64da65ab..00000000
Binary files a/lnbits/extensions/example/static/quasar-example.png and /dev/null differ
diff --git a/lnbits/extensions/example/static/quasar-framework.png b/lnbits/extensions/example/static/quasar-framework.png
deleted file mode 100644
index c06e8cfa..00000000
Binary files a/lnbits/extensions/example/static/quasar-framework.png and /dev/null differ
diff --git a/lnbits/extensions/example/static/quasarlogo.png b/lnbits/extensions/example/static/quasarlogo.png
deleted file mode 100644
index 69228f86..00000000
Binary files a/lnbits/extensions/example/static/quasarlogo.png and /dev/null differ
diff --git a/lnbits/extensions/example/static/script-example.png b/lnbits/extensions/example/static/script-example.png
deleted file mode 100644
index 813a4254..00000000
Binary files a/lnbits/extensions/example/static/script-example.png and /dev/null differ
diff --git a/lnbits/extensions/example/static/vif-example.png b/lnbits/extensions/example/static/vif-example.png
deleted file mode 100644
index 3e6cfa11..00000000
Binary files a/lnbits/extensions/example/static/vif-example.png and /dev/null differ
diff --git a/lnbits/extensions/example/static/vuejs-framework.png b/lnbits/extensions/example/static/vuejs-framework.png
deleted file mode 100644
index eb634533..00000000
Binary files a/lnbits/extensions/example/static/vuejs-framework.png and /dev/null differ
diff --git a/lnbits/extensions/example/static/vuejslogo.png b/lnbits/extensions/example/static/vuejslogo.png
deleted file mode 100644
index 065c4a89..00000000
Binary files a/lnbits/extensions/example/static/vuejslogo.png and /dev/null differ
diff --git a/lnbits/extensions/example/static/websocket-example.png b/lnbits/extensions/example/static/websocket-example.png
deleted file mode 100644
index 52171d30..00000000
Binary files a/lnbits/extensions/example/static/websocket-example.png and /dev/null differ
diff --git a/lnbits/extensions/example/tasks.py b/lnbits/extensions/example/tasks.py
deleted file mode 100644
index 92319421..00000000
--- a/lnbits/extensions/example/tasks.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# tasks.py is for asynchronous when invoices get paid
-
-# add your dependencies here
-
-import asyncio
-
-from loguru import logger
-
-from lnbits.core.models import Payment
-from lnbits.helpers import get_current_extension_name
-from lnbits.tasks import register_invoice_listener
-
-
-async def wait_for_paid_invoices():
- invoice_queue = asyncio.Queue()
- register_invoice_listener(invoice_queue, get_current_extension_name())
-
- while True:
- payment = await invoice_queue.get()
- await on_invoice_paid(payment)
-
-
-async def on_invoice_paid(payment: Payment) -> None:
- if (
- payment.extra.get("tag") != "example"
- ): # Will grab any payment with the tag "example"
- logger.debug(payment)
- # Do something
- return
diff --git a/lnbits/extensions/example/templates/example/index.html b/lnbits/extensions/example/templates/example/index.html
deleted file mode 100644
index 36d325bb..00000000
--- a/lnbits/extensions/example/templates/example/index.html
+++ /dev/null
@@ -1,451 +0,0 @@
-{% extends "base.html" %} {% from "macros.jinja" import window_vars with context
-%} {% block page %}
-
-
- LNbits API is built using
- FastAPI, a high-performance, easy to code API framework.
- FastAPI auto-generates swagger UI docs for testing endpoints
- /docs
-
views.py
is used for
- setting application routes:
- views_api.py
is used
- for setting application API endpoints:- LNbits uses - Quasar Framework - for frontend deisgn elements. Quasar Framework is an - open-source Vue.js based framework for building apps. -
- - - TIP: Look through -/template
files in
- other extensions for examples of Quasar elements being used.
- In the below example we make a dialogue popup box (box can
- be triggered
-
- LNbits uses - Vue - for best-in-class, responsive and high-performance - components. -
- -Typical example of Vue components in a frontend script:
-
- Content can be conditionally rendered using Vue's
- v-if
:
-
- A magical "g" (ie
- this.g.user.wallets[0].inkey
) is always available, with info about the user, wallets
- and extensions:
-
{% raw %}{{ g }}{% endraw %}
- - LNbits includes a handy - exchange rate function, that streams rates from 6 different sources. -
- Exchange rate API:from lnbits.utils.exchange_rates import
- fiat_amount_as_satoshis
:- For most purposes use Quasar's inbuilt VueQrcode library: -
- -- LNbits does also include a handy - - QR code enpoint -
- {% raw %} You can use via - {{protocol + location}}{% endraw - %}/api/v1/qrcode/some-data-you-want-in-a-qrcode:- Fastapi includes a great - websocket tool -
- {% raw %} -
- A few LNbits extensions also make use of a weird and useful
- websocket/GET tool built into LNbits, such as extensions
- Copilot and LNURLDevices
- You can subscribe to websocket with
- wss:{{location}}/api/v1/ws/{SOME-ID}
- You can post to any clients subscribed to the endpoint with
- {{protocol +
- location}}/api/v1/ws/{SOME-ID}/{THE-DATA-YOU-WANT-TO-POST}
-
-
- Function used in this demo:
-