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

refactor: token list api source #2860

Merged
merged 1 commit into from
Nov 1, 2023
Merged

Conversation

stackchain
Copy link
Member

@stackchain stackchain commented Nov 1, 2023

** Breaking change **

  • Updated openswap api to use token-list instead of list
  • Updated the types
  • Updated manager, helpers and transformers
  • Removed volume (which as supply) from the list
  • Approved by product

Relates to YOMO-925


Context

The /list api is very restricted to the amount of queries 1/hour

@stackchain stackchain added this to the 4.23.0 milestone Nov 1, 2023
@stackchain stackchain marked this pull request as ready for review November 1, 2023 12:38
@stackchain stackchain force-pushed the refactor/token-list-source branch from 6834a1f to 573a422 Compare November 1, 2023 12:38
@@ -63,13 +62,15 @@ export const AmountItem = ({isPrivacyOff, wallet, style, amount, inWallet, suppl
</Middle>

<Right>
{tokenInfo.kind !== 'nft' && (
{tokenInfo.kind !== 'nft' && variant !== 'swap' && (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed the variant swap to don't list supply / pair

const isValidNameB = containsOnlyValidChars(b.info.name)
const isValidTickerA = containsOnlyValidChars(a.info.ticker)
const isValidTickerB = containsOnlyValidChars(b.info.ticker)
export const sortTokensByName = (a: Balance.TokenInfo, b: Balance.TokenInfo, wallet: YoroiWallet) => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new endpoint returns TokenInfo not Token, adjusted

"version": "independent",
"command": {
"run": {
"ignore": ["e2e/*"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignoring e2e on lerna (it was rebuilding it)

@@ -95,13 +96,17 @@ export class OpenSwapApi {
)
}

public async getTokens({policyId = '', assetName = ''} = {}) {
const tokens = await getTokens(
public async getTokenPairs({policyId = '', assetName = ''} = {}) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getTokens is actually getTokenPairs

ticker: info.symbol,
metadatas: {},
},
info: asYoroiBalanceTokenInfo(info),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

migrated to the specialized helper

@@ -57,7 +57,7 @@ export const SwapTabNavigator = () => {
}, [aggregatorTokenId, lpTokenHeld, lpTokenHeldChanged])

// pre load swap tokens
const {refetch} = useSwapTokensByPairToken('', {suspense: false, enabled: false})
const {refetch} = useSwapTokensOnlyVerified({suspense: false, enabled: false})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre-fetch updated, until we migrate router for tan stack router

@stackchain stackchain force-pushed the refactor/token-list-source branch from 573a422 to 8e0c66d Compare November 1, 2023 13:15
@stackchain stackchain merged commit ce16074 into develop Nov 1, 2023
2 checks passed
@stackchain stackchain deleted the refactor/token-list-source branch November 1, 2023 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants