Skip to content

Instantly share code, notes, and snippets.

@KngZhi
Last active May 8, 2022 02:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KngZhi/1f32de07524446f611a547e8d89d7c2f to your computer and use it in GitHub Desktop.
Save KngZhi/1f32de07524446f611a547e8d89d7c2f to your computer and use it in GitHub Desktop.
const lookupForAddress = /kodadot\.xyz\/transfer\/?\?target=\w[a-zA-Z0-9]{46,}\b/g
const lookupForAddressO = /kodadot.xyz\/transfer\/\?target=\w[a-zA-Z0-9]{46}\b/g
const matchAddress = /\w[a-zA-Z0-9]{46,}\b/g
const links = [
'https://beta.kodadot.xyz/transfer?target=DaWoVNNhBTdqJ5iPN3UcaLeamkPpJeGWdrs8LhvX9TQbadc',
'https://beta.kodadot.xyz/transfer?target=15YEYP65NQbmXu6LhTiEguW7A31so66Q1oXPfFNG1Dhu4Nd9',
'https://kodadot.xyz/transfer/?target=EqdyzrzVmeHwMdMwvPeCMnNdbuQDbD3YrjY93xq9Ln3jUGW',
'https://beta.kodadot.xyz/transfer?target=DaWoVNNhBTdqJ5iPN3UcaLeamkPpJeGWdrs8LhvX9TQbadc&usdamount=0&donation=true',
'https://beta.kodadot.xyz/transfer/?target=FNyt7T1xdbhN7dagf7yGYCRJuE3R45VmTCE3tjzy1rKxa7y',
]
let testStr = (link) => `**Thank you for your contribution** to the [KodaDot NFT gallery](https://kodadot.xyz).
👇 \_ Let's make a quick check before the contribution.
### PR type
- [ ] Bugfix
- [x] Feature
- [ ] Refactoring
### What's new?
- [x] PR closes #877
- [ ] <brief_description_of_what_I've_added>
### Before submitting Pull Request, please make sure:
- [x] My contribution builds **clean without any errors or warnings**
- [x] I've merged recent default branch -- **main** and I've no conflicts
- [x] I've tried to respect high code quality standards
- [x] I've didn't break any original functionality
- [x] I've posted a screenshot of demonstrated change in this PR
### Optional
- [x] I've tested it at </rmrk/collection/26902bc2f7c20c546a-1FVG7>
- [x] I've tested PR on mobile and everything seems works
- [ ] I found edge cases
- [ ] I've written some unit tests 🧪
### Had issue bounty label?
- [x] Fill up your KSM address: [Payout](${link})
### Community participation
- [x] [Are you at KodaDot Discord?](https://discord.gg/35hzy2dXXh)
### Screenshot
- [x] My fix has changed **something** on UI; a screenshot is best to understand changes for others.
![image](https://user-images.githubusercontent.com/11361147/165769175-a3d29751-70c6-425e-b951-bbf21d7a1121.png)
![image](https://user-images.githubusercontent.com/11361147/165769265-c8b31110-96e8-430b-b0c8-95d50b025b0a.png)`
links.forEach(link => {
const str = testStr(link)
const url = str.match(lookupForAddress)[0]
const hashAddress = url.match(matchAddress)[0]
console.log('original', lookupForAddressO.test(str), 'current', lookupForAddress.test(str))
console.log(url, url.length, hashAddress, hashAddress.length)
})
/*
original false current true
kodadot.xyz/transfer?target=DaWoVNNhBTdqJ5iPN3UcaLeamkPpJeGWdrs8LhvX9TQbadc 75
DaWoVNNhBTdqJ5iPN3UcaLeamkPpJeGWdrs8LhvX9TQbadc 47
original false current true
kodadot.xyz/transfer?target=15YEYP65NQbmXu6LhTiEguW7A31so66Q1oXPfFNG1Dhu4Nd9 76
15YEYP65NQbmXu6LhTiEguW7A31so66Q1oXPfFNG1Dhu4Nd9 48
original true current true
kodadot.xyz/transfer/?target=EqdyzrzVmeHwMdMwvPeCMnNdbuQDbD3YrjY93xq9Ln3jUGW 76
EqdyzrzVmeHwMdMwvPeCMnNdbuQDbD3YrjY93xq9Ln3jUGW 47
original false current true
kodadot.xyz/transfer?target=DaWoVNNhBTdqJ5iPN3UcaLeamkPpJeGWdrs8LhvX9TQbadc 75
DaWoVNNhBTdqJ5iPN3UcaLeamkPpJeGWdrs8LhvX9TQbadc 47
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment