Comments (8)
With a few exceptions, I try to keep the symbol
field of tokens populated with the result of the .symbol()
contract call. It's not super helpful as a unique identifier in general; one example is UST: there are several UST wrappers which are used almost interchangeably by the Terra bridge, all of which have the symbol "UST".
Your point about having a unique identifier available is well taken, though. In terms of your usage of such a field within the API, does it matter to you whether or not the unique ID is human-readable as well as unique, or just that it's unique? No matter what, I'll most likely generate and hard-code ids to provide consistency.
from sdk.
Right now, all the BaseToken
keys, eg DFK_USDC
are acting as the unique identifier for the token so I've been able to work my way around this in the API.
Ideally something that is human readable and unique, like what you're using above would be best. I think it's worth thinking about what id/hash would be natural to a multi chain token.
from sdk.
@metagabbar do you think it makes sense to have a unique ID per-chain? For example, nETH
would have a "prefix" of "neth"
and a suffix per-chain? Ie. "neth_AVAX
", "neth_BOBA"`, etc.
The Wrapped Ether token for Avalanche is WETH_E with no indication it's avalanche other than it's addresses array
To this point, do you have any suggestions for how to address this from a code perspective? I can (and should, and plan to) considerably improve JS/TSDoc for tokens, but are there any helper properties/methods that could be exposed?
from sdk.
@metagabbar do you think it makes sense to have a unique ID per-chain? For example,
nETH
would have a "prefix" of"neth"
and a suffix per-chain? Ie. "neth_AVAX
", "neth_BOBA"`, etc.The Wrapped Ether token for Avalanche is WETH_E with no indication it's avalanche other than it's addresses array
To this point, do you have any suggestions for how to address this from a code perspective? I can (and should, and plan to) considerably improve JS/TSDoc for tokens, but are there any helper properties/methods that could be exposed?
I think this is a decent approach, but it somehow doesn't sit well with me because we're effectively augmenting the object with an attribute which has redundant data. We know the token symbol, and we know the chains it's available on and you already mentioned that you're effectively naming the symbol token the same as the .symbol() contract call
I was thinking something more id-ish, like a dumb but working solution would be to have a hash of JSON.stringify(Tokens[Tokens.AVAX])
or something like that. Thoughts ?
from sdk.
like a dumb but working solution would be to have a hash of JSON.stringify(Tokens[Tokens.AVAX])
I don't like this but it might be the best immediate option, and I can't think of anything better.
from sdk.
@metagabbar Install @synapseprotocol/[email protected]
. With commit 28846fc, the Token
interface now has a hash
property which is -- for now? -- calculated at object initialization time by taking the MD5 sum of a few key properties of the token object.
Going to leave this issue open for now, but please let me know if the above solution works for you.
from sdk.
@metagabbar Install
@synapseprotocol/[email protected]
. With commit 28846fc, theToken
interface now has ahash
property which is -- for now? -- calculated at object initialization time by taking the MD5 sum of a few key properties of the token object.Going to leave this issue open for now, but please let me know if the above solution works for you.
Yes, _hash
property lgtm. Focusing on indexer project right now, so I'm not going to migrate the API to use this attribute just yet, but this is a much needed addition. WIll get back when I integrate it! Feel free to close out tho
from sdk.
@bleaker0x unrelated, but if you can take a look at support channel #ticket-01003 on discord and see if there's something you can /contribute would be great
from sdk.
Related Issues (14)
- license HOT 2
- ESNext and CommonJS issue HOT 1
- Bug: Cannot read property 'error' of undefined HOT 6
- cronos new pool HOT 1
- Generated bridge transaction failing HOT 1
- Generated bridge transaction failing HOT 1
- support for coingecko ids HOT 1
- Explorer graph ql error
- Dependency Dashboard
- checkCanBridge is private HOT 1
- Native tokenFrom causes an error in executeBridgeTokenTransaction HOT 7
- Add support for Cronos, Metis (New Chains), and Optimism gOHM HOT 1
- Error [ERR_REQUIRE_ESM]: Must use import to load ES Module HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdk.