aboutsummaryrefslogtreecommitdiffstats
path: root/index.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-03-13 14:16:08 -0700
committerAdam Soltys <[email protected]>2026-03-13 15:14:51 -0700
commit7a241cfb13395ba2218411cb56d2b0a73e758a06 (patch)
tree7d2c304784d8730f2c656014faeb1e7dda6e2cd1 /index.ts
parentd3ee2bbc3baa33140f18a95c3e4b78a797330ad0 (diff)
downloadcoinos-server-7a241cfb13395ba2218411cb56d2b0a73e758a06.tar.gz
coinos-server-7a241cfb13395ba2218411cb56d2b0a73e758a06.zip
ark delegation
Diffstat (limited to 'index.ts')
-rw-r--r--index.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/index.ts b/index.ts
index e04db942..3b33a028 100644
--- a/index.ts
+++ b/index.ts
@@ -2,6 +2,7 @@ import config from "$config";
import app from "$lib/app";
import { sendArk } from "$lib/ark";
import { admin, auth, optional } from "$lib/auth";
+import { getDelegateInfo, receiveDelegation } from "$lib/delegator";
import { g, s } from "$lib/db";
import { fixBolt12, listenForLightning, replay } from "$lib/lightning";
@@ -126,6 +127,25 @@ app.post("/ark/receive", auth, payments.arkReceive);
app.post("/ark/sync", auth, payments.arkSync);
app.post("/bitcoin/sync", auth, payments.bitcoinSync);
+app.get("/v1/delegator/info", async (c) => {
+ try {
+ const info = await getDelegateInfo();
+ return c.json(info);
+ } catch (e: any) {
+ return c.json(e.message, 500);
+ }
+});
+
+app.post("/v1/delegate", async (c) => {
+ try {
+ const body = await c.req.json();
+ await receiveDelegation(body);
+ return c.json({ ok: true });
+ } catch (e: any) {
+ return c.json(e.message, 500);
+ }
+});
+
app.get("/square/connect", auth, square.connect);
app.get("/square/auth", auth, square.auth);
app.post("/square/payment", square.payment);