Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support emojis in ENS names #509

Merged
merged 7 commits into from
Feb 21, 2022
Merged

Support emojis in ENS names #509

merged 7 commits into from
Feb 21, 2022

Conversation

ChaituVR
Copy link
Member

src/utils.ts Outdated
@@ -1,7 +1,7 @@
import fetch from 'cross-fetch';
import { Interface } from '@ethersproject/abi';
import { Contract } from '@ethersproject/contracts';
import { namehash } from '@ethersproject/hash';
import namehash from '@ensdomains/eth-ens-namehash';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isnt this library making app bundle much bigger? Any way to check size before and after. Also maybe you could use import { hash } from '@ensdomains/eth-ens-namehash' instead

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bonustrack this package already exists in snapshot UI, so there is no change in bundle size

image

I will create a beta version for this, so you can check from the snapshot repo directly (if needed)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is not much difference in snapshot.js package

https://www.npmjs.com/package/@snapshot-labs/snapshot.js/v/0.3.49-beta2 - Unpacked Size - 1.33 MB
https://www.npmjs.com/package/@snapshot-labs/snapshot.js/v/0.3.48 - Unpacked Size - 1.14 MB

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok then its fine, maybe we can try use destructured import here https://github.com/snapshot-labs/snapshot/blob/35d28b8716d24eba8370b7ffcabf699b314c277d/src/components/SetupController.vue#L4 ENS dependency take a bit some space: image
Or maybe we can use the encoding ENS lib is using to support emoji and stay with Ethers.js which should be smaller

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe we can use the encoding ENS lib is using to support emoji and stay with Ethers.js which should be smaller

ENS lib is using two packages to support emoji, https://github.com/ensdomains/eth-ens-namehash/blob/master/index.js,
If we use the same, we get the same size on snapshot.js too right 😅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok then it's fine, maybe we can try use destructured import here https://github.com/snapshot-labs/snapshot/blob/35d28b8716d24eba8370b7ffcabf699b314c277d/src/components/SetupController.vue#L4

Destructuring may not help reduce size because there are two functions on this package, namehash is using normalize inside so it will same size

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Encoding shouldnt be that hard, we already made emoji domain works without libraries example: https://snapshot.org/#/%F0%9F%8D%AFdao.eth

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is not a good example, it has direct IPFS settings but I know we have others with emoji and IPNS url and works fine

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but I know we have others with emoji and IPNS url and works fine
This is because the spaces were created before when we were using this package instead of ethers.js, right now if there are spaces with emojis, owners won't be able to update the settings

I can't find any spaces with emojis other than
https://snapshot.org/#/%F0%9F%8D%AFdao.eth/settings
https://snapshot.org/#/%F0%9F%A5%93%F0%9F%AA%99%F0%9F%97%B3.eth/settings

If you go to these spaces, we get this issue (there is a open issue on ethers.js ethers-io/ethers.js#2376 )

If you go to other non-Ascii values spaces (other languages ) they work fine with ethers.js

like: https://snapshot.org/#/%F0%9F%8D%AFdao.eth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't setup Snapshot with emoji .eth domain
2 participants