fix(stake): reward box & positions read the EOA, not the Smart Account - #234
Merged
Conversation
…rt Account Com carteira externa + account-abstraction, thirdweb's useActiveAccount() retorna o endereço do Smart Account wrap — mas os stakes/rewards vivem no EOA do usuário (por isso o app usa view-mode "eoa" por padrão). A MorLootbox e o StakePositions liam a posição a partir do SA (vazio), então hasAction ficava false e a lootbox nunca aparecia / o painel mostrava "sem posições". Passa os dois a ler de useUserAddress().address (o endereço efetivo, EOA pra carteiras externas). Writes seguem assinando pela active account dentro dos hooks morpheus/distribute — só a LEITURA muda. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
The reward lootbox never appeared for external-wallet users (and the new positions panel showed "no positions").
Root cause: with account-abstraction, thirdweb's
useActiveAccount()returns the Smart Account wrap address — but stakes/rewards live on the user's EOA (which is exactly why the app defaults external wallets to view-mode"eoa"and providesuseUserAddress()as the single source of truth for read hooks).MorLootboxandStakePositionskeyed their position reads off the SA (empty) →hasActionwas false → the box never rendered.Fix
Both components now read from
useUserAddress().address(the effective address — the EOA for external wallets, the SA for in-app wallets). Writes are unchanged — claim/distribute still sign through the active account inside the morpheus/distribute hooks, peruseUserAddress's documented contract ("reads key off this; writes use the active account directly").Verification
tsc --noEmitclean ·eslintclean.useUserAddress().address === useActiveAccount().address).🤖 Generated with Claude Code