Content
@
0 reply
0 recast
0 reaction
shazow
@shazow.eth
Is there an ethers.js v6 idiomatic way for resolving an ENS name with respect to some non-mainnet chainId? Like say my ENS has a special address for Base (chainId 8453), how would I get that rather than my mainnet (chainId 1) address? Is there something like ethers.resolveAddress for that? @ricmoo
1 reply
0 recast
2 reactions
RicMoo.eth
@ricmoo
If I understand, you can create a custom network instance, and add an EnsPlugin to it with the desired ENS address. Then it will just be used for all ENS interactions. Here is an example of how ENS is configured on the stock networks: https://github.com/ethers-io/ethers.js/blob/main/src.ts/providers/network.ts#L358
1 reply
1 recast
1 reaction
shazow
@shazow.eth
Hmm am I crazy to expect that I should be able to just pass an optional chainId into ethers.resolveAddress(...) or somesuch?
1 reply
0 recast
0 reaction
RicMoo.eth
@ricmoo
I generally don’t allow overriding class properties as it hurts encapsulation; sub-classes need to then support weird usage and callers have to worry about callees doing weird things… Otherwise where does it end? Should provider.balanceOf allow overriding the JSON-RPC url? Wallet.sign overriding the private key? :)
1 reply
0 recast
0 reaction