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

feat: markets page recommended tab and Portals assets #7736

Merged
merged 47 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
d275640
wip: markets page recommended tab
gomesalexandre Sep 11, 2024
0f891e6
feat: descynchronise chain selection
gomesalexandre Sep 12, 2024
2a1d75e
feat: dry
gomesalexandre Sep 12, 2024
0bb9f15
feat: progression
gomesalexandre Sep 12, 2024
544d218
feat: more progression
gomesalexandre Sep 12, 2024
505ca2d
feat: visual progression
gomesalexandre Sep 12, 2024
3ced439
feat: more unify
gomesalexandre Sep 12, 2024
53b628c
fix: chainIds over chainId
gomesalexandre Sep 12, 2024
51d0a04
feat: yeah right I'm definitely becoming a shepherd I guess
gomesalexandre Sep 12, 2024
a5a59ac
fix: unbork color-map script
gomesalexandre Sep 12, 2024
4443f22
feat: portals initial wire-up
gomesalexandre Sep 12, 2024
a288998
feat: onClick
gomesalexandre Sep 12, 2024
78ae09b
feat: cleanup
gomesalexandre Sep 12, 2024
402721e
feat: progression
gomesalexandre Sep 12, 2024
bf85534
feat: fetch market data
gomesalexandre Sep 12, 2024
7005494
Merge remote-tracking branch 'origin/develop' into feat_recommended_1
gomesalexandre Sep 12, 2024
79b4bcb
feat: cleanup log
gomesalexandre Sep 12, 2024
cbce36f
feat: todos
gomesalexandre Sep 12, 2024
67aa746
feat: more cleanup
gomesalexandre Sep 12, 2024
a489cd3
fix: beard oil but not by beard, maybe neo oil? but I dont have any b…
NeOMakinG Sep 13, 2024
3bb3b37
Merge remote-tracking branch 'origin/develop' into feat_recommended_1
gomesalexandre Sep 16, 2024
7c567af
Merge remote-tracking branch 'origin/develop' into feat_recommended_1
gomesalexandre Sep 16, 2024
4b59a86
fix: merge
gomesalexandre Sep 16, 2024
278f724
feat: leverage portalsPlatforms query
gomesalexandre Sep 16, 2024
534b527
feat: regen all
gomesalexandre Sep 16, 2024
5b489df
feat: cleaner apy
gomesalexandre Sep 16, 2024
ae2fadb
fix: market-data things
gomesalexandre Sep 16, 2024
aff1ad4
Merge branch 'develop' into feat_recommended_1
gomesalexandre Sep 17, 2024
20e59ae
Merge branch 'develop' into feat_recommended_1
gomesalexandre Sep 18, 2024
4d4230f
feat: :%s/`/'/g
gomesalexandre Sep 18, 2024
59d8d65
fix: missing occurences
gomesalexandre Sep 18, 2024
f64fb8e
feat: referential stability
gomesalexandre Sep 18, 2024
5fa241b
feat: parameterize percentage jump
gomesalexandre Sep 18, 2024
f2edf5e
Merge remote-tracking branch 'origin/develop' into feat_recommended_1
gomesalexandre Sep 18, 2024
366bdea
feat: add generate:all script and regen
gomesalexandre Sep 18, 2024
0d06530
feat: checkout origin/develop generatedAssetData
gomesalexandre Sep 18, 2024
d78dc6d
fix: limit
gomesalexandre Sep 18, 2024
5146448
feat: regen
gomesalexandre Sep 18, 2024
e357114
feat: regen
gomesalexandre Sep 18, 2024
9b09751
Merge branch 'develop' into feat_recommended_1
gomesalexandre Sep 19, 2024
7dfee08
feat: use assets icon
gomesalexandre Sep 19, 2024
78d258f
feat: decouple per-chain
gomesalexandre Sep 19, 2024
8f83532
feat: filter out nova
gomesalexandre Sep 19, 2024
81f9492
feat: proper query narrowing
gomesalexandre Sep 19, 2024
9d45348
feat: remove useless process.env short circuit
gomesalexandre Sep 19, 2024
16b42c9
feat: regen:all
gomesalexandre Sep 19, 2024
c4cb191
Merge remote-tracking branch 'origin/develop' into feat_recommended_1
gomesalexandre Sep 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"dev:web:linked": "GENERATE_SOURCEMAP=false BROWSER=none yarn dev:web",
"dev:packages": "yarn tsc --build --watch --preserveWatchOutput tsconfig.packages.json",
"env": "yarn tsx ./scripts/bootstrap-env.ts",
"generate:all": "yarn generate:caip-adapters && yarn run generate:color-map && yarn run generate:asset-data && yarn run generate:thor-asset-map && yarn run generate:thor-longtail-tokens",
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
"generate:caip-adapters": "yarn workspace @shapeshiftoss/caip generate",
"generate:asset-data": "yarn tsx ./scripts/generateAssetData/generateAssetData.ts && yarn run codemod:clear-assets-migration",
"generate:related-asset-index": "yarn tsx ./scripts/generateAssetData/generateRelatedAssetIndex.ts && yarn run codemod:clear-assets-migration",
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"ETH.GUSD-0X056FD409E1D7A124BD7017459DFEA2F387B6D5CD": "eip155:1/erc20:0x056fd409e1d7a124bd7017459dfea2f387b6d5cd",
"ETH.HOT-0X6C6EE5E31D828DE241282B9606C8E98EA48526E2": "eip155:1/erc20:0x6c6ee5e31d828de241282b9606c8e98ea48526e2",
"ETH.KYL-0X67B6D479C7BB412C54E03DCA8E1BC6740CE6B99C": "eip155:1/erc20:0x67b6d479c7bb412c54e03dca8e1bc6740ce6b99c",
"ETH.LENDS-0X2C06BA9E7F0DACCBC1F6A33EA67E85BB68FBEE3A": "eip155:1/erc20:0x2c06ba9e7f0daccbc1f6a33ea67e85bb68fbee3a",
"ETH.LINK-0X514910771AF9CA656AF840DFF83E8264ECF986CA": "eip155:1/erc20:0x514910771af9ca656af840dff83e8264ecf986ca",
"ETH.LUSD-0X5F98805A4E8BE255A32880FDEC7F6728C6568BA0": "eip155:1/erc20:0x5f98805a4e8be255a32880fdec7f6728c6568ba0",
"ETH.RAZE-0X5EAA69B29F99C84FE5DE8200340B4E9B4AB38EAC": "eip155:1/erc20:0x5eaa69b29f99c84fe5de8200340b4e9b4ab38eac",
Expand Down
20 changes: 20 additions & 0 deletions packages/utils/src/evmChainIds.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { EvmChainId } from '@shapeshiftoss/types'
import { KnownChainIds } from '@shapeshiftoss/types'

export const isEvmChainId = (
maybeEvmChainId: string | EvmChainId,
): maybeEvmChainId is EvmChainId => {
return evmChainIds.includes(maybeEvmChainId as EvmChainId)
}

export const evmChainIds = [
KnownChainIds.EthereumMainnet,
KnownChainIds.AvalancheMainnet,
KnownChainIds.OptimismMainnet,
KnownChainIds.BnbSmartChainMainnet,
KnownChainIds.PolygonMainnet,
KnownChainIds.GnosisMainnet,
KnownChainIds.ArbitrumMainnet,
KnownChainIds.ArbitrumNovaMainnet,
KnownChainIds.BaseMainnet,
] as const
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions packages/utils/src/index.ts
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export * from './promises'
export * from './treasury'
export * from './timeout'
export * from './createThrottle'
export * from './evmChainIds'

export const isSome = <T>(option: T | null | undefined): option is T =>
!isUndefined(option) && !isNull(option)
4 changes: 2 additions & 2 deletions scripts/generateAssetData/arbitrum/index.ts
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { arbitrumChainId } from '@shapeshiftoss/caip'
import type { Asset } from '@shapeshiftoss/types'
import partition from 'lodash/partition'
import uniqBy from 'lodash/uniqBy'
import { getPortalTokens } from 'lib/portals/utils'

import { arbitrum } from '../baseAssets'
import * as coingecko from '../coingecko'
import { getPortalTokens } from '../utils/portals'

export const getAssets = async (): Promise<Asset[]> => {
const results = await Promise.allSettled([
coingecko.getAssets(arbitrumChainId),
getPortalTokens(arbitrum),
getPortalTokens(arbitrum, 'all'),
])
const [assets, _portalsAssets] = results.map(result => {
if (result.status === 'fulfilled') return result.value
Expand Down
4 changes: 2 additions & 2 deletions scripts/generateAssetData/avalanche/index.ts
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { avalancheChainId } from '@shapeshiftoss/caip'
import type { Asset } from '@shapeshiftoss/types'
import partition from 'lodash/partition'
import uniqBy from 'lodash/uniqBy'
import { getPortalTokens } from 'lib/portals/utils'

import { avax } from '../baseAssets'
import * as coingecko from '../coingecko'
import { getPortalTokens } from '../utils/portals'

export const getAssets = async (): Promise<Asset[]> => {
const results = await Promise.allSettled([
coingecko.getAssets(avalancheChainId),
getPortalTokens(avax),
getPortalTokens(avax, 'all'),
])

const [assets, _portalsAssets] = results.map(result => {
Expand Down
4 changes: 2 additions & 2 deletions scripts/generateAssetData/base/index.ts
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { baseChainId } from '@shapeshiftoss/caip'
import type { Asset } from '@shapeshiftoss/types'
import partition from 'lodash/partition'
import uniqBy from 'lodash/uniqBy'
import { getPortalTokens } from 'lib/portals/utils'

import { base } from '../baseAssets'
import * as coingecko from '../coingecko'
import { getPortalTokens } from '../utils/portals'

export const getAssets = async (): Promise<Asset[]> => {
const results = await Promise.allSettled([
coingecko.getAssets(baseChainId),
getPortalTokens(base),
getPortalTokens(base, 'all'),
])

const [assets, _portalsAssets] = results.map(result => {
Expand Down
4 changes: 2 additions & 2 deletions scripts/generateAssetData/bnbsmartchain/index.ts
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { bscChainId } from '@shapeshiftoss/caip'
import type { Asset } from '@shapeshiftoss/types'
import { partition } from 'lodash'
import uniqBy from 'lodash/uniqBy'
import { getPortalTokens } from 'lib/portals/utils'

import { bnbsmartchain } from '../baseAssets'
import * as coingecko from '../coingecko'
import { getPortalTokens } from '../utils/portals'

export const getAssets = async (): Promise<Asset[]> => {
const results = await Promise.allSettled([
coingecko.getAssets(bscChainId),
getPortalTokens(bnbsmartchain),
getPortalTokens(bnbsmartchain, 'all'),
])

const [assets, _portalsAssets] = results.map(result => {
Expand Down
2 changes: 1 addition & 1 deletion scripts/generateAssetData/coingecko.ts
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
import type { Asset } from '@shapeshiftoss/types'
import axios from 'axios'

import { colorMap } from './../../src/lib/asset-service/service/colorMap'
import {
arbitrum,
arbitrumNova,
Expand All @@ -27,7 +28,6 @@ import {
optimism,
polygon,
} from './baseAssets'
import { colorMap } from './colorMap'

type Token = {
chainId: number
Expand Down
2 changes: 1 addition & 1 deletion scripts/generateAssetData/cosmos/index.ts
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { cosmosChainId } from '@shapeshiftoss/caip'
import type { Asset } from '@shapeshiftoss/types'
import axios from 'axios'

import { colorMap } from '../../../src/lib/asset-service/service/colorMap'
import { atom } from '../baseAssets'
import { colorMap } from '../colorMap'

type CosmosAsset = {
denom: string
Expand Down
2 changes: 1 addition & 1 deletion scripts/generateAssetData/ethTokens/uniswap.ts
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ethChainId as chainId, toAssetId } from '@shapeshiftoss/caip'
import type { Asset } from '@shapeshiftoss/types'
import axios from 'axios'

import { colorMap } from '../colorMap'
import { colorMap } from '../../../src/lib/asset-service/service/colorMap'

type UniswapToken = {
chainId: number
Expand Down
4 changes: 2 additions & 2 deletions scripts/generateAssetData/ethereum/index.ts
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import chunk from 'lodash/chunk'
import orderBy from 'lodash/orderBy'
import partition from 'lodash/partition'
import uniqBy from 'lodash/uniqBy'
import { getPortalTokens } from 'lib/portals/utils'

import { ethereum } from '../baseAssets'
import * as coingecko from '../coingecko'
import { generateTrustWalletUrl } from '../generateTrustWalletUrl/generateTrustWalletUrl'
import { getPortalTokens } from '../utils/portals'

const foxyToken: Asset = {
assetId: toAssetId({
Expand All @@ -32,7 +32,7 @@ const foxyToken: Asset = {
export const getAssets = async (): Promise<Asset[]> => {
const results = await Promise.allSettled([
coingecko.getAssets(ethChainId),
getPortalTokens(ethereum),
getPortalTokens(ethereum, 'all'),
])

const [coingeckoTokens, portalsTokens] = results.map(result => {
Expand Down
3 changes: 2 additions & 1 deletion scripts/generateAssetData/generateColorMap.ts
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ const generateColorMap = async () => {
}, initial)

await fs.promises.writeFile(
`./scripts/generateAssetData/colorMap/color-map.json`,
// note: cwd is the root of the monorepo, *not* the script directory
'src/lib/asset-service/service/color-map.json',
// beautify the file for github diff.
JSON.stringify(colorMap, null, 2),
)
Expand Down
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
fromAssetId,
optimismAssetId,
} from '@shapeshiftoss/caip'
import { type Asset, type AssetsById, KnownChainIds } from '@shapeshiftoss/types'
import type { Asset, AssetsById } from '@shapeshiftoss/types'
import { isEvmChainId } from '@shapeshiftoss/utils'
import axios from 'axios'
import axiosRetry from 'axios-retry'
import fs from 'fs'
Expand All @@ -33,19 +34,6 @@ axiosRetry(axiosInstance, { retries: 5, retryDelay: axiosRetry.exponentialDelay
const ZERION_API_KEY = process.env.ZERION_API_KEY
if (!ZERION_API_KEY) throw new Error('Missing Zerion API key - see readme for instructions')

// Redeclared here due to ethers import issues
export const EVM_CHAIN_IDS = [
KnownChainIds.EthereumMainnet,
KnownChainIds.AvalancheMainnet,
KnownChainIds.OptimismMainnet,
KnownChainIds.BnbSmartChainMainnet,
KnownChainIds.PolygonMainnet,
KnownChainIds.GnosisMainnet,
KnownChainIds.ArbitrumMainnet,
KnownChainIds.ArbitrumNovaMainnet,
KnownChainIds.BaseMainnet,
] as const

const manualRelatedAssetIndex: Record<AssetId, AssetId[]> = {
[ethAssetId]: [
optimismAssetId,
Expand Down Expand Up @@ -126,11 +114,7 @@ const getRelatedAssetIds = async (

const { chainId, assetReference } = fromAssetId(assetId)

if (
!EVM_CHAIN_IDS.includes(chainId as (typeof EVM_CHAIN_IDS)[number]) ||
FEE_ASSET_IDS.includes(assetId)
)
return
if (!isEvmChainId(chainId) || FEE_ASSET_IDS.includes(assetId)) return

const filter = { params: { 'filter[implementation_address]': assetReference } }
const url = '/fungibles'
Expand Down
4 changes: 2 additions & 2 deletions scripts/generateAssetData/gnosis/index.ts
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { gnosisChainId } from '@shapeshiftoss/caip'
import type { Asset } from '@shapeshiftoss/types'
import partition from 'lodash/partition'
import uniqBy from 'lodash/uniqBy'
import { getPortalTokens } from 'lib/portals/utils'

import { gnosis } from '../baseAssets'
import * as coingecko from '../coingecko'
import { getPortalTokens } from '../utils/portals'

export const getAssets = async (): Promise<Asset[]> => {
const [assets, _portalsAssets] = await Promise.all([
coingecko.getAssets(gnosisChainId),
getPortalTokens(gnosis),
getPortalTokens(gnosis, 'all'),
])

// Order matters here - We do a uniqBy and only keep the first of each asset using assetId as a criteria
Expand Down
4 changes: 2 additions & 2 deletions scripts/generateAssetData/optimism/index.ts
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { optimismChainId } from '@shapeshiftoss/caip'
import type { Asset } from '@shapeshiftoss/types'
import partition from 'lodash/partition'
import uniqBy from 'lodash/uniqBy'
import { getPortalTokens } from 'lib/portals/utils'

import { optimism } from '../baseAssets'
import * as coingecko from '../coingecko'
import { getPortalTokens } from '../utils/portals'

export const getAssets = async (): Promise<Asset[]> => {
const results = await Promise.allSettled([
coingecko.getAssets(optimismChainId),
getPortalTokens(optimism),
getPortalTokens(optimism, 'all'),
])

const [assets, _portalsAssets] = results.map(result => {
Expand Down
4 changes: 2 additions & 2 deletions scripts/generateAssetData/polygon/index.ts
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { polygonChainId } from '@shapeshiftoss/caip'
import type { Asset } from '@shapeshiftoss/types'
import partition from 'lodash/partition'
import uniqBy from 'lodash/uniqBy'
import { getPortalTokens } from 'lib/portals/utils'

import { polygon } from '../baseAssets'
import * as coingecko from '../coingecko'
import { getPortalTokens } from '../utils/portals'

export const getAssets = async (): Promise<Asset[]> => {
const results = await Promise.allSettled([
coingecko.getAssets(polygonChainId),
getPortalTokens(polygon),
getPortalTokens(polygon, 'all'),
])

const [assets, _portalsAssets] = results.map(result => {
Expand Down
Loading
Loading