Skip to content

docs + test(e2e): E2E guide, governance lifecycle test, indexer API reference, notifications README#341

Merged
Levi-Ojukwu merged 5 commits into
Invoice-Liquidity-Network:mainfrom
distributed-nerd:docs/e2e-api-notifications-governance
Jul 3, 2026
Merged

docs + test(e2e): E2E guide, governance lifecycle test, indexer API reference, notifications README#341
Levi-Ojukwu merged 5 commits into
Invoice-Liquidity-Network:mainfrom
distributed-nerd:docs/e2e-api-notifications-governance

Conversation

@distributed-nerd

@distributed-nerd distributed-nerd commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds developer documentation and an end-to-end test across four areas, each as a focused commit.

Closes #273
Closes #282
Closes #296
Closes #287

1. E2E setup & test authoring guide (tests/e2e/README.md)

  • Prerequisites, running the suite locally, and how the Docker Stellar-quickstart node works.
  • The global setup/teardown sequence (setup/globalSetup.ts / globalTeardown.ts).
  • Documents the shared helpers and adds them (tests/e2e/setup/helpers.ts): fundAccount (Friendbot), advanceLedger / getLatestLedger (ledger fast-forward), pollIndexer (async polling).
  • Annotated examples for writing new tests (hermetic indexer-only and opt-in on-chain) plus a debugging guide.

2. Governance proposal lifecycle E2E test (tests/e2e/governance.test.ts)

  • create proposal → vote to quorum → wait out the voting period → advance past the ledger-sequence timelock → execute → verify enforcement by submitting a below-threshold invoice and asserting rejection.
  • Uses the SDK governance methods and the new advanceLedger helper.
  • Skipped by default (like lifecycle.test.ts) unless funded governance secrets and the governance + invoice contract IDs are supplied, keeping the default suite hermetic.

3. Indexer REST API reference (docs/api-reference.md)

  • Every endpoint (/health, /invoices, /invoices/:id, /stats, /stats/history, /reputation/:address, /leaderboard, /events): method, path, query parameters, request body, response schema, and error codes, with a curl example for each.
  • Authentication section (X-API-Key gateway convention), shared conventions, enumerations, and a swagger-jsdoc OpenAPI generation guide.
  • Linked from the indexer README.

4. Notifications service README (notifications/README.md)

  • Service overview + architecture diagram, environment variable reference, full HTTP API (webhooks, Slack, health), a webhook registration walkthrough with curl, the event type catalogue with example payloads, HMAC signature verification in TypeScript/Python/Go, reliability behaviour (circuit breaker, rate limiting, retries), Slack setup, and email (Resend) setup.

All three docs are linked from the root README.md documentation index.

Notes

A few of the issue specs didn't match the current code; the docs/tests were kept faithful to the actual source:

  • The on-chain iln_governance contract has no MIN_INVOICE_AMOUNT action (its actions are UpdateFeeRate/AddToken/RemoveToken/UpdateMaxDiscountRate), and the invoice minimum amount is a fixed ten_pow(decimals), not governance-controlled. The governance test follows the issue's propose→vote→timelock→execute→verify-rejection narrative but is env-parameterized and skipped by default, so it can't produce false passes against the current contracts. A comment block explains this.
  • The indexer enforces no authentication; the API reference documents the X-API-Key gateway convention honestly as not enforced by the indexer core.

Testing

The test suites were not run here — they require Docker (stellar-quickstart) and the e2e/sdk node_modules (not installed in this environment). The new test follows the existing tests' import patterns and SDK signatures.

shaaibu7 added 4 commits June 29, 2026 15:32
Add tests/e2e/README.md covering prerequisites, running the suite,
the Docker node setup, the global setup/teardown sequence, the shared
test helpers (account funding, ledger advance, indexer polling), how to
write a new test (annotated examples for both hermetic indexer tests and
opt-in on-chain tests), and a debugging guide.

Add tests/e2e/setup/helpers.ts with the documented helpers (fundAccount,
advanceLedger, getLatestLedger, pollIndexer) so contributors reuse them
instead of duplicating polling/funding logic.

Link the guide (plus the API reference and notifications service docs)
from the root README documentation index.
Add tests/e2e/governance.test.ts exercising the full governance loop:
create a proposal to change MIN_INVOICE_AMOUNT, cast votes to pass
quorum, wait out the voting period, advance past the ledger-sequence
timelock, execute the proposal, and verify the change is enforced by
submitting a below-threshold invoice and asserting the main contract
rejects it.

Uses the shared advanceLedger helper for the timelock fast-forward and
the SDK governance methods. Skipped by default (like lifecycle.test.ts)
and only runs when funded gov secrets and the governance + invoice
contract IDs are supplied, keeping the default suite hermetic.
Add docs/api-reference.md documenting every indexer endpoint
(/health, /invoices, /invoices/:id, /stats, /stats/history,
/reputation/:address, /leaderboard, /events): method, path, query
parameters, request body, response schema, and error codes, with a curl
example for each. Includes an authentication section (X-API-Key gateway
convention), shared conventions (stroop amounts, timestamps, bps,
pagination), enumerations, and a guide to auto-generating an OpenAPI 3
spec from the route handlers via swagger-jsdoc.

Link the reference from the indexer README.
Expand notifications/README.md into a full integrator guide: service
overview and architecture diagram, environment variable reference, the
complete HTTP API (webhooks, Slack, health), a step-by-step webhook
registration walkthrough with curl examples, the event type catalogue
with example payloads, HMAC signature verification examples in
TypeScript, Python, and Go, reliability behaviour (circuit breaker,
rate limiting, retries), Slack setup, and an email delivery setup guide
via the Resend adapter.

The root README already links this guide from its documentation index.
@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@distributed-nerd Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Levi-Ojukwu Levi-Ojukwu merged commit 8de63c5 into Invoice-Liquidity-Network:main Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants