Skip to content

docs(readme): document USDC amount precision and Idempotency-Key handling - #927

Open
dbdefault wants to merge 2 commits into
Parashield-Protocol:mainfrom
dbdefault:913_912_document_precision_and_idempotency
Open

dbdefault wants to merge 2 commits into
Parashield-Protocol:mainfrom
dbdefault:913_912_document_precision_and_idempotency

Conversation

@dbdefault

Copy link
Copy Markdown

Summary

Adds two README sections that were only in the Swagger description:

  • Amount precision (USDC): which fields UsdcPrecisionValidationMiddleware checks, what it accepts and rejects (more than 7 decimals, non-plain-decimal formats, -0), and an example error.
  • Idempotency: Idempotency-Key on POST/PUT/PATCH, 255-char/line-break validation, 24h caching of 2xx JSON responses, X-Idempotent-Replayed, how concurrent requests behave (wait up to 25s, then 409 IDEMPOTENCY_CONFLICT), and Redis fail-open.

One commit per issue.

Closes #913
Closes #912

How it was checked

Every statement was written from the current source and checked against it: src/common/middleware/usdc-precision-validation.middleware.ts, src/common/middleware/idempotency.middleware.ts, and their registration order in src/main.ts. The new section links point at existing README headings. Docs only; no code, build or tests were run.

Two behaviours that follow from the code and are called out in the text: the idempotency cache key is method + path (no query string) + key, so it is not tied to the caller or the request body; and only the request body is checked for precision, not query parameters. If either is not intended, say so and I will reword.

AI disclosure: prepared with an AI coding assistant; I read the middleware source to confirm each statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant