Skip to content

chore(close-account): rename UserState to User#29

Merged
mikemaccana merged 2 commits into
quicknode:mainfrom
mikemaccana-edwardbot:chore/rename-user-state-to-user
May 15, 2026
Merged

chore(close-account): rename UserState to User#29
mikemaccana merged 2 commits into
quicknode:mainfrom
mikemaccana-edwardbot:chore/rename-user-state-to-user

Conversation

@mikemaccana-edwardbot
Copy link
Copy Markdown

What

Rename the UserState struct to User in the basics/close-account example (Anchor and Quasar ports).

Why

Repo-wide convention: state structs do not carry the State suffix. The struct is the data; "state" is implicit in being an on-chain account. Same idea as Offer not being called OfferState, or Counter not being CounterState.

Renames

  • Anchor:
    • pub struct UserStatepub struct User in programs/close-account/src/state/user_state.rs
    • File: state/user_state.rsstate/user.rs
    • Module: pub mod user_state;pub mod user;
    • All callers updated (instruction handlers, README)
  • Quasar:
    • pub struct UserStatepub struct User in src/state.rs
    • The set_inner-generated UserStateInner becomes UserInner
    • All callers updated

Not changed

  • state.rs files keep their names (state is a fine module name).
  • state/ directories keep their names (same reason).
  • UpdateDefaultState in tokens/token-extensions/default-account-state/ is NOT a state struct — it's an Anchor accounts-context for the update_default_state instruction. "DefaultState" refers to the Token Extensions feature name "Default Account State". Left alone.

Verification

cargo check clean on both basics/close-account/anchor and basics/close-account/quasar.

Applies the repo-wide convention that state structs do not carry the
'State' suffix. The struct is the data; 'state' is implicit in being an
on-chain account (compare: Offer, not OfferState; Counter, not
CounterState).

Affected:
- Anchor: programs/close-account/src/state/user_state.rs renamed to
  state/user.rs; pub struct UserState -> pub struct User; module
  pub mod user_state; -> pub mod user;. All callers updated.
- Quasar: src/state.rs pub struct UserState -> pub struct User; the
  set_inner-generated UserStateInner becomes UserInner. All callers
  updated.
- basics/close-account/anchor/README.md updated to match.

Not changed:
- state.rs / state/ module and directory names keep their names. The
  'state' module is a fine container for state types; only the *struct*
  names are being renamed.

Verification: cargo check clean on both basics/close-account/anchor and
basics/close-account/quasar.
…te-to-user

# Conflicts:
#	basics/close-account/anchor/README.md
@mikemaccana mikemaccana merged commit da17fda into quicknode:main May 15, 2026
18 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.

2 participants