A sample service that pushes a phone notification when a Bitcoin Lightning
payment is received in an Arkade-enabled wallet, built on the official
@arkade-os/sdk and @arkade-os/boltz-swap packages.
Receiving Lightning uses a Boltz reverse submarine swap; the wallet registers
each invoice's pending swap per-payment (opt-in, privacy-friendly), and the
service notifies when it reaches invoice.settled.
- swapWatcher.ts: monitor-only @arkade-os/boltz-swap SwapManager
(enableAutoActions: false) — needs no wallet keys. SwapManager owns the
multiplexed Boltz websocket, polling fallback, and reconnect/backoff.
- paymentService.ts: wires SwapManager events to pushes via
isReverseSuccessStatus (invoice.settled).
- registry.ts: persisted swapId -> {topic, swap} map, resubscribed on restart;
the wallet may redact the preimage since monitoring never claims.
- notifier/: pluggable Notifier interface with an ntfy.sh implementation.
- server.ts: POST/GET/DELETE /register, /health, /simulate (Fastify + zod).
- scripts/demo-receive.ts: wallet side — creates an invoice via
ArkadeSwaps.createLightningInvoice and registers the swap (no raw REST).
- Tests: registry persistence, plus a component test driving the REAL
SwapManager with a mocked globalThis.WebSocket through
register -> settle -> push.
https://claude.ai/code/session_018HhVgswGG7LynM25qTpejq
37 lines
1005 B
JSON
37 lines
1005 B
JSON
{
|
|
"name": "bitcoin-payment-push-service",
|
|
"version": "0.1.0",
|
|
"description": "Sample service that sends a phone push notification when a Bitcoin Lightning payment is received in an Arkade-enabled wallet (Boltz reverse swap).",
|
|
"type": "module",
|
|
"packageManager": "pnpm@10.33.0",
|
|
"engines": {
|
|
"node": ">=20"
|
|
},
|
|
"scripts": {
|
|
"dev": "tsx watch src/index.ts",
|
|
"build": "tsc -p tsconfig.json",
|
|
"start": "node dist/index.js",
|
|
"demo": "tsx scripts/demo-receive.ts",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
},
|
|
"dependencies": {
|
|
"@arkade-os/boltz-swap": "^0.3.38",
|
|
"@arkade-os/sdk": "^0.4.0",
|
|
"dotenv": "^16.4.5",
|
|
"fastify": "^5.2.0",
|
|
"pino": "^9.5.0",
|
|
"pino-pretty": "^13.0.0",
|
|
"ws": "^8.18.0",
|
|
"zod": "^3.24.1"
|
|
},
|
|
"devDependencies": {
|
|
"@types/node": "^22.10.0",
|
|
"@types/ws": "^8.5.13",
|
|
"tsx": "^4.19.2",
|
|
"typescript": "^5.7.2",
|
|
"vitest": "^2.1.8"
|
|
}
|
|
}
|