Skip to content

Rc/v1.2.3#46

Merged
Gohlub merged 8 commits into
mainfrom
rc/v1.2.3
May 13, 2026
Merged

Rc/v1.2.3#46
Gohlub merged 8 commits into
mainfrom
rc/v1.2.3

Conversation

@Gohlub

@Gohlub Gohlub commented May 13, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@greptile-apps

greptile-apps Bot commented May 13, 2026

Copy link
Copy Markdown

Greptile Summary

This release (v1.2.3) ships a batch of correctness fixes and UX improvements: fee tracking migrated from float NOCK to whole nicks to eliminate floating-point rounding errors at broadcast time, Nockblocks history sync converted from fire-and-forget to awaited to prevent MV3 service-worker termination before history is ingested, and a bridge fee breakdown row added to the Swap screen.

  • Fee precision overhaul (SendScreen, SendReviewScreen, currency.ts, types.ts): Fees are now tracked as whole nicks end-to-end; feeSendNicksRef and a debounce sequence counter eliminate stale estimation races; rewriteInsufficientFeeErrorToDecimalNock converts raw tx-engine error strings to readable NOCK.
  • Nockblocks sync reliability (vault.ts, store.ts): refreshNockblocksHistoryAfterUtxoSync is now awaited after UTXO sync; a balanceFetchGeneration counter prevents stale isBalanceFetching: false on rapid account switches; bridge transactions now receive a trackingTxId and are auto-tagged via noteData.
  • Swap screen bridge fee display (SwapScreen.tsx): Shows the protocol fee percentage and amount, and updates the "you receive" estimate to reflect the post-fee balance.

Confidence Score: 5/5

Safe to merge — the core changes are well-scoped bug fixes with no identified correctness regressions.

All changed paths have clear intent and are internally consistent. The fee-nicks migration correctly propagates through estimation, manual edit, save, and broadcast. The Nockblocks sync change from fire-and-forget to awaited is the right fix for MV3 service-worker lifetime. No broken contracts, no dropped state, no auth changes.

No files require special attention. The only findings are minor style observations in currency.ts and SwapScreen.tsx.

Important Files Changed

Filename Overview
extension/shared/vault.ts Nockblocks history sync converted from fire-and-forget to awaited; bridge tx now correctly sets trackingTxId; walletTxSharesAnyIdentifier replaces duplicated identity-matching inline code.
extension/popup/store.ts Added balanceFetchGeneration counter to prevent stale isBalanceFetching; fetchBalance now calls fetchWalletTransactions after UTXO sync.
extension/popup/screens/SendScreen.tsx Fee tracking migrated from float NOCK to whole nicks; debounced fee estimations use a sequence counter to discard stale results.
extension/popup/screens/SendReviewScreen.tsx Fee handling now uses whole nicks from lastTransaction when available; isSending overlay replaced by button-level feedback; redundant fetchWalletTransactions call remains.
extension/shared/currency.ts Added truncateNockToDecimals, FormatNockOptions, and rewriteInsufficientFeeErrorToDecimalNock; formatNock extended with truncate mode.
extension/popup/screens/SwapScreen.tsx Shows receive amount after bridge protocol fee deduction and fee row with percentage label.
extension/shared/nockblocks-client.ts Fixed normalizeTransaction to keep tx.transaction.spends/outputs in sync with top-level arrays.
extension/shared/types.ts Added optional feeNicks field to TransactionDetails.
extension/popup/screens/HomeScreen.tsx Account-switch handler reads fresh store state; fetchBalance awaited in switch path; swap icon updated to theme-aware SVG pair.
Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 3
extension/shared/currency.ts:176
`rem` is constructed via `BigInt(m[2])` where `m[2]` is always a `\d+` match, so it can never be negative. The `rem < 0n` branch is unreachable dead code and may give a false sense of safety to future readers.

```suggestion
  if (rem >= 65536n) return null;
```

### Issue 2 of 3
extension/popup/screens/SendReviewScreen.tsx:91-92
Redundant `fetchWalletTransactions` call after `fetchBalance`

`fetchBalance` in the store now internally calls `fetchWalletTransactions` after the UTXO sync completes (added in this PR). The explicit `fetchWalletTransactions()` call here fires immediately — before the UTXO sync — so it transiently writes a pre-sync transaction list to the store, which `fetchBalance` will then overwrite once the sync finishes. It's harmless but adds an unnecessary extra round-trip to the background service worker on every successful send.

### Issue 3 of 3
extension/popup/screens/SwapScreen.tsx:30-33
The bridge fee display amount uses raw `.toLocaleString` while every other amount in this PR uses `formatNock`. The two formatters can diverge (e.g., grouping separators, trailing zeros) and produce a visually inconsistent fee line. Using `formatNock` here keeps all amounts uniform.

```suggestion
  const bridgeProtocolFeeAmountDisplay = formatNock(bridgeProtocolFeeNock, 4);
```

Reviews (2): Last reviewed commit: "Update extension/popup/styles.css" | Re-trigger Greptile

Comment thread extension/popup/styles.css
Gohlub and others added 2 commits May 13, 2026 12:50
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@Gohlub
Gohlub merged commit 4202502 into main May 13, 2026
1 check 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.

1 participant