Skip to content

fix(history): correct token symbol + collapse mint/burn double-records - #49

Merged
temrjan merged 2 commits into
mainfrom
fix/history-display
Jul 29, 2026
Merged

fix(history): correct token symbol + collapse mint/burn double-records#49
temrjan merged 2 commits into
mainfrom
fix/history-display

Conversation

@temrjan

@temrjan temrjan commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Что

Лента истории на wallet-экране хардкодила «OLTIN» и игнорила event_type → UZD-события показывались как OLTIN, а каждый минт двоился (минт эмитит и *_minted-событие, и Transfer с нулевого адреса). Теперь лента читает event_type.

Изменения (фронт-only)

  • lib/history.ts prepareHistory(txs): DisplayTx[] — символ из event_type (uzd_*→UZD, oltin_*→OLTIN); дедуп пары *_minted/*_admin_burned + парный 0x0-*_transfer по ключу (tx_hash, токен, amount_wei) (не по адресу — у minted from пустой, у transfer from=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 уже корректны).

Тесты

  • tsc 0, eslint 0 errors, vitest 29/29 (21 format + 8 history).
  • red→green доказан: отключил дедуп → 3 теста упали → вернул → green.
  • Сверено на 11 реальных chain_events temrjan_biotact → 9 верных строк (welcome-минт 1 строкой; BUY «−100k UZD + +0.0634 OLTIN»; SELL «−0.2 OLTIN + +315k UZD»).

Гейт-2: APPROVED WITH NITS (ниты применены).

temrjan 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).
@temrjan
temrjan merged commit e3ecf49 into main Jul 29, 2026
1 check passed
@temrjan
temrjan deleted the fix/history-display branch July 29, 2026 02:56
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.

1 participant