You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+87-1Lines changed: 87 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,8 @@ It handles wallet creation, transaction orchestration, fee sponsorship, and on-c
33
33
34
34
## API Endpoints
35
35
36
+
All routes below are served under the `/v1` prefix (e.g. `GET /v1/health`). See [docs/API-VERSIONING.md](docs/API-VERSIONING.md) for the versioning strategy.
37
+
36
38
### Health & Monitoring
37
39
38
40
#### `GET /health`
@@ -391,8 +393,93 @@ The middleware is registered in `src/main.ts` and runs for all incoming requests
391
393
392
394
---
393
395
396
+
## Balance Indexer
397
+
398
+
The balance indexer provides fast, cached balance reads without hitting Stellar Horizon on every request.
Balances older than `BALANCE_STALE_THRESHOLD_MS` (default 5 minutes) trigger an async background refresh on the next read. The stale value is still returned immediately so callers are never blocked.
423
+
424
+
### Mismatch Handling
425
+
426
+
On reconciliation, if the indexed balance differs from the on-chain balance, the indexed value is corrected and `mismatchDetectedAt` / `reconciliationAttempts` are updated for observability.
427
+
428
+
### Sync Job Tracking
429
+
430
+
All sync and reconciliation operations create a `BalanceSyncJob` record for audit and observability.
431
+
432
+
### API Endpoints
433
+
434
+
| Method | Path | Description |
435
+
|--------|------|-------------|
436
+
|`GET`|`/balances/wallet/:walletId`| Get cached balances (add `?assetType=NATIVE` for single asset) |
437
+
|`POST`|`/balances/wallet/:walletId/sync`| Manually trigger sync for a single wallet |
438
+
|`POST`|`/balances/sync-all`| Manually trigger full sync for all active wallets (admin) |
439
+
|`POST`|`/balances/wallet/:walletId/reconcile`| Reconcile wallet balance with on-chain state |
440
+
|`POST`|`/balances/reconcile-all`| Reconcile all balances (admin) |
441
+
442
+
### Environment Variables
443
+
444
+
| Variable | Default | Description |
445
+
|----------|---------|-------------|
446
+
|`BALANCE_STALE_THRESHOLD_MS`|`300000`| Age (ms) after which a balance is considered stale |
447
+
|`STELLAR_HORIZON_URL`|`https://horizon-testnet.stellar.org`| Stellar Horizon API URL |
448
+
449
+
---
450
+
451
+
## Webhooks
452
+
453
+
Webhooks allow your application to receive real-time notifications when events occur in Mux Protocol.
454
+
455
+
### Endpoint CRUD
456
+
457
+
| Method | Path | Description |
458
+
|--------|------|-------------|
459
+
|`POST`|`/webhooks/endpoints`| Register a new webhook endpoint |
460
+
|`GET`|`/webhooks/endpoints/project/:projectId`| List endpoints for a project |
461
+
|`GET`|`/webhooks/endpoints/:id`| Get a specific endpoint |
462
+
|`PUT`|`/webhooks/endpoints/:id`| Update an endpoint |
463
+
|`DELETE`|`/webhooks/endpoints/:id`| Delete an endpoint |
|`GET`|`/webhooks/endpoints/:id/deliveries`| Get delivery history |
466
+
|`POST`|`/webhooks/process-deliveries`| Manually process pending deliveries (admin) |
467
+
468
+
### Payload Signing
469
+
470
+
All webhook payloads are signed with HMAC-SHA256. The `X-Webhook-Signature` header has format `t=<timestamp>,v1=<signature>`. Verify with the secret returned at endpoint creation.
This document summarizes feature flags added for the auth and session endpoints.
4
+
5
+
-`FEATURE_AUTH_API` (boolean, default: false)
6
+
- When `true`, the auth endpoints (`POST /auth/authenticate`, `GET /auth/sessions`, `GET /auth/validate/:authId`) are enabled.
7
+
- When `false` or unset, the endpoints return HTTP 403 (Forbidden) with message: "Feature is not available at this time. (Flag: auth_api)".
8
+
9
+
Notes:
10
+
- The flag is implemented via the existing `FeatureFlagGuard` and the `@FeatureFlag('auth_api')` decorator on the `AuthOrchestratorController`.
11
+
- The guard reads environment variables using the existing pattern: `FEATURE_<FLAG_NAME>=true|false` (e.g. `FEATURE_AUTH_API=true`).
12
+
- Existing unit tests for `FeatureFlagGuard` cover enabled/disabled behavior. The auth controller tests were adjusted to override the guard for isolation.
13
+
14
+
Operational guidance:
15
+
- To enable auth in runtime, set `FEATURE_AUTH_API=true` in the configuration used by the service (env, k8s secret, etc.).
16
+
- Ensure any API gateway or routing changes are coordinated when toggling this flag in production to avoid unexpected client errors.
0 commit comments