Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
2d53deb
webapp: test the signed dispute days and the shown dispute end
brenzi-agent Nov 20, 2026
49be171
webapp: sign the dispute days in each registration intent
brenzi-agent Nov 20, 2026
4f9b799
webapp: show until when a registration can be ended for its payment
brenzi-agent Nov 20, 2026
3a8cdbd
webapp: define the RegisterName typed data once for the dev backend
brenzi-agent Nov 20, 2026
82edddd
webapp: give orders paid with a prepaid code 14 dispute days in the mock
brenzi-agent Nov 20, 2026
2087c50
webapp: name the shown dispute end as the view does
brenzi-agent Nov 20, 2026
822b774
webapp: test other signed dispute days and registered names with a di…
brenzi-agent Nov 20, 2026
945adf1
webapp: word the dispute end as decided
brenzi-agent Nov 20, 2026
66703cb
webapp: name PR #51's contracts in the dev backend's comments
brenzi-agent Nov 20, 2026
7fb0ab6
webapp: show a registration ended in its dispute period
brenzi-agent Nov 20, 2026
069946a
webapp: record the registered and ended order screens
brenzi-agent Nov 20, 2026
b0eed4e
webapp: abbreviate a long name in the registered page's app card
brenzi-agent Nov 20, 2026
18ff106
webapp: test the ended order's views and a dispute end that passes
brenzi-agent Nov 20, 2026
f00eb87
webapp: pin the dev chain's contracts to ens-contracts at ebf7698
brenzi-agent Nov 20, 2026
58e2d83
webapp: stop saying an ended registration's name is free to register
brenzi-agent Nov 20, 2026
f95d2c5
webapp: say the dispute end before saying the name code is elsewhere
brenzi-agent Nov 20, 2026
d4d65c6
webapp: show a name ended on chain as ended before the service does
brenzi-agent Nov 20, 2026
f7701a9
webapp: offer a code, not a search, on an ended page in codes-only mode
brenzi-agent Nov 20, 2026
5b8372b
webapp: give an ended order no expiry in the mock, as the service does
brenzi-agent Nov 20, 2026
1bec4f9
webapp: name an order's outcomes apart from the phase ended
brenzi-agent Nov 20, 2026
19952cb
webapp: take the dispute end off an open page once it passes
brenzi-agent Nov 20, 2026
56e900a
webapp: give screen readers the whole name an app card abbreviates
brenzi-agent Nov 20, 2026
4d9c94c
webapp: add screen states for an ended name's row and Edit links
brenzi-agent Nov 20, 2026
fb4e5a4
webapp: move a screen state and two assertions off PR #19's lines
brenzi-agent Nov 20, 2026
e9fedb0
webapp: move the dispute end's wake off PR #19's changed line
brenzi-agent Nov 20, 2026
f79fbbd
webapp: keep the app card's name out of the screens' countdown mask
brenzi-agent Nov 20, 2026
0a9ccb6
webapp: record the ended row, ended Edit links and changed order screens
brenzi-agent Nov 20, 2026
35f68ac
webapp: restore the spacing of a test line the branch changed
brenzi-agent Nov 20, 2026
6930baa
webapp: test the dispute period before paying and a reveal over it
brenzi-agent Nov 20, 2026
8d7e8fb
webapp: say on Check your order how long a registration can be ended
brenzi-agent Nov 20, 2026
85918b5
webapp: sign no registration over more days than its payment allows
brenzi-agent Nov 20, 2026
f82d6e5
webapp: add the screen state of a registration not signed for its days
brenzi-agent Nov 20, 2026
ce79a35
webapp: correct two dev comments, as approved
brenzi-agent Nov 20, 2026
18ae51e
webapp: put the dispute period above the code link, off PR #19's line
brenzi-agent Nov 20, 2026
d9b8da1
webapp: put the days refusal's notice off PR #19's changed lines
brenzi-agent Nov 20, 2026
2ec65a2
webapp: expect the checkout's balance days in its initial state
brenzi-agent Nov 20, 2026
eecee02
webapp: test the dispute period row, a long name in the card and the …
brenzi-agent Nov 20, 2026
e1024be
webapp: draw Check your order as compactly in every state
brenzi-agent Nov 20, 2026
7d20283
webapp: show the dispute period as a row of the order, its sentence a…
brenzi-agent Nov 20, 2026
da9e6e4
webapp: word the notice of an order not signed for its days as decided
brenzi-agent Nov 20, 2026
c13417a
webapp: abbreviate a long name in Check your order's card, as decided
brenzi-agent Nov 20, 2026
495ee64
webapp: test the dispute row's hint and an abbreviated name's chats
brenzi-agent Nov 20, 2026
2f18e41
webapp: keep an abbreviated name's chats right, mark the days on hover
brenzi-agent Nov 20, 2026
626b242
webapp: sign a contract test's other days within those the page signs
brenzi-agent Nov 20, 2026
af1fa69
webapp: record the review screens with their row and the days refusal
brenzi-agent Nov 20, 2026
325af42
webapp: record an abbreviated name's chats at the row's right
brenzi-agent Nov 20, 2026
59c04dc
webapp: test that the card reads a long name once, whole
brenzi-agent Nov 20, 2026
b8f54ab
webapp: read a name the card abbreviates once, whole
brenzi-agent Nov 20, 2026
140944d
webapp: test a balance's days, a held review's fit and a declined reveal
brenzi-agent Nov 20, 2026
2518b9e
webapp: give each balance in the mock the dispute days it pays for
brenzi-agent Nov 20, 2026
0b325b5
webapp: take a balance's dispute days with it, as the service gives them
brenzi-agent Nov 20, 2026
c21d18b
webapp: sign a balance order once its paying balance's days are read
brenzi-agent Nov 20, 2026
6b37724
webapp: show a registration ended only once the service's view says so
brenzi-agent Nov 20, 2026
b3ff4de
webapp: announce an order not signed for its days, with no lead to wait
brenzi-agent Nov 20, 2026
3630738
webapp: abbreviate a long name in the balance's line too, read whole
brenzi-agent Nov 20, 2026
9528b56
webapp: draw a review holding a line tighter, so it fits with its days
brenzi-agent Nov 20, 2026
adb8b45
webapp: keep I have a code's tap area off the payment methods' cards
brenzi-agent Nov 20, 2026
ccd569a
webapp: word the README's dispute period and ended order as done to data
brenzi-agent Nov 20, 2026
6742f8f
webapp: pass a held read on once released in the balance's days test
brenzi-agent Nov 20, 2026
b617d2c
webapp: record the review screens holding a line and the days refusal
brenzi-agent Nov 20, 2026
0e42038
webapp: test the days limit, Edit links before an end and older balances
brenzi-agent Nov 20, 2026
917a0b7
webapp: limit a reveal's days by the payment this browser recorded
brenzi-agent Nov 20, 2026
4f7fc2b
webapp: decide an order's payment once, allowing a balance alone 14 days
brenzi-agent Nov 20, 2026
f4c8ceb
webapp: leave out the dispute period once the review's own order is paid
brenzi-agent Nov 20, 2026
51a378d
webapp: read a name the chain unregistered again, with no Edit links
brenzi-agent Nov 20, 2026
ad70632
webapp: take no balance an older page kept without its dispute days
brenzi-agent Nov 20, 2026
bc039c5
webapp: name a declined reveal's error DisputeDaysDeclined, as its event
brenzi-agent Nov 20, 2026
83b56c6
webapp: word the README's balance days and ended order as data acted on
brenzi-agent Nov 20, 2026
2c7d641
webapp: record the review whose own order took the balance, without days
brenzi-agent Nov 20, 2026
8e14819
webapp: test a reopened order's payment and a reveal's corrected days
brenzi-agent Nov 21, 2026
a4c5979
webapp: keep this browser's payment of an order its code reopens
brenzi-agent Nov 21, 2026
30c0b84
webapp: sign a declined reveal once the service corrects its days
brenzi-agent Nov 21, 2026
10a20fe
webapp: take a balance's dispute days only for an order paid from it
brenzi-agent Nov 21, 2026
e9fdd49
webapp: use paymentOf and foundOrder at every site of their pattern
brenzi-agent Nov 21, 2026
a4e3865
webapp: make the card row's long name, read whole, in one function
brenzi-agent Nov 21, 2026
f04f3f7
webapp: state the README's dispute period rules one to a sentence
brenzi-agent Nov 21, 2026
8adf004
Merge remote-tracking branch 'origin/names' into ep/webapp-dispute-days
evgeny-simplex Nov 23, 2026
c72b17b
webapp: screens of Check your order with the Dispute period row, and …
evgeny-simplex Nov 23, 2026
081069e
webapp: contract tests read the dispute end, an ended order and a cod…
evgeny-simplex Nov 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions webapp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The page talks only to the names service under `/api`. In development that servi
- `dev/`: the local chain deployment, the server of its terms' texts, the mock service and `start.sh`.
- `test/`: unit tests (vitest). `e2e/`: browser tests (Playwright) against the dev backend.

The window holds the header, the screen and the invest note; the footer is below the fold, as on the badges store. The purchase steps (search, Links, name code, Community terms for a community name, Check your order, payment) follow one another. Each step, and each screen like one (an order's outcome, Check your code, Edit links), is a frame of one height, 540 px on a laptop and 640 px on a phone, as the mockup draws it, so Back, the heading, the main button and the link under it stand at the same place on every step, for a name of any length; a step without a main button keeps its link at the link's place, and on a laptop a step's last link stays at least 48 px above the invest note. The content runs down from under the heading, so nothing above a change moves. The home keeps its answer's room from the start, so its headline and field never move. A plain name's order waits for its buyer to agree to the general terms on Check your order, whose words link the terms' page at the commit the name policy links; a community name's order waits for its buyer to accept its community terms, which include the general terms, on their own step, which shows their text as the service fetches it by the name policy's link and, for a link to git.simplex.chat or GitHub, links that commit's page. While the terms of a name's kind cannot be read, its search answer says that names can't be ordered right now. A community name is registered for 2 years, even with a code for more, which Check your order then says. On Check your order, I have a code, under the payment choices, opens a code field in their place: a prepaid code that covers the name makes the order free, as the tab's code does, and Remove code, under the main button, brings the payment choices back. A pay page checks its name as it opens and every 5 minutes; when someone has registered it meanwhile, its note turns red and the payment's details are turned off. A prepaid code entered in Check your code registers the names the tab finds for free until it is taken off in the header; a name code entered there finds its order and adds it to Your names, or, reached from an order's page, opens the order it found. Every screen replaces the whole page between the header and the invest note and rises into place (220 ms); the old screen goes at once, so two never show together. What a step adds, such as a search's answer, a notice or a link's profile, fades in (180 ms); a change of theme eases its colours (200 ms). A reader who asks for reduced motion gets none of it.
The window holds the header, the screen and the invest note; the footer is below the fold, as on the badges store. The purchase steps (search, Links, name code, Community terms for a community name, Check your order, payment) follow one another. Each step, and each screen like one (an order's outcome, Check your code, Edit links), is a frame of one height, 540 px on a laptop and 640 px on a phone, as the mockup draws it, so Back, the heading, the main button and the link under it stand at the same place on every step, for a name of any length; a step without a main button keeps its link at the link's place, and on a laptop a step's last link stays at least 48 px above the invest note. The content runs down from under the heading, so nothing above a change moves. The home keeps its answer's room from the start, so its headline and field never move. A plain name's order waits for its buyer to agree to the general terms on Check your order, whose words link the terms' page at the commit the name policy links; a community name's order waits for its buyer to accept its community terms, which include the general terms, on their own step, which shows their text as the service fetches it by the name policy's link and, for a link to git.simplex.chat or GitHub, links that commit's page. While the terms of a name's kind cannot be read, its search answer says that names can't be ordered right now. A community name is registered for 2 years, even with a code for more, which Check your order then says. On Check your order, I have a code, under the payment choices, opens a code field in their place: a prepaid code that covers the name makes the order free, as the tab's code does, and Remove code, under the main button, brings the payment choices back. A pay page checks its name as it opens and every 5 minutes; when someone has registered it meanwhile, its note turns red and the payment's details are turned off. A registered name's page writes a name of more than 25 letters in its Use in the app card as its first 12 letters, "..." and its last 3, so that the page fits a phone's frame; its heading keeps the whole name. On Check your order such a name is written so too, in the card, so that the review with its Dispute period row fits a laptop's frame; screen readers read the whole name in each. Check your order contains a Dispute period row: the number of days after registration during which the registration can be ended if a payment for it is disputed, reversed or refunded in full. Its hint, shown on hover, focus or tap, is the same rule in one sentence. The number is 120 for a card, and 14 for Bitcoin, Monero or a prepaid code; a name selected for a taken order has the number of the order's payment. The page signs each order's registration over these days when it places the order, and signs no registration later over more days than are allowed for its payment, and says so. The payment is taken from this browser's record of the order. Until a registered name's dispute end, its order's page says that the registration can be ended if a payment for it is disputed, reversed or refunded in full. Once the order is ended in the service's view, which the service sets at its hourly check of the chain, the order's page says so when it is next opened, as an open page stops reading a registered order, Your names marks its row Ended, and Edit links edits nothing for it. Until that check, Your names offers no Edit links for a name that the chain has unregistered, and Edit links reads it again every 5 seconds. A prepaid code entered in Check your code registers the names the tab finds for free until it is taken off in the header; a name code entered there finds its order and adds it to Your names, or, reached from an order's page, opens the order it found. Every screen replaces the whole page between the header and the invest note and rises into place (220 ms); the old screen goes at once, so two never show together. What a step adds, such as a search's answer, a notice or a link's profile, fades in (180 ms); a change of theme eases its colours (200 ms). A reader who asks for reduced motion gets none of it.

## Run everything with Docker

Expand All @@ -44,12 +44,13 @@ npx playwright install chromium firefox webkit

The backend needs two things outside this repo:

1. The contracts: ens-contracts at PR #47 (6ccb5c5, whose name policy links the terms of each kind), the submodule of [simplex-namespace-contract](https://github.com/brenzi/simplex-namespace-contract) at its main (e3ba0a5, PR #10), whose `test/fixtures/terms/` holds the terms' texts, compiled:
1. The contracts: ens-contracts at ebf7698 (PR #51, in which each sponsored registration has a dispute period), the submodule of [simplex-namespace-contract](https://github.com/brenzi/simplex-namespace-contract) at its main (e3ba0a5, PR #10), whose `test/fixtures/terms/` holds the terms' texts, compiled:

```
git clone https://github.com/brenzi/simplex-namespace-contract.git && cd simplex-namespace-contract
git fetch origin e3ba0a50d9475dab8336b5a4026ab0fc5f79ebd4 && git checkout e3ba0a5
git submodule update --init ens-contracts && cd ens-contracts
git checkout ebf7698
npx pnpm@9 install --frozen-lockfile --ignore-scripts
npx hardhat compile
```
Expand All @@ -67,6 +68,8 @@ npm run dev

`MIN_COMMITMENT_AGE` is the seconds a registration waits after its commit; the contracts' deploy scripts use 60.

Each order's view in the mock contains the dispute days that the owner signs in its reveal, those of its payment: 120 for a card, 14 for Bitcoin, Monero or a prepaid code; a name selected for a taken order keeps its order's. Once the name is registered, the view's `registered` phase contains the registrar's dispute end.

Without a Stripe key the dev server shows a stand-in card form, labelled as a test, whose Pay button acts as a submitted card; the production build never has the stand-in, and shows that the card form did not load. The page reads the key from `GET /api/config`, which the mock answers with none. To see Stripe's own form in development, make the mock's answer carry a test publishable key (`pk_test_…`, from the Stripe dashboard in test mode) and keep it out of commits; the mock's client secrets are not Stripe's, so no card can be confirmed against it: that needs the service, with the account's test secret key (`sk_test_…`).

### Mock controls
Expand All @@ -82,6 +85,7 @@ Tests and manual checks advance orders with `POST` requests to the mock:
| `/control/overdue/<invoice>` | the invoice's rate window ends now; the next request that meets it expires it, unless money reached it |
| `/control/fail/<registration>` | the next commit fails |
| `/control/lapse/<registration>` | a committed order not signed yet runs out of time for its reveal and fails |
| `/control/unregister/<registration>` | the contracts' owner unregisters a registered order's name in its dispute period, as the guardian or the admin does for a disputed, reversed or refunded payment: the name is available to anyone at once, and the order is `ended` from then on |
| `/control/take` `{"label"}` | a rival registers the name before the waiting order, whose name is then not selected: a paid order keeps its price as its balance, and a code order keeps its code reserved, until a name is selected for the order, with a new order's checks, and paid from the balance or registered with the code; the code is accepted past its expiry until a calendar month after the take, and refused once revoked |
| `/control/refund/<invoice or registration>` `{"cents"}` | support refunds the order's whole balance, the cents given or all of it, answering the refund, or why not: `no_balance` or `balance_changed` |
| `/control/credit/<registration>` `{"cents"}` | the order's balance grows by the cents, as a later credit (a late payment) grows it |
Expand Down
4 changes: 2 additions & 2 deletions webapp/dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# syntax=docker/dockerfile:1
# The names webapp with its whole dev backend: a local chain with the PR #47 contracts and the mock names service.
# The names webapp with its whole dev backend: a local chain with the PR #51 contracts and the mock names service.
# Built from the simplex.domains repository root, as compose.yaml does: the page's fonts and images live there.

FROM node:24-bookworm AS contracts
ARG NAMESPACE_COMMIT=e3ba0a50d9475dab8336b5a4026ab0fc5f79ebd4
ARG ENS_CONTRACTS_COMMIT=6ccb5c52c80619493db32a4128ee5067f4274ac2
ARG ENS_CONTRACTS_COMMIT=ebf76989ec5cab1c7dd49085b4c18faf303657d0
WORKDIR /src
RUN git clone https://github.com/brenzi/simplex-namespace-contract.git . \
&& git fetch origin "$NAMESPACE_COMMIT" \
Expand Down
22 changes: 7 additions & 15 deletions webapp/dev/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Deploys the .simplex contracts (ens-contracts PR #47) to a running local node for the names webapp,
// wired as the PR's test fixture wires them, and seeds names in every state search can answer.
// Deploys the .simplex contracts (ens-contracts PR #51) to a running local node for the names webapp,
// with the controller and the name policy behind their proxies and the other contracts deployed directly, and seeds names in every state search can answer.
import { readFileSync, writeFileSync } from "node:fs"
import { join } from "node:path"
import {
Expand All @@ -10,6 +10,7 @@ import { mnemonicToAccount, privateKeyToAccount } from "viem/accounts"
import { foundry } from "viem/chains"
import { durationFor } from "../src/crypto/registration.ts"
import { BLOCK_POLL_MS, TERM_START_S, untilChainTime } from "./chain-time.ts"
import { registerNameTypedData } from "./register-name.ts"
import { savedTerms } from "./serve-terms.ts"

const RPC_URL = process.env.RPC_URL ?? "http://127.0.0.1:8545"
Expand All @@ -30,6 +31,7 @@ const PRICE_BASE = 5000n
const PRICE_EXCEPTIONS = [{ labelLength: 7n, priceCentsPerYear: 10000n }, { labelLength: 6n, priceCentsPerYear: 20000n }]
// the seeded names are registered as a paid order is, for paid years from the term start
const SEED_YEARS = 2
const SEED_DISPUTE_DAYS = 120n
// the registrar's credit in USD with 18 decimals, more than any number of test runs spends
const ALLOWANCE = 1_000_000n * 10n ** 18n
// SimplexNamePolicy.Reason.Internal
Expand Down Expand Up @@ -118,14 +120,6 @@ await write(owner, namePolicy, "addCommunityNames", [COMMUNITY_NAMES])
const chainId = await publicClient.getChainId()
const holderAccount = privateKeyToAccount(holderKey)

const REGISTER_TYPES = {
RegisterName: [
{ name: "label", type: "string" }, { name: "owner", type: "address" }, { name: "duration", type: "uint256" },
{ name: "resolver", type: "address" }, { name: "data", type: "bytes[]" }, { name: "nonce", type: "uint256" },
{ name: "deadline", type: "uint256" },
],
} as const

// A name registered to the holder through the sponsor, as the store's service registers names.
function seedRegistration(label: string, records: Record<string, string>, now: number) {
const node = namehash(`${label}.${TLD}`)
Expand Down Expand Up @@ -164,12 +158,10 @@ for (const registration of seeds) {
const nonce = await publicClient.readContract({ ...sponsor, functionName: "nonces", args: [holder.address] }) as bigint
const deadline = (await publicClient.getBlock()).timestamp + 3600n
const signature = await holderAccount.signTypedData({
domain: { name: "SimplexSponsor", version: "1", chainId, verifyingContract: sponsor.address },
types: REGISTER_TYPES,
primaryType: "RegisterName",
message: { ...registration, nonce, deadline },
...registerNameTypedData(chainId, sponsor.address),
message: { ...registration, disputeDays: SEED_DISPUTE_DAYS, nonce, deadline },
})
await write(registrar, sponsor, "registerWithCredit", [registration, nonce, deadline, signature])
await write(registrar, sponsor, "registerWithCredit", [registration, SEED_DISPUTE_DAYS, nonce, deadline, signature])
}

const deployment = {
Expand Down
3 changes: 2 additions & 1 deletion webapp/dev/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createServer, type IncomingMessage, type ServerResponse } from "node:ht
import { isIP } from "node:net"
import { takeCodeToken } from "./mock/limits.ts"
import {
cancelInvoice, checkCode, controlClock, controlCommunity, controlCommunityTerms, controlCredit, controlEdits, controlGeneralTerms, controlInvoice, controlLate, controlMode, controlRate, controlRefund, controlRegistration, controlSearch, controlSeed, controlTake, createInvoice, currentTerms, dump, editRecords, find, findLimited,
cancelInvoice, checkCode, controlClock, controlCommunity, controlCommunityTerms, controlCredit, controlEdits, controlGeneralTerms, controlInvoice, controlLate, controlMode, controlRate, controlRefund, controlRegistration, controlSearch, controlSeed, controlTake, controlUnregister, createInvoice, currentTerms, dump, editRecords, find, findLimited,
HttpError, issueCode, modeNow, oneOrderAtATime, setCodeState, previewLink, readInvoice, readRegistration, registerWithCode, retry, reveal, search, selectName, signFor, siteConfig,
} from "./mock/service.ts"

Expand Down Expand Up @@ -49,6 +49,7 @@ const routes: [string, RegExp, Handler, Limit?][] = [
["POST", /^\/api\/registration\/([^/]+)\/retry$/, (m) => retry(m[1])],
["POST", /^\/control\/(settle|partial|confirming|expire|overdue)\/([^/]+)$/, (m, b) => controlInvoice(m[1], m[2], b)],
["POST", /^\/control\/(fail|stale|unread|lapse)\/([^/]+)$/, (m) => controlRegistration(m[1], m[2])],
["POST", /^\/control\/unregister\/([^/]+)$/, (m) => controlUnregister(m[1])],
["POST", /^\/control\/late\/([^/]+)$/, (m, b) => controlLate(m[1], b.waiting ?? null)],
["POST", /^\/control\/credit\/([^/]+)$/, (m, b) => controlCredit(m[1], b.cents)],
["POST", /^\/control\/take$/, (_, b) => controlTake(b.label)],
Expand Down
Loading
Loading