Skip to content
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

Merged
merged 8 commits into from
Dec 2, 2024
Merged

Add dynamic whitelisting #351

merged 8 commits into from
Dec 2, 2024

Conversation

peachbits
Copy link
Contributor

@peachbits peachbits commented Nov 13, 2024

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

none

Copy link
Contributor

@swansontec swansontec left a 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.

// Map of swap provider's chain codes and the tokens they support
export type ChainCodeTickerMap = Map<
string,
Set<{ tokenCode: string; contractAddress: string | null }>
Copy link
Contributor

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.
@peachbits peachbits merged commit d55768f into master Dec 2, 2024
1 check passed
@peachbits peachbits deleted the matthew/whitelist branch December 2, 2024 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants