From ac90f4e4b2b2f1b76433876c7bd8c0fb03046cee Mon Sep 17 00:00:00 2001 From: Tom Smith <142233216+tomsmith8@users.noreply.github.com> Date: Fri, 10 Apr 2026 19:05:30 +0100 Subject: [PATCH] Simplify BoostButton: remove client-side keysend, pass pubkey to boltwall Payment now happens server-side in boltwall. The button just POSTs { refid, amount, pubkey } and the api client handles L402 automatically. Removes sphinx-bridge, isSphinx, and NEXT_PUBLIC_BOOST_PUBKEY. Default boost amount changed from 5 to 10. --- .env.local.example | 3 --- src/components/boost/boost-button.tsx | 38 ++++----------------------- 2 files changed, 5 insertions(+), 36 deletions(-) diff --git a/.env.local.example b/.env.local.example index 7952651..5106997 100644 --- a/.env.local.example +++ b/.env.local.example @@ -4,6 +4,3 @@ NEXT_PUBLIC_API_URL= # Mock mode for local development (skip real API calls) NEXT_PUBLIC_USE_MOCKS=true - -# Pubkey for Lightning boost keysends -NEXT_PUBLIC_BOOST_PUBKEY= diff --git a/src/components/boost/boost-button.tsx b/src/components/boost/boost-button.tsx index bd04253..932b73d 100644 --- a/src/components/boost/boost-button.tsx +++ b/src/components/boost/boost-button.tsx @@ -3,24 +3,19 @@ import { useCallback, useState } from "react" import { Zap } from "lucide-react" import { cn } from "@/lib/utils" -import { isSphinx } from "@/lib/sphinx/detect" import { api } from "@/lib/api" import { useMocks } from "@/lib/mock-data" -// eslint-disable-next-line @typescript-eslint/no-require-imports -const sphinx = require("sphinx-bridge") - -const SPHINX_PUBKEY = process.env.NEXT_PUBLIC_BOOST_PUBKEY ?? "" - -const DEFAULT_BOOST_AMOUNT = 5 +const DEFAULT_BOOST_AMOUNT = 10 interface BoostButtonProps { refId: string + pubkey: string boostCount?: number className?: string } -export function BoostButton({ refId, boostCount = 0, className }: BoostButtonProps) { +export function BoostButton({ refId, pubkey, boostCount = 0, className }: BoostButtonProps) { const [count, setCount] = useState(boostCount) const [boosting, setBoosting] = useState(false) const [flash, setFlash] = useState(false) @@ -30,31 +25,8 @@ export function BoostButton({ refId, boostCount = 0, className }: BoostButtonPro setBoosting(true) try { - if (isSphinx()) { - // Lightning keysend via Sphinx - let res = await sphinx.enable(true) - if (!res) throw new Error("Sphinx enable failed") - - res = await sphinx.keysend(SPHINX_PUBKEY, DEFAULT_BOOST_AMOUNT) - - if (!res?.success) { - // Ask for topup then retry - res = await sphinx.topup() - if (!res) res = await sphinx.authorize() - if (!res?.budget || res.budget < DEFAULT_BOOST_AMOUNT) { - throw new Error("Insufficient budget") - } - res = await sphinx.keysend(SPHINX_PUBKEY, DEFAULT_BOOST_AMOUNT) - if (!res?.success) throw new Error("Keysend failed") - } - } - - // Record boost on backend if (!useMocks()) { - await api.post("/boost", { - amount: DEFAULT_BOOST_AMOUNT, - refid: refId, - }) + await api.post("/boost", { refid: refId, amount: DEFAULT_BOOST_AMOUNT, pubkey }) } setCount((c) => c + DEFAULT_BOOST_AMOUNT) @@ -65,7 +37,7 @@ export function BoostButton({ refId, boostCount = 0, className }: BoostButtonPro } finally { setBoosting(false) } - }, [refId, boosting]) + }, [refId, pubkey, boosting]) return (