leather-io / extension

Leather browser extension
https://leather.io
MIT License
305 stars 144 forks source link

chore: demo redundancy of recursive account balance lookup #5945

Closed pete-watters closed 1 week ago

pete-watters commented 2 weeks ago

In my investigations into account restore I found that:

I tested this with a few different wallets:

Just opening this draft to demonstrate recurseAccountsForActivity is not working as we would expect.

kyranjamie commented 1 week ago

I don't see a problem here. With dev account, the promise does resolve.

image

In this instance, the legacy look up and the recursive look up are the same, so we call the restoreAccountIndex action later on . The extension works differently to the mobile wallet. We're not supposed to be generating accounts here. We just need to know—and save in the state—what the highest known account index is. With that information, the app elsewhere generates the accounts.

The fact that Gaia and the recursive look up have the same value is good, that means that it works. If you remove all the gaia look/legacy account look up code, and the condition on L105, then the recursive look up will set that value, and the wallet will generate.