Skip to content

Commit

Permalink
v2.8.11
Browse files Browse the repository at this point in the history
  • Loading branch information
linkielink authored Feb 25, 2025
2 parents 47b8d52 + 2f24399 commit 5eb56a2
Show file tree
Hide file tree
Showing 8 changed files with 369 additions and 446 deletions.
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mars-v2-frontend",
"version": "2.8.10",
"version": "2.8.11",
"homepage": "./",
"private": false,
"license": "SEE LICENSE IN LICENSE FILE",
Expand All @@ -22,7 +22,7 @@
"dependencies": {
"@cosmjs/cosmwasm-stargate": "^0.33.0",
"@delphi-labs/shuttle-react": "^4.1.0",
"@keplr-wallet/cosmos": "^0.12.186",
"@keplr-wallet/cosmos": "^0.12.190",
"@next/eslint-plugin-next": "^15.1.7",
"@tanstack/react-table": "^8.21.2",
"@tippyjs/react": "^4.2.6",
Expand All @@ -43,9 +43,9 @@
"react-draggable": "^4.4.6",
"react-helmet-async": "^2.0.5",
"react-qr-code": "^2.0.15",
"react-router-dom": "^7.1.5",
"react-router-dom": "^7.2.0",
"react-spring": "^9.7.5",
"react-toastify": "^11.0.3",
"react-toastify": "^11.0.5",
"react-use-clipboard": "^1.0.9",
"recharts": "^2.15.1",
"sharp": "^0.33.5",
Expand All @@ -55,39 +55,39 @@
},
"devDependencies": {
"@babel/eslint-parser": "^7.26.8",
"@eslint/compat": "^1.2.6",
"@eslint/compat": "^1.2.7",
"@svgr/webpack": "^8.1.0",
"@tailwindcss/container-queries": "^0.1.1",
"@tailwindcss/postcss": "^4.0.6",
"@tailwindcss/postcss": "^4.0.8",
"@types/debounce-promise": "^3.1.9",
"@types/lodash.debounce": "^4.0.9",
"@types/lodash.throttle": "^4.1.9",
"@types/node": "^22.13.2",
"@types/react": "19.0.8",
"@types/react-dom": "19.0.3",
"@types/node": "^22.13.5",
"@types/react": "19.0.10",
"@types/react-dom": "19.0.4",
"@types/react-helmet": "^6.1.11",
"@typescript-eslint/eslint-plugin": "^8.24.0",
"@typescript-eslint/parser": "^8.24.0",
"@typescript-eslint/eslint-plugin": "^8.25.0",
"@typescript-eslint/parser": "^8.25.0",
"autoprefixer": "^10.4.20",
"dotenv": "^16.4.7",
"dotenv-cli": "^8.0.0",
"eslint": "^9.20.1",
"eslint": "^9.21.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-functional": "^8.0.0",
"eslint-plugin-functional": "^9.0.1",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-prettier": "^5.2.3",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "^5.1.0",
"husky": "^9.1.7",
"identity-obj-proxy": "^3.0.0",
"lint-staged": "^15.4.3",
"prettier": "^3.5.0",
"prettier": "^3.5.2",
"prettier-plugin-tailwindcss": "^0.6.11",
"shelljs": "^0.8.5",
"tailwind-scrollbar-hide": "^2.0.0",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
"typescript-eslint": "^8.24.0"
"typescript-eslint": "^8.25.0"
},
"engines": {
"npm": "please-use-yarn",
Expand Down
65 changes: 62 additions & 3 deletions src/api/assets/getDexAssets.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,73 @@
import { PERPS_ASSETS } from 'constants/perps'
import { convertAstroportAssetsResponse } from 'utils/assets'
import { setApiError } from 'utils/error'
import { fetchWithTimeout } from 'utils/fetch'
import { FETCH_TIMEOUT } from 'constants/query'
import { LocalStorageKeys } from 'constants/localStorageKeys'

type StoredPerpAsset = Omit<AstroportAsset, 'icon'>

export default async function getDexAssets(chainConfig: ChainConfig) {
const uri = new URL(chainConfig.endpoints.dexAssets)
try {
const assets = await fetch(uri.toString()).then(async (res) => {
const assets = await fetchWithTimeout(uri.toString(), FETCH_TIMEOUT).then(async (res) => {
const data = (await res.json()) as AstroportAssetsCached

if (chainConfig.perps) data.tokens.push(...PERPS_ASSETS)
if (chainConfig.perps) {
const network = chainConfig.id.toLowerCase()
const perpAssetsUrl = `https://raw.githubusercontent.com/mars-protocol/perps-markets/main/markets/${network}.json`

let perpAssets: AstroportAsset[] = []
let usingFallback = true

try {
const perpAssetsResponse = await fetchWithTimeout(perpAssetsUrl, FETCH_TIMEOUT)
const responseData = await perpAssetsResponse.json()

if (perpAssetsResponse.ok && Array.isArray(responseData) && responseData.length > 0) {
perpAssets = responseData
const storedAssets: StoredPerpAsset[] = perpAssets.map(({ icon, ...asset }) => asset)
localStorage.setItem(
`${chainConfig.id}/${LocalStorageKeys.PERPS_ASSETS}`,
JSON.stringify(storedAssets),
)
usingFallback = false
}
} catch (error) {
console.error('Error loading perp assets from API:', error)
}

if (usingFallback) {
try {
const storedAssets = localStorage.getItem(
`${chainConfig.id}/${LocalStorageKeys.PERPS_ASSETS}`,
)
if (storedAssets) {
const parsedAssets = JSON.parse(storedAssets)
if (Array.isArray(parsedAssets) && parsedAssets.length > 0) {
perpAssets = parsedAssets
}
}
} catch (error) {
console.error('Error loading perp assets from localStorage:', error)
}

if (perpAssets.length === 0) {
setApiError(
perpAssetsUrl,
new Error('Failed to load perp assets from both API and storage'),
)
return []
}
}

const processedAssets: AstroportAsset[] = perpAssets.map((asset) => ({
...asset,
icon: usingFallback ? undefined : asset.icon,
}))

data.tokens.push(...processedAssets)
}

return convertAstroportAssetsResponse(data.tokens)
})
return assets
Expand Down
2 changes: 1 addition & 1 deletion src/chains/neutron/pion-1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const Pion1: ChainConfig = {
gasPrices: '/feemarket/v1/gas_price/untrn',
aprs: {
vaults: '',
perpsVault: 'https://testnet-api.marsprotocol.io/v2/perps_vault?chain=neutron',
perpsVault: 'https://backend.test.mars-dev.net/v2/perps_vault?chain=neutron',
},
},
network: NETWORK.TESTNET,
Expand Down
2 changes: 1 addition & 1 deletion src/chains/osmosis/osmosis-1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const Osmosis1: ChainConfig = {
dexAssets: 'https://neutron-cache-api.onrender.com/osmosis-1/tokens',
gasPrices: 'https://osmosis-api.polkachu.com/osmosis/txfees/v1beta1/cur_eip_base_fee',
aprs: {
vaults: 'https://api.marsprotocol.io/v1/vaults/osmosis',
vaults: 'https://backend.prod.mars-dev.net/v1/vaults/osmosis',
},
},
dexName: 'Osmosis Dex',
Expand Down
1 change: 1 addition & 0 deletions src/constants/localStorageKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export enum LocalStorageKeys {
HLS_INFORMATION = 'hlsInformation',
CURRENT_CHAIN_ID = 'currentChainId',
PERPS_ASSET = 'perpsAsset',
PERPS_ASSETS = 'perpsAssets',
UPDATE_ORACLE = 'updateOracle',
CHART_INTERVAL = 'tradingview.chart.lastUsedTimeBasedResolution',
PERPS_VAULT_INFORMATION = 'perpsVaultInformation',
Expand Down
212 changes: 0 additions & 212 deletions src/constants/perps.ts
Original file line number Diff line number Diff line change
@@ -1,215 +1,3 @@
import { ActionKind } from 'types/generated/mars-perps/MarsPerps.types'

export const PERPS_DEFAULT_ACTION: { action: ActionKind } = { action: 'default' }

export const PERPS_ASSETS: AstroportAsset[] = [
{
chainId: 'neutron-1',
denom: 'perps/ubtc',
symbol: 'BTC',
icon: 'https://raw.githubusercontent.com/mars-protocol/mars-v2-frontend/refs/heads/main/src/components/common/Icons/BTCLogo.svg',
description: 'Bitcoin',
decimals: 6,
priceUSD: 0,
totalLiquidityUSD: 0,
dayVolumeUSD: 0,
},
{
chainId: 'neutron-1',
denom: 'perps/ueth',
symbol: 'ETH',
icon: 'https://raw.githubusercontent.com/mars-protocol/mars-v2-frontend/refs/heads/main/src/components/common/Icons/ETHLogo.svg',
description: 'Ethereum',
decimals: 6,
priceUSD: 0,
totalLiquidityUSD: 0,
dayVolumeUSD: 0,
},
{
chainId: 'neutron-1',
denom: 'perps/uatom',
symbol: 'ATOM',
icon: 'https://raw.githubusercontent.com/mars-protocol/mars-v2-frontend/refs/heads/main/src/components/common/Icons/ATOMLogo.svg',
description: 'Cosmos',
decimals: 6,
priceUSD: 0,
totalLiquidityUSD: 0,
dayVolumeUSD: 0,
},
{
chainId: 'neutron-1',
denom: 'perps/ubnb',
symbol: 'BNB',
icon: 'https://raw.githubusercontent.com/mars-protocol/mars-v2-frontend/refs/heads/main/src/components/common/Icons/BNBLogo.svg',
description: 'Binance Coin',
decimals: 6,
priceUSD: 0,
totalLiquidityUSD: 0,
dayVolumeUSD: 0,
},
{
chainId: 'neutron-1',
denom: 'perps/usol',
symbol: 'SOL',
icon: 'https://raw.githubusercontent.com/mars-protocol/mars-v2-frontend/refs/heads/main/src/components/common/Icons/SOLLogo.svg',
description: 'Solana',
decimals: 6,
priceUSD: 0,
totalLiquidityUSD: 0,
dayVolumeUSD: 0,
},
{
chainId: 'neutron-1',
denom: 'perps/uxrp',
symbol: 'XRP',
icon: 'https://raw.githubusercontent.com/mars-protocol/mars-v2-frontend/refs/heads/main/src/components/common/Icons/XRPLogo.svg',
description: 'Ripple',
decimals: 6,
priceUSD: 0,
totalLiquidityUSD: 0,
dayVolumeUSD: 0,
},
{
chainId: 'neutron-1',
denom: 'perps/udoge',
symbol: 'DOGE',
icon: 'https://raw.githubusercontent.com/mars-protocol/mars-v2-frontend/refs/heads/main/src/components/common/Icons/DOGELogo.svg',
description: 'Dogecoin',
decimals: 6,
priceUSD: 0,
totalLiquidityUSD: 0,
dayVolumeUSD: 0,
},
{
chainId: 'neutron-1',
denom: 'perps/ushiba',
symbol: 'SHIBA',
icon: 'https://raw.githubusercontent.com/mars-protocol/mars-v2-frontend/refs/heads/main/src/components/common/Icons/SHIBALogo.svg',
description: 'Shiba Inu',
decimals: 6,
priceUSD: 0,
totalLiquidityUSD: 0,
dayVolumeUSD: 0,
},
{
chainId: 'neutron-1',
denom: 'perps/uavax',
symbol: 'AVAX',
icon: 'https://raw.githubusercontent.com/mars-protocol/mars-v2-frontend/refs/heads/main/src/components/common/Icons/AVAXLogo.svg',
description: 'Avalanche',
decimals: 6,
priceUSD: 0,
totalLiquidityUSD: 0,
dayVolumeUSD: 0,
},
{
chainId: 'neutron-1',
denom: 'perps/utrx',
symbol: 'TRX',
icon: 'https://raw.githubusercontent.com/mars-protocol/mars-v2-frontend/refs/heads/main/src/components/common/Icons/TRXLogo.svg',
description: 'Tron',
decimals: 6,
priceUSD: 0,
totalLiquidityUSD: 0,
dayVolumeUSD: 0,
},
{
chainId: 'neutron-1',
denom: 'perps/uinj',
symbol: 'INJ',
icon: 'https://raw.githubusercontent.com/mars-protocol/mars-v2-frontend/refs/heads/main/src/components/common/Icons/INJLogo.svg',
description: 'Injective',
decimals: 6,
priceUSD: 0,
totalLiquidityUSD: 0,
dayVolumeUSD: 0,
},
{
chainId: 'neutron-1',
denom: 'perps/udydx',
symbol: 'DYDX',
icon: 'https://raw.githubusercontent.com/mars-protocol/mars-v2-frontend/refs/heads/main/src/components/common/Icons/DYDXLogo.svg',
description: 'DyDx Token',
decimals: 6,
priceUSD: 0,
totalLiquidityUSD: 0,
dayVolumeUSD: 0,
},
{
chainId: 'neutron-1',
denom: 'perps/utia',
symbol: 'TIA',
icon: 'https://raw.githubusercontent.com/mars-protocol/mars-v2-frontend/refs/heads/main/src/components/common/Icons/TIALogo.svg',
description: 'Celestia',
decimals: 6,
priceUSD: 0,
totalLiquidityUSD: 0,
dayVolumeUSD: 0,
},
{
chainId: 'neutron-1',
denom: 'perps/upepe',
symbol: 'PEPE',
icon: 'https://raw.githubusercontent.com/mars-protocol/mars-v2-frontend/refs/heads/main/src/components/common/Icons/PEPELogo.svg',
description: 'Pepe Coin',
decimals: 6,
priceUSD: 0,
totalLiquidityUSD: 0,
dayVolumeUSD: 0,
},
{
chainId: 'neutron-1',
denom: 'perps/usui',
symbol: 'SUI',
icon: 'https://raw.githubusercontent.com/mars-protocol/mars-v2-frontend/refs/heads/main/src/components/common/Icons/SUILogo.svg',
description: 'Sui',
decimals: 6,
priceUSD: 0,
totalLiquidityUSD: 0,
dayVolumeUSD: 0,
},
{
chainId: 'neutron-1',
denom: 'perps/untrn',
symbol: 'NTRN',
icon: 'https://raw.githubusercontent.com/mars-protocol/mars-v2-frontend/refs/heads/main/src/components/common/Icons/NTRNLogo.svg',
description: 'Neutron',
decimals: 6,
priceUSD: 0,
totalLiquidityUSD: 0,
dayVolumeUSD: 0,
},
{
chainId: 'neutron-1',
denom: 'perps/uosmo',
symbol: 'OSMO',
icon: 'https://raw.githubusercontent.com/mars-protocol/mars-v2-frontend/refs/heads/main/src/components/common/Icons/OSMOLogo.svg',
description: 'Osmosis',
decimals: 6,
priceUSD: 0,
totalLiquidityUSD: 0,
dayVolumeUSD: 0,
},
{
chainId: 'neutron-1',
denom: 'perps/utrump',
symbol: 'TRUMP',
icon: 'https://raw.githubusercontent.com/mars-protocol/mars-v2-frontend/refs/heads/main/src/components/common/Icons/TRUMPLogo.svg',
description: 'Official Trump',
decimals: 6,
priceUSD: 0,
totalLiquidityUSD: 0,
dayVolumeUSD: 0,
},
{
chainId: 'pion-1',
denom: 'factory/neutron1ke0vqqzyymlp5esr8gjwuzh94ysnpvj8er5hm7/UUSDC',
symbol: 'USDC',
icon: 'https://raw.githubusercontent.com/mars-protocol/mars-v2-frontend/refs/heads/main/src/components/common/Icons/MarsUSDCLogo.svg',
description: 'Mars USDC',
decimals: 6,
priceUSD: 0,
totalLiquidityUSD: 0,
dayVolumeUSD: 0,
},
]
Loading

0 comments on commit 5eb56a2

Please sign in to comment.