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

fix: generateRelatedAssetIndex not running due to ethers hdwallet import woes #7744

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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

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.

Large diffs are not rendered by default.

280 changes: 136 additions & 144 deletions scripts/generateAssetData/colorMap/color-map.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import {
fromAssetId,
optimismAssetId,
} from '@shapeshiftoss/caip'
import { isEvmChainId } from '@shapeshiftoss/chain-adapters'
import type { Asset, AssetsById } from '@shapeshiftoss/types'
import { type Asset, type AssetsById, KnownChainIds } from '@shapeshiftoss/types'
import axios from 'axios'
import axiosRetry from 'axios-retry'
import fs from 'fs'
Expand All @@ -34,6 +33,19 @@ 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

Comment on lines +36 to +48
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI @woodenfurniture I actually did the exact same in #7736 (comment) for the same reason - going to nuke all chain-adapters consumptions and leverage utils only in a follow-up 🙏🏽

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

const { chainId, assetReference } = fromAssetId(assetId)

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

const filter = { params: { 'filter[implementation_address]': assetReference } }
const url = '/fungibles'
Expand Down
Loading