Skip to content

WalletConnect: chia_updateCat, so a site can suggest a label for a CAT - #893

Merged
Rigidity merged 2 commits into
xch-dev:mainfrom
awizardxch:feat/wc-watch-asset
Oct 13, 2026
Merged

Rigidity merged 2 commits into
xch-dev:mainfrom
awizardxch:feat/wc-watch-asset

Conversation

@awizardxch

@awizardxch awizardxch commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

WalletConnect: chia_updateCat, so a site can suggest a label for a CAT

Why

A CAT that Dexie hasn't registered shows up in Sage as "Unknown CAT" with an empty name. Sage reads names and icons from Dexie's asset list, and only the wallet's owner can change them, by hand. Sites that mint CATs their users then hold have no way to say what those tokens are. Examples are DEX liquidity tokens, game items, and project tokens before they're listed. Users end up holding several "Unknown CAT" rows and can't tell them apart.

Ethereum wallets solve a similar problem with wallet_watchAsset (EIP-747): the site suggests the token's symbol and image, and the user approves or rejects it in a wallet prompt.

What

This adds one WalletConnect command, chia_updateCat. It is named after what it does: it updates the wallet's own record of a CAT it already holds, through the same path as update_cat.

// params
{
  assetId: string;       // 32-byte hex CAT asset id (0x optional)
  name?: string;         // 1-64 chars
  ticker?: string;       // 1-16 chars
  iconUrl?: string;      // https only, <= 512 chars
  description?: string;  // <= 280 chars
}
// returns {}
  • It always asks the user (confirm: true). The dialog warns that the site chose these labels and that anyone can name a token anything. It shows the asset ID in full, each current label → proposed label, and a preview of the proposed icon (loaded with referrerPolicy='no-referrer').
  • It only labels a CAT the wallet already holds. It edits Sage's own record through the existing update_cat path, and never adds an asset the wallet has never seen. If the wallet doesn't hold the asset, the request fails with a clear error, and the dialog says so before the user approves.
  • Fields left out are kept, and so is the token's visibility. The command signs nothing, moves nothing, and touches nothing on chain, so read-only wallets may use it too.

Files

  • src/walletconnect/commands.ts: the command, with zod validation of the asset ID, the lengths, and https for the icon.
  • src/walletconnect/commands/high-level.ts: handleUpdateCat (getToken, then updateCat, merging only the fields provided).
  • src/walletconnect/handler.ts: the dispatch.
  • src/contexts/WalletConnectContext.tsx: the UpdateCatDialog approval dialog and its title.

Not in this PR (possible follow-ups)

  • The same method on the app bridge (sage-apps user wallet methods), so in-wallet apps can suggest labels too.
  • Adding a CAT the wallet doesn't hold yet. That needs an insert path, which update_cat doesn't have.

Testing

  • tsc -b and eslint are clean on the touched files.
  • Manually: call chia_updateCat from a dApp over WalletConnect for a held CAT. Approve and check that the token list shows the new name, ticker and icon. Reject and check that nothing changed. Use an unheld asset ID and check that the dialog shows the "does not hold" notice and the request fails.

🤖 Generated with Claude Code

A site can suggest a name, ticker, https icon and description for a CAT the
wallet already holds (like EIP-747's wallet_watchAsset). The user always
confirms in a dialog that warns the labels are the site's, shows the asset
id in full, current -> proposed values and an icon preview. Approval updates
Sage's own record through update_cat; omitted fields are kept, nothing is
signed or spent, and an asset the wallet does not hold is refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rigidity

Copy link
Copy Markdown
Collaborator

Are you fine renaming it to updateCat so it's more accurate to what it's doing?

It edits the wallet's own record of a CAT it already holds, as update_cat
does; it does not add an asset to watch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@awizardxch awizardxch changed the title WalletConnect: chia_watchAsset, so a site can suggest a label for a CAT WalletConnect: chia_updateCat, so a site can suggest a label for a CAT Oct 13, 2026
@Rigidity
Rigidity merged commit 6329114 into xch-dev:main Oct 13, 2026
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