You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The logic of the detection is basically "is metamask / is any other provider" with the mustBeMetamask option. While this works perfectly in the context of detecting exactly metamask, this doesn't narrow down other providers, not gives us guarantees that the provider we get is really the provider we want. Which again, makes us use some copypasta detection utils to detect and narrow down the specific provider
We should patch detectEthereumProvider so that it correctly detects MM/XDEFI/Tally, and narrows down the returned provider type.
Overview
Currently, we detect ethereum providers with
@metamask/detect-provider
package.However, there are two issues with this:
hdwallet/packages/hdwallet-metamask/src/adapter.ts
Lines 24 to 25 in fe03120
mustBeMetamask
option. While this works perfectly in the context of detecting exactly metamask, this doesn't narrow down other providers, not gives us guarantees that the provider we get is really the provider we want. Which again, makes us use some copypasta detection utils to detect and narrow down the specific providerWe should patch
detectEthereumProvider
so that it correctly detects MM/XDEFI/Tally, and narrows down the returned provider type.References and additional details
hdwallet/packages/hdwallet-tallyho/src/adapter.ts
Line 61 in a7cdf76
hdwallet/packages/hdwallet-metamask/src/adapter.ts
Line 23 in a7cdf76
hdwallet/packages/hdwallet-xdefi/src/adapter.ts
Line 24 in a7cdf76
Acceptance Criteria
detectEthereumProvider
is patched with the latest source changesdetectEthereumProvider
detects, returns and narrows down the types of MetaMask, XDEFI and Tally providersdetectTallyProvider
and its calls are removed and the patcheddetectEthereumProvider
is used instead(globalThis as any).xfi?.ethereum;
is replaced by a call to the patcheddetectEthereumProvider
Need By Date
No response
Screenshots/Mockups
No response
Estimated effort
3 hours
The text was updated successfully, but these errors were encountered: