-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Conversation
@moodysalem I implemented what you suggested in your comment. Cheers, |
@moodysalem @anxolin any update on this? |
@adamdowson I'm waiting for the review of @moodysalem If it's just for xDAI it might be faster to start adding #53. Anyways, I think is a good move to make the SDK more generic accepting any network. In my opinion, the SDK shouldn't be constrained to a hardcoded enum of accepted networks. It's even limiting the possibilities on local ganache networks, future side chains, or testnets. |
Hello fellow developers! |
Adding the xDAI enum and a factory/router address not deployed by Uniswap is not going to work, since we didn't deploy it/verify it. Also, it would be better if the types accepted in place of ChainId were Also, will just add that it's not a good idea to call it Uniswap/show Uniswap branding in the interface if we didn't deploy it and verify it, since it will not be clear to users that it is not deployed by Uniswap and not a malicious fork |
I understand, but maybe you would feel more comfortable if you deploy the factory in xDAI yourself? I can happily change it to a Uniswap factory.
I can change that, but I think it would be equivalent. |
We'll talk about it internally, but I can't give any guarantees on timelines since xDAI is imo a less optimal scaling solution than the L2s coming up
Sorry, this is why I suggested changing ChainId to be an enum with string values, e.g. enum ChainId {
MAINNET = 'MAINNET',
ROPSTEN = 'ROPSTEN'
} |
Hi @moodysalem did you have time for discussing this internally? I think adding xDAI is a big win for Uniswap, specially given the current ether prices. It can be an additional option you give to your users. Given the effort and benefit, it feels very advantageous.
Happy to change that, if it helps to get the PR merged. Let me know the factory I can use, and I'll fix both things together. |
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Add platform info
Closes #52.
This PR generalize the type
ChainId
, adding support for any network. Also adds xDAI as aChain
(enum)As suggested in #53 by @moodysalem , I took a more generalist approach to support any network.
Basically, now ChainId is a
number
(aChainId | number
in TS becomesnumber
since one is a subset of the other). It also makes sense to model thechainId
as a number.The enum with some convenient known chains it's now called
Chain
.I had to adapt in several places the use of the enum (i.e.
ChainId.MAINNET ---> Chain.MAINNET
)Also
WETH
is typed asPartial<Record<ChainId, Token>>
, so we might find networks where we don't know the WETH contract. That's good, because reflects reality, there's even networks where WETH is not used (xDAI has "Wrapped xDAI" not WETH). I needed to account in a few places.