Replies: 3 comments 1 reply
-
I don't know how safe it is to just assume As a quick aside, in v6 there is a ProviderPlugin class. The core library comes with very common tokens included in its BasicMulticoinPlugin, but supports importing an ancillary package for a more thorough MulticoinPlugin. Or you can easily create a custom Plugin to handle just the tokens you care about. :) I'm going to move this to Ideas for further discussion. :) |
Beta Was this translation helpful? Give feedback.
-
@ricmoo Thanks for the response. A ProviderPlugin to extend the core token list would be cool! But maybe feels like overkill just to get Ethers to treat an extra CoinType as Another option could be to have the Resolver's |
Beta Was this translation helpful? Give feedback.
-
In case it's helpful to anyone else, I was able to work around the const encodedCoinType = utils.hexZeroPad(BigNumber.from(coinType).toHexString(), 32)
const hexBytes = await resolver._fetchBytes('0xf1cb7e06', encodedCoinType)
if (hexBytes == null || hexBytes === '0x') return null
const address = provider.formatter.address(hexBytes)
if (address && isValidAddress(address)) return address
else return null |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
This issue is part bug report and part warning for anyone else trying to resolve non-Eth ENS addresses:
As stated in #2495 the static list of cointypes in base-provider as limited to a small set and I believe some (like xDAI) are incorrect.
The TLDR is that ENS' address-encoder lib incorrectly computes cointype using chainId instead of Slip44 id, see this issue for details. That means that XDai's cointype value won't be resolved to 700 but some large random looking number instead.
One solution is to use offload this to address-encoder and just match their bug. But @ricmoo you mentioned in #2495 that it would bloat the ethers bundle so I agree that's not the right approach.
Another solution can be to have the resolver's
_getAddress
method assume that coins haveilk: "eth"
if it doesn't know about them. That way any EVM-compatible chains would just work without the need to keep a list up to date.Reproduction steps
Search Terms
ENS CoinType Slip44 coinInfos
Beta Was this translation helpful? Give feedback.
All reactions