tylim88 / Crypto-Symbol

:baby_chick: Provide easy conversion between crypto symbol and name, auto update daily
https://www.npmjs.com/package/crypto-symbol
MIT License
15 stars 9 forks source link

Edge-case bug with overriding ticker/symbol. #16

Closed NewDark90 closed 2 years ago

NewDark90 commented 2 years ago

Problem context

Nano recently changed it's ticker to XNO instead of Nano.

There is currently also a token under XNO called "Xeno Token".

That, in of itself is fine. I'd like to override the XNO ticker to have a name of "Nano" as I don't care about this particular token.

The Bug

Because the code is basically Object.assign based on the "name-symbol" pair, it's keying off of the name specifically for an overwrite.

This means it is overriding the ticker for Nano (NANO) to be XNO, the swapKeyAndValue function will hit "XNO": "Nano", and override it to be "XNO": "Xeno Token" as it is further down the list.

tylim88 commented 2 years ago

why on earth people using the same ticker, I thought it has to be unique according to https://coinmarketcap.com/alexandria/glossary/ticker-symbol

image

one has to go then...

tylim88 commented 2 years ago

oh wait, there is a solution to this

NewDark90 commented 2 years ago

Trust me, I understand annoyance with the weird move here, and it is very recent: https://medium.com/@nanocurrency/say-hello-to-xno-7ed55e419e3f

tylim88 commented 2 years ago

I need few days to fix this with backward compatibility plus future proofing, also this library is quite old need major setup upgrade

tylim88 commented 2 years ago

I decided just do quick fix instead, it doesn't worth the effort for a single edge case

I removed Xeno Token from the list and update Nano ticker to XNO

please install 3.3.3

NewDark90 commented 2 years ago

Thank you!

Are you able to receive a BAT tip to your github account?

tylim88 commented 2 years ago

I just created the channel, will let you know when it is ready, thanks