-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add dynamic whitelisting #351
Conversation
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.
One small change needed, but this looks pretty good.
src/util/swapHelpers.ts
Outdated
// Map of swap provider's chain codes and the tokens they support | ||
export type ChainCodeTickerMap = Map< | ||
string, | ||
Set<{ tokenCode: string; contractAddress: string | null }> |
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 no point in making this a Set, since the objects inside won't be de-duplicated. It could be a plain array, or it be a Map
from token code to contract address. Since createEdgeIdToSwapIdMap
just loops over it, probably the Array is better.
Use getTokenId on currencyConfig instead
"Draw the rest of the fucking owl" The goal is to map the swap provider's chain/token code combo to EdgeTokenIds without causing too much of a slow down by adding unnecessary fetches. To accomplish this, we can grab the data from the provider once and hold them in memory indefinitely as `chainCodeTickerMap`. We'll convert the cached data As requests are made, we map that cached data to EdgeTokenIds using `getTokenId` which is available on the wallets in the request.
88c0d77
to
2014413
Compare
CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
noneDescription
none