Skip to content

Release: develop -> main#3784

Merged
TaprootFreak merged 2 commits into
mainfrom
develop
May 28, 2026
Merged

Release: develop -> main#3784
TaprootFreak merged 2 commits into
mainfrom
develop

Conversation

@github-actions
Copy link
Copy Markdown

Automatic Release PR

This PR was automatically created after changes were pushed to develop.

Commits: 1 new commit(s)

Checklist

  • Review all changes
  • Verify CI passes
  • Approve and merge when ready for production

…bot/* (#3783)

* feat(realunit): introduce /quote/* endpoint family, deprecate /brokerbot/*

The `/v1/realunit/brokerbot/*` family was misnamed: only the on-chain
sell-flow ever talks to the Brokerbot smart contract. The price/quote
endpoints (`/price`, `/buyPrice`, `/buyShares`, `/sellPrice`,
`/sellShares`, `/info`) are pricing oracles fed by Aktionariat's REST
API (`/directinvestment/getPrice`, 30 s cache) — and the buy flow
itself is a fiat bank transfer + off-chain `payAndAllocate` call.
Calling that surface "brokerbot" leaked an implementation detail that
isn't even accurate.

Adds the additive `/quote/*` mirror family. Each new route delegates
to the same service method as its `/brokerbot/*` counterpart and
returns the same DTO shape, so the wire format is byte-identical for
existing clients. The legacy `/brokerbot/*` routes are kept and
annotated `deprecated: true` in Swagger so consumers see the
migration target without being broken.

Also adds a CONTRIBUTING section ("RealUnit: /quote/* vs /brokerbot/*")
that lays out which endpoints touch the on-chain Brokerbot vs which
are pure price oracles, so the naming distinction sticks past this PR.

* fix(realunit): address self-review findings on /quote/* refactor

- Move `getQuoteSellShares` out of its accidental position below the
  deprecated `/brokerbot/*` block and into the Quote group next to
  `getQuoteSellPrice`, mirroring the brokerbot ordering.
- Reword the four `/quote/*` summaries from the novel `Quote: …`
  prefix to the controller's standard `Get …` verb form.
- Replace the six deprecated `/brokerbot/*` summary descriptions
  (one of which still claimed the value came `from the Brokerbot
  smart contract`) with neutral pointers to the canonical
  `/quote/*` mirror. Keeps the deprecated routes from contradicting
  the new CONTRIBUTING section.
- Rewrite the CONTRIBUTING table so every `PUT /sell*` route is
  listed with its actual on-chain footprint:
  `/sell`, `/sell/:id/unsigned-transactions` and `/sell/:id/confirm`
  all call `getBrokerbotSellPrice` (viem `readContract`);
  `/sell/:id/broadcast` does not — it only submits the signed tx.

* fix(realunit): align /quote/* section comment with the CONTRIBUTING table

The block comment introducing `/quote/*` still claimed the on-chain
Brokerbot is touched in `unsigned-transactions + broadcast`, but the
table that the previous fix commit put into CONTRIBUTING (and the
service code itself) shows the on-chain reads happen in
`PUT /sell` + `/sell/:id/unsigned-transactions` + `/sell/:id/confirm`
— `/broadcast` only submits the signed transaction. Update the
comment to match.
)

* feat(realunit): pre-fill registration form from existing KYC data

Users with completed DFX KYC who initiate a RealUnit purchase get
sent through the Aktionariat registration flow, where the form
controllers currently start empty. They must retype data the
backend already holds, and `completeRegistration`'s
`isPersonalDataMatching` rejects any deviation byte-for-byte —
turning a one-tap signing step into a guessing game.

Make `GET /v1/realunit/wallet/status` fall back to the underlying
`user_data` record when no `RealUnitRegistration` KycStep exists
yet. The app already consumes `RealUnitWalletStatusDto.userData`
for the merge-existing-registration path; this extends the same
shape to first-time registrations so the form can pre-fill with
values that will pass server-side validation verbatim.

Controller loads the country / nationality / language relations
needed by the new mapper. Mapper degrades gracefully: no
firstname/surname → `userData: undefined` (back to manual entry,
same as before this PR).

* feat(realunit): expose registration state on wallet/status

Add a four-state discriminator (alreadyRegistered, addWallet,
newRegistration, kycRequired) to GET /v1/realunit/wallet/status so the
app can route to the right UX without inferring it locally. isRegistered
is preserved unchanged for backwards compatibility and remains
semantically equivalent to state === alreadyRegistered.

* fix(realunit): address self-review on the registration-state field

- Mark `isRegistered` with `@ApiProperty({ deprecated: true })` so
  Swagger UI and generated clients render the strikethrough — the
  prose-only deprecation in the previous commit relied on consumers
  reading the description text.
- Switch `RealUnitRegistrationState` enum values from camelCase
  (`alreadyRegistered`, …) to the CONTRIBUTING-mandated PascalCase
  (`AlreadyRegistered`, …). The pre-existing `RealUnitRegistrationStatus`
  enum in this file uses snake_case which is also non-compliant, but
  that's a separate consumer-breaking rename and stays out of scope
  here — the new enum follows the rule.
- Reword the `state` field description as four short
  `<value>: <action>` clauses separated by periods instead of the
  arrow-separated single sentence, so the rendered OpenAPI/Swagger
  output stays readable in ASCII-only tooling.

* feat(realunit): expose /registration as canonical endpoint, deprecate /wallet/status

The endpoint that drives the RealUnit registration UX historically lived
under `/v1/realunit/wallet/status`. That path is misleading: the
resource described is the user's Aktionariat registration, not a
generic wallet status, and clients never ask "what is the wallet's
status?" — they ask "what do I need to do to be RealUnit-registered?".

Following the precedent set by the `/quote/*` vs `/brokerbot/*` rename
(PR #3783), this commit:

- adds `GET /v1/realunit/registration` as the canonical endpoint
- keeps `GET /v1/realunit/wallet/status` as a `deprecated: true` mirror
  that calls the same service method and returns the same DTO instance
- renames `RealUnitWalletStatusDto` to `RealUnitRegistrationInfoDto`
  (wire-neutral: TS class names don't appear on the JSON; field names
  `state` / `userData` / `isRegistered` are unchanged)
- renames `RealUnitService.getAddressWalletStatus` to
  `getRegistrationInfo`; both controller routes delegate to it
- extends CONTRIBUTING.md "API Design" with a sister-section to the
  `/quote/*` rename, summarising the old→new mapping and the
  operational consequence (legacy path kept for backwards compatibility
  on existing clients only)
@TaprootFreak TaprootFreak merged commit 921686c into main May 28, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant