shapeshift / web

ShapeShift Web
https://app.shapeshift.com
MIT License
157 stars 180 forks source link

Handle Ledger THORChain & Cosmos app open request #6806

Closed 0xApotheosis closed 1 week ago

0xApotheosis commented 2 weeks ago

Detecting if the THORChain app is open on Ledger is currently broken, which I suspect is caused by await this.transport.call(null, "getAppAndVersion") returning THORChain, whereas the slip key is written as Thorchain in HDWallet's slip44Table (I suspect incorrectly, as SLIP-0044 lists it as THORChain too).

This might require a slight tweak in HDWallet.

0xApotheosis commented 1 week ago

Cormos is in the same boat, debug this at the same time 🙏

woodenfurniture commented 1 week ago

When attempting to manage accounts for thorchain or cosmos, the app crashes due to missing support for validateCurrentApp on these chains. When calling validateCurrentApp, the promise is rejected with Unable to find associated app name for coin: ${coin} because support for these chains is actually missing from hdwallet.

This issue never presented in web previously because we never attempt to validate the correct app being open on ledger, and instead swallow errors (hence the requirement for the new throwOnReject flag added in this PR.

The workaround here is to bypass this check and allow the user to attempt to proceed, then display an error toast if account fetching fails.

We'll have to follow up with a fix in hdwallet and remove this temporary patch.

woodenfurniture commented 1 week ago

Once https://github.com/shapeshift/hdwallet/pull/670 is merged, will have to follow up in web and remove the patches.