Page MenuHomePhabricator

[Cashtab] [chronik utxo handling p13] Unlock SendToken screen only after utxo set is updated
ClosedPublic

Authored by bytesofman on Sep 14 2022, 16:20.

Details

Summary

T2447

Depends on D11985

The SendToken screen UI will lock after sending a token tx until the token utxo set is refreshed. The implementation under bch-api was hacky, relying on the token object as a whole to change and assuming this would include a balance change. The bch-api approach got away with this because, after implementing per-utxo updating, the token object would not change unless utxo sets changed. So it seemed to work most of the time.

The correct approach is to unlock the UI after token.balance has changed. This was not implemented previously probably because of difficulties encounted with attempting to include a sometimes-undefined variable as a dependency in a useEffect loop.

This diff unlocks the UI only after the token.balance has changed, which is the intended behavior. At a 5s refresh rate on chronik, the token object is always "changing," even when it is still serializing to the same thing.

Test Plan

npm start
Send eToken txs
Observe that the UI of SendToken.js does not unlock until the balance has changed.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable