Add event-sourced wallet and transaction tracking system

Wallets table with 7 seeded wallets, events table for three transaction
types (bank_to_exchange, exchange_to_wallet, wallet_to_wallet). Balances
computed from event credits/debits in sats. REST endpoints for CRUD.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 18:30:48 +01:00
co-authored by Claude Opus 4.6
parent e61f38d4f3
commit 5874952115
8 changed files with 162 additions and 2 deletions
+12 -1
View File
@@ -4,6 +4,7 @@
[integrant.core :as ig]
[pmagnus.btcdata.frankfurter.rates :as rates]
[pmagnus.btcdata.web.controllers.health :as health]
[pmagnus.btcdata.web.controllers.transactions :as tx]
[pmagnus.btcdata.web.middleware.exception :as exception]
[pmagnus.btcdata.web.middleware.formats :as formats]
[reitit.coercion.malli :as malli]
@@ -161,7 +162,17 @@
["/strike/ws"
{:get (fn [req] (ws-strike-handler opts req))
:no-doc true
:middleware []}]])
:middleware []}]
["/wallets"
{:get (fn [req] (tx/list-wallets opts req))
:post (fn [req] (tx/create-wallet! opts req))}]
["/wallets/balances"
{:get (fn [req] (tx/get-wallet-balances opts req))}]
["/wallets/:id/events"
{:get (fn [req] (tx/get-wallet-events opts req))}]
["/events"
{:get (fn [req] (tx/list-events opts req))
:post (fn [req] (tx/create-event! opts req))}]])
(defn route-data [opts]
(merge