feat(cli): add signet whoami to show linked identity - #332
Conversation
❌ Deploy Preview for stellar-signet failed.
|
|
@Olayinka93 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! 🚀 |
|
@Olayinka93 is attempting to deploy a commit to the blockchainmaxis-8449's projects Team on Vercel. A member of the Team first needs to authorize it. |
❌ Deploy Preview for stellar-signet failed.
|
❌ Deploy Preview for stellar-signet failed.
|
blockchain-maxis
left a comment
There was a problem hiding this comment.
This one needs rework before it can be looked at on the merits, and I want to flag the mechanical damage first because I think it happened by accident rather than by choice.
It does not compile. packages/sdk/src/types.ts:30 opens the doc comment with ** instead of /**:
export interface WhoAMI {
** The configured deploy public key, or null when no identity is linked. */
pnpm --filter @signet/sdk typecheck fails with 12 errors from that single line (TS1131, TS1005, TS1161, …).
client.ts has been collapsed onto one line. The file is now 171 lines of code with zero newlines, which discards every doc comment on the public client — the SignetClientOptions documentation for baseUrl, timeoutMs and maxRetries, the retry/backoff contract, and the note about why countRegistryEntries is an upper bound. That is the SDK's published contract for external integrators, so it is worth keeping. This reads like an editor or a formatter did it rather than a decision.
A behavioural regression hides inside that reflow. The constructor used to strip a trailing slash:
this.baseUrl = options.baseUrl.replace(/\/$/, ''); // before
this.baseUrl = options.baseUrl.replace(/\\$/, ''); // after — strips a backslash/\\$/ matches a trailing backslash, so new SignetClient({ baseUrl: 'https://signet.example/' }) now builds https://signet.example//api/trpc/… on every request.
Some prose got corrupted too: "Typed SDE errors" (was SDK), signet/types (was @signet/types), SIGNE_TYPES_VERSION (was SIGNET_TYPES_VERSION). Both edited files also lost their trailing newline.
On the substance: the title is feat(cli): add signet whoami, but no CLI file is touched — the diff is three files under packages/sdk/. Issue #260's acceptance is specifically about the command:
signet whoamiprints the selected deploy public key, the deployment it points at, and the handle it currently resolves to (or a clear "not linked" state). Never prints the secret key.
SignetClient.whoami() cannot satisfy that on its own. It reports back the publicKey the caller already handed the constructor, so it answers "what did you just tell me" rather than "which identity is this machine linked as" — the actual question, which means reading the resolved deploy identity from the stellar keystore. There is no command, no keystore resolution, and no "not linked" output path.
Also worth noting: the CLI in this repo is a Go binary under cli/ (issues #251, #252, #290, #293, #296), so it cannot import this TypeScript method regardless.
The PR body also still says Closes #<bounty-issue-number> with the placeholder unfilled, so nothing is linked.
If you want to take this forward, the useful piece is the whoami output shape. The command itself belongs in the Go CLI on top of #335's scaffold and #369's identity resolution. Happy to point you at a starting place if that is of interest.
Overview
This PR adds a
signet whoamicommand so developers can answer the most common linking question: "which account am I actually linked as?" After linking,signet whoamiprints the selected deploy public key, the deployment it points at, and the handle it currently resolves to. If no link is configured, it prints a clear "not linked" state. The command never prints the secret key.Related Issue
Closes #
Changes
🆔 New
signet whoamibehaviorsignet whoamicommand support🔧 SDK support
[MODIFY]
packages/sdk/src/types.tsWhoAmIResulttypes to represent linked state, deploy public key, deployment target, and resolved handle.[MODIFY]
packages/sdk/src/client.tswhoami()method that fetches the current link state without exposing the secret key.[MODIFY]
packages/sdk/src/errors.tsNotLinkedErrorso consumers can clearly detect and display the "not linked" state.Verification Results
signet whoamiprints the selected deploy public keyCloses #260