Page MenuHomePhabricator

[Cashtab] Do not show new wallet msg for not-new wallets
ClosedPublic

Authored by bytesofman on Feb 13 2024, 22:50.

Details

Summary

Users reporting toggling between 'congratulations new wallet' and normal wallet screen, on wallets with tx history.

Doing some digging, discovered it happened when parsedTxHistory was undefined.

This occurs when a new token is added to cache. The calling function is expecting info at the key parsedTxHistory, but this is not being returned

Test Plan

npm start, receive a tx from a tokenId not in cache, do not see the 'new wallet' screen

Note: this patch is deployed to https://cashtab-local-dev.netlify.app/ and have gone through testing with Koush

Diff Detail

Repository
rABC Bitcoin ABC
Branch
cashtab-error-fix
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 27117
Build 53800: Build Diffcashtab-tests
Build 53799: arc lint + arc unit

Event Timeline

Failed tests logs:

====== CashTab Unit Tests: useWallet hook Migrating legacy wallet on mainnet ======
TypeError: Cannot create property 'mnemonic' on boolean 'false'
    at update (/work/cashtab/src/hooks/useWallet.js:105:30)
    at Object.update (/work/cashtab/src/hooks/useWallet.js:1357:9)
    at runNextTicks (node:internal/process/task_queues:61:5)
    at processTimers (node:internal/timers:499:9)
====== CashTab Unit Tests: useWallet hook processChronikWsMsg() refreshes alias prices when aliasPrices is null ======
TypeError: Cannot create property 'mnemonic' on boolean 'false'
    at update (/work/cashtab/src/hooks/useWallet.js:105:30)
    at Object.update (/work/cashtab/src/hooks/useWallet.js:1357:9)
====== CashTab Unit Tests: useWallet hook processChronikWsMsg() refreshes alias prices when aliasPrices exists, server and cashtab prices array length do not match ======
TypeError: Cannot create property 'mnemonic' on boolean 'false'
    at update (/work/cashtab/src/hooks/useWallet.js:105:30)
    at Object.update (/work/cashtab/src/hooks/useWallet.js:1357:9)
    at runNextTicks (node:internal/process/task_queues:61:5)
    at processTimers (node:internal/timers:499:9)
====== CashTab Unit Tests: useWallet hook Verify refreshAliases() updates the `aliases` state variable on a successful /address/ endpoint response ======
TypeError: Cannot create property 'mnemonic' on boolean 'false'
    at update (/work/cashtab/src/hooks/useWallet.js:105:30)
    at Object.update (/work/cashtab/src/hooks/useWallet.js:1357:9)
====== CashTab Unit Tests: useWallet hook rendering in different localforage states Cashtab loads wallet, settings, cache, and contactlist as expected defaults if localforage is empty ======
Error: expect(received).toBe(expected) // Object.is equality

Expected: 60000
Received: 10

Ignored nodes: comments, script, style
<html>
  <head />
  <body>
    <div />
  </body>
</html>
    at toBe (/work/cashtab/src/hooks/__tests__/useWalletStorage.test.js:91:58)
    at runWithExpensiveErrorDiagnosticsDisabled (/work/cashtab/node_modules/@testing-library/dom/dist/config.js:47:12)
    at checkCallback (/work/cashtab/node_modules/@testing-library/dom/dist/wait-for.js:124:77)
    at checkRealTimersCallback (/work/cashtab/node_modules/@testing-library/dom/dist/wait-for.js:118:16)
    at Timeout.task [as _onTimeout] (/work/cashtab/node_modules/jsdom/lib/jsdom/browser/Window.js:520:19)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)
====== CashTab Unit Tests: useWallet hook rendering in different localforage states XEC price is set in state on successful API fetch ======
TypeError: Cannot create property 'mnemonic' on boolean 'false'
    at update (/work/cashtab/src/hooks/useWallet.js:105:30)
    at Object.update [as current] (/work/cashtab/src/hooks/useWallet.js:1357:9)
====== CashTab Unit Tests: useWallet hook rendering in different localforage states XEC price is set in state to fiat currency of user settings on successful API fetch ======
TypeError: Cannot create property 'mnemonic' on boolean 'false'
    at update (/work/cashtab/src/hooks/useWallet.js:105:30)
    at Object.update [as current] (/work/cashtab/src/hooks/useWallet.js:1357:9)
====== CashTab Unit Tests: <App /> Renders onboarding screen if cashtab.com opened with no local storage and no wallet ======
TypeError: Cannot create property 'mnemonic' on boolean 'false'
    at update (/work/cashtab/src/hooks/useWallet.js:105:30)
    at Object.update (/work/cashtab/src/hooks/useWallet.js:1357:9)
    at runNextTicks (node:internal/process/task_queues:61:5)
    at processTimers (node:internal/timers:499:9)

Each failure log is accessible here:
CashTab Unit Tests: useWallet hook Migrating legacy wallet on mainnet
CashTab Unit Tests: useWallet hook processChronikWsMsg() refreshes alias prices when aliasPrices is null
CashTab Unit Tests: useWallet hook processChronikWsMsg() refreshes alias prices when aliasPrices exists, server and cashtab prices array length do not match
[[https://build.bitcoinabc.org/viewLog.html?tab=buildLog&logTab=tree&filter=debug&expand=all&buildId=694249&_focus=114212&guest=1 | CashTab Unit Tests: useWallet hook Verify refreshAliases() updates the aliases state variable on a successful /address/ endpoint response]]
CashTab Unit Tests: useWallet hook rendering in different localforage states Cashtab loads wallet, settings, cache, and contactlist as expected defaults if localforage is empty
CashTab Unit Tests: useWallet hook rendering in different localforage states XEC price is set in state on successful API fetch
CashTab Unit Tests: useWallet hook rendering in different localforage states XEC price is set in state to fiat currency of user settings on successful API fetch
CashTab Unit Tests: <App /> Renders onboarding screen if cashtab.com opened with no local storage and no wallet

bytesofman edited the summary of this revision. (Show Details)
bytesofman edited the test plan for this revision. (Show Details)
bytesofman added inline comments.
cashtab/src/chronik/index.js
931 ↗(On Diff #45208)

function is expecting this to be returned at the key parsedTxHistory

This revision is now accepted and ready to land.Feb 14 2024, 00:01