fix(history): correct token symbol + collapse mint/burn double-records - #49
Merged
Conversation
added 2 commits
July 28, 2026 23:51
The wallet history feed hardcoded "OLTIN" and ignored event_type, so UZD events showed as OLTIN and every mint doubled (a mint emits both a *_minted event AND a Transfer from the zero address). Now the feed reads event_type. - lib/history.prepareHistory: symbol from event_type (uzd_->UZD, oltin_->OLTIN); collapse the mint/burn double-record (drop the zero-address transfer paired with a *_minted / *_admin_burned by tx+token+amount); keep a LONE zero-address transfer (OLTIN sell/burn has no BURNER event); skip reserve_answer; a self direction is neutral. + vitest (red->green) - wallet/page.tsx: render via prepareHistory (symbol/sign/kind), not hardcoded Frontend-only — chain_events + get_transactions are already correct. Verified against temrjan_biotact's 11 real events -> 9 correct rows (both mint pairs collapsed, UZD/OLTIN symbols right).
A collapsed BUY/SELL now yields two rows sharing one tx_hash (a UZD leg plus an OLTIN leg), so tx_hash alone is no longer a unique React key — compose it with symbol/kind/amount. Also widen the recent-activity list from 5 to 8 so a single buy+sell no longer fills it. Gate-2 nit from review (key = MINOR, applied this round; slice = suggestion).
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.
Что
Лента истории на wallet-экране хардкодила «OLTIN» и игнорила
event_type→ UZD-события показывались как OLTIN, а каждый минт двоился (минт эмитит и*_minted-событие, и Transfer с нулевого адреса). Теперь лента читаетevent_type.Изменения (фронт-only)
lib/history.tsprepareHistory(txs): DisplayTx[]— символ изevent_type(uzd_*→UZD,oltin_*→OLTIN); дедуп пары*_minted/*_admin_burned+ парный 0x0-*_transferпо ключу (tx_hash, токен, amount_wei) (не по адресу — у mintedfromпустой, у transferfrom=zeroAddress); одинокий 0x0-transfer (OLTIN-продажа, BURNER-роли нет) сохранён;reserve_answerскип;self→нейтрально; kind=received|sent|minted|burned|self. +lib/history.test.ts(8 тестов).wallet/page.tsx— рендер черезprepareHistory(символ/знак/kind/лейбл), хардкод убран; композитный React-ключ для схлопнутых BUY/SELL (две строки на один tx_hash); список последних операций 5→8.Бэк не тронут (
chain_events+get_transactionsуже корректны).Тесты
chain_eventstemrjan_biotact→ 9 верных строк (welcome-минт 1 строкой; BUY «−100k UZD + +0.0634 OLTIN»; SELL «−0.2 OLTIN + +315k UZD»).Гейт-2: APPROVED WITH NITS (ниты применены).