-
Notifications
You must be signed in to change notification settings - Fork 578
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
Conversation
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'; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
I will create a beta version for this, so you can check from the snapshot repo directly (if needed)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also test/check the size on UI here:
snapshot-labs/snapshot#1785
https://bafybeic6nkb6acveajxgnrikmw7qi6hl2t2krhwbmqmv76cjkmfwavkh7q.on.fleek.co/stats.html
https://snapshot.org/stats.html
There was a problem hiding this comment.
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:
Or maybe we can use the encoding ENS lib is using to support emoji and stay with Ethers.js which should be smaller
There was a problem hiding this comment.
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 😅
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
Fixes snapshot-labs/snapshot#1522