From 7a241cfb13395ba2218411cb56d2b0a73e758a06 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 13 Mar 2026 14:16:08 -0700 Subject: ark delegation --- index.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'index.ts') 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); -- cgit v1.2.3