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
{{ message }}
Repository navigation
Commit 4a1af79
Browse filesBrowse the repository at this point in the historyBrowse files
fix(token): default role to app-provider so --instance alone resolves the endpoint (#307)
* fix(token): default role to app-provider so --instance alone resolves the endpoint
Endpoint auto-resolution already worked, but every layer defaulted the
role to app-user, so instance-only token commands resolved the app-user
participant instead of the provider. Make app-provider the single
canonical default across the token CLI flags, the shared resolvers
(token.ResolveLedgerEndpoint, localnet.ResolveLedgerEndpoint), the
roleOrDefault/opts.Role fallbacks, and the Web UI roleFromQuery so CLI
and UI stay at parity.
Add endpoint-optional tests: a token verb resolves its ledger endpoint
from --instance alone (default role) and from --instance + --role picks
that role's captured participant port, with --endpoint always optional.
* fix(token): address PR #307 review — UI default, Explorer isolation, endpoint visibility
- Align Tokens frontend DEFAULT_ROLE / tokenQuery omission with app-provider
- Restore shared localnet.ResolveLedgerEndpoint empty-role default to app-user (Explorer)
- Surface resolved host:port + role via resolveEndpoint stderr and activity JSON/UI
- Return ErrUnresolvedLedgerEndpoint from RunMint/RunBurn before instrument checks
- Document --role default change; expand mint/burn/accept/UI regression coverage
* fix(explorer): align empty-role default with shared app-provider resolver
Instead of isolating the token default, keep ResolveLedgerEndpoint at
app-provider and update Explorer CLI flags, Web handlers, and the
Explorer screen so omitting --role / ?role= cannot drift from the
shared resolver. DAR remains app-user.
* fix(dar): default role to app-provider across CLI, UI, and Wallet
Bring DAR list/inspect/upload empty-role fallback and the DAR/Wallet
screen pickers in line with the canonical app-provider default already
used by Tokens and Explorer. Update docs and mocks accordingly.
* fix(token): echo resolved endpoint/role in JSON+UI and pin every role default
Addresses the two open review findings on the endpoint-optional PR.
Finding "endpoint contract not universal": add a shared
api/types.ResolvedEndpoint (endpoint + role) and embed it in the
TokenListResponse, TokenHoldingsResponse, AllocationsResponse, and
PendingTransfersResponse bodies, then populate it at every surface:
- CLI: token ls / balance / allocations / transfers now set the
resolved host:port + role on the JSON envelope (activity already
carried them).
- Web UI: handleTokensList / handleTokenHoldings /
handleAllocationsList / handlePendingTransfersList echo the same
endpoint + role.
Mirror the new fields in frontend/src/api.ts and regenerate the
schema-shape golden (add-only; no SchemaVersion bump).
Finding "partial default coverage": expand
TestCLIRoleFlags_DefaultAppProvider from six builders to every token CLI
builder that carries a --role flag (allocate, allocations,
allocations withdraw/cancel, balance, balances, create, demo, faucet,
party new/ls, summary, transfers), so any verb regressing to app-user
fails loudly.
Add regression tests asserting the endpoint/role fields appear on the
Web UI list/holdings JSON (offline fallback + live endpoint) and the
CLI balance JSON, and update docs/changes-from-proposal.md to describe
the fields precisely.
@@ -289,7 +294,7 @@ The embedded skill docs are the same artifacts that back the Web UI's Agent Skil
289
294
290
295
**Proposal said:** DAR commands connect to participants via the named instance implicitly.
291
296
292
-
**Shipped:** Each `dar` subcommand carries its own connection flags: `--admin-host`, `--token`, `--insecure` (defaults to `true`), `--ca-cert`, `--instance` (alias `--name`), `--role` (default `app-user`). There is no standalone `dar connect` command.
297
+
**Shipped:** Each `dar` subcommand carries its own connection flags: `--admin-host`, `--token`, `--insecure` (defaults to `true`), `--ca-cert`, `--instance` (alias `--name`), `--role` (default `app-provider`). There is no standalone `dar connect` command.
293
298
294
299
**Why:** Per-command connection flags make the DAR subcommands usable against any Ledger API endpoint, not just DevKit-managed instances. This gives operators more flexibility in CI and multi-environment workflows without requiring a running LocalNet registry.
295
300
@@ -406,12 +411,22 @@ The embedded skill docs are the same artifacts that back the Web UI's Agent Skil
406
411
407
412
**Proposal said:** the token commands' connection details were unspecified beyond selecting an instance.
408
413
409
-
**Shipped:** every `token` verb resolves the participant gRPC endpoint from the instance's captured ports when `--endpoint` is omitted — matching the Web UI, which never asks for an endpoint. `--endpoint` stays an explicit override; when no port is captured the command prints a remediation and exits non-zero rather than failing opaquely. `party ls` and `token ls` resolve best-effort (falling back to the registry-only list when offline).
414
+
**Shipped:** every `token` verb resolves the participant gRPC endpoint from the instance's captured ports when `--endpoint` is omitted — matching the Web UI, which never asks for an endpoint. `--endpoint` stays an explicit override; when no port is captured the command prints a remediation and exits non-zero rather than failing opaquely. `party ls` and `token ls` resolve best-effort (falling back to the registry-only list when offline). Successful resolution announces the host:port and role — on CLI stderr for every verb, and as `endpoint`/`role` fields on the shared JSON/UI response bodies (`token ls`, `token balance`, `token allocations`, `token transfers`, `token activity` and their Web UI counterparts, via `api/types.ResolvedEndpoint`) — so operators can see which participant a verb dialed regardless of surface.
410
415
411
416
**Why:** Requiring a hand-typed `--endpoint` on a command the Web UI runs endpoint-free breaks CLI ↔ Web UI parity and makes the common case (`token <verb> --instance foo`) unusable on a running LocalNet.
412
417
413
418
---
414
419
420
+
### `--role` defaults to `app-provider`
421
+
422
+
**Proposal said:** role selection was unspecified; early implementation defaulted `--role` / `?role=` to `app-user`.
423
+
424
+
**Shipped:** every participant-scoped surface falls back to **`app-provider`** when role is omitted: token CLI/UI (`token.DefaultRole`, `roleFromQuery`, `tokenQuery`), Explorer (`internal/localnet.ResolveLedgerEndpoint`, `contracts` / `tx`, Web ACS/transactions handlers, Explorer screen), DAR (`dar --role`, Web DAR list/inspect/upload fallback, DAR screen), and the Wallet screen's role picker. Explicit `--role` / `?role=` / upload `roles` still win.
425
+
426
+
**Why:** The provider participant is the mint/create operator on LocalNet. Defaulting to `app-user` made `--instance` alone resolve the wrong (often uncaptured) participant ledger port, so endpoint auto-resolution looked broken. Aligning every surface on `app-provider` restores instance-only usability and keeps CLI ↔ Web UI on the same participant.
427
+
428
+
---
429
+
415
430
### `token create` issuer defaults to the acting role's party
416
431
417
432
**Proposal said:**`token create` names an issuer but did not specify how a bare alias or role name resolves.
0 commit comments