From 88fc1d4f59e1a666c29b36539a5bd92bfd356af3 Mon Sep 17 00:00:00 2001 From: Linkie Link Date: Tue, 14 Nov 2023 16:43:09 +0100 Subject: [PATCH] listed: TIA and USDT --- src/api/prices/getPrices.ts | 6 ++---- src/constants/assets.ts | 37 +++++++++++++++++++++++++++++++++ src/store/slices/broadcast.ts | 7 ++++--- src/types/interfaces/asset.d.ts | 24 ++++++++++++--------- src/utils/broadcast.ts | 2 +- 5 files changed, 58 insertions(+), 18 deletions(-) diff --git a/src/api/prices/getPrices.ts b/src/api/prices/getPrices.ts index 9deda03b..8b4f077c 100644 --- a/src/api/prices/getPrices.ts +++ b/src/api/prices/getPrices.ts @@ -1,10 +1,8 @@ import getOraclePrices from 'api/prices/getOraclePrices' import getPoolPrice from 'api/prices/getPoolPrice' import fetchPythPrices from 'api/prices/getPythPrices' -import { ENV } from 'constants/env' import useStore from 'store' import { BNCoin } from 'types/classes/BNCoin' -import { NETWORK } from 'types/enums/network' import { partition } from 'utils/array' import { getAssetsMustHavePriceInfo } from 'utils/assets' @@ -59,13 +57,13 @@ function separateAssetsByPriceSources(assets: Asset[]) { // Only fetch Pyth prices for mainnet const [assetsWithPythPriceFeedId, assetsWithoutPythPriceFeedId] = partition( assets, - (asset) => !!asset.pythPriceFeedId && ENV.NETWORK === NETWORK.MAINNET, + (asset) => !!asset.pythPriceFeedId, ) // Don't get oracle price if it's not mainnet and there is a poolId const [assetsWithOraclePrice, assetsWithoutOraclePrice] = partition( assetsWithoutPythPriceFeedId, - (asset) => (asset.hasOraclePrice && ENV.NETWORK === NETWORK.MAINNET) || !asset.poolId, + (asset) => asset.hasOraclePrice || !asset.poolId, ) const assetsWithPoolId = assetsWithoutOraclePrice.filter((asset) => !!asset.poolId) diff --git a/src/constants/assets.ts b/src/constants/assets.ts index 71e93ee0..63d24dd5 100644 --- a/src/constants/assets.ts +++ b/src/constants/assets.ts @@ -157,6 +157,25 @@ export const ASSETS: Asset[] = [ pythHistoryFeedId: 'Crypto.USDC/USD', poolId: ENV.NETWORK === NETWORK.DEVNET ? 678 : 1221, }, + { + symbol: 'USDT', + id: 'USDT', + name: 'Tether', + denom: 'ibc/4ABBEF4C8926DDDB320AE5188CFD63267ABBCEFC0583E4AE05D6E5AA2401DDAB', + color: '#50af95', + logo: '/images/tokens/usdt.svg', + decimals: 6, + hasOraclePrice: true, + isEnabled: true, + isMarket: true, + isDisplayCurrency: true, + isStable: true, + isAutoLendEnabled: true, + isBorrowEnabled: true, + pythPriceFeedId: '0x2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b', + poolId: 1077, + pythHistoryFeedId: 'Crypto.USDT/USD', + }, { symbol: 'AXL', name: 'Axelar', @@ -174,6 +193,24 @@ export const ASSETS: Asset[] = [ pythHistoryFeedId: 'Crypto.AXL/USD', poolId: 812, }, + { + symbol: 'INJ', + id: 'INJ', + name: 'Injective', + denom: 'ibc/64BA6E31FE887D66C6F8F31C7B1A80C7CA179239677B4088BB55F5EA07DBE273', + color: '#00F2FE', + logo: '/images/tokens/inj.svg', + decimals: 18, + hasOraclePrice: true, + isEnabled: true, + isMarket: true, + isDisplayCurrency: true, + isAutoLendEnabled: true, + isBorrowEnabled: true, + pythPriceFeedId: '0x7a5bc1d2b56ad029048cd63964b3ad2776eadf812edc1a43a31406cb54bff592', + poolId: 725, + pythHistoryFeedId: 'Crypto.INJ/USD', + }, { symbol: 'TIA', id: 'TIA', diff --git a/src/store/slices/broadcast.ts b/src/store/slices/broadcast.ts index bd7f0fea..cf8edefc 100644 --- a/src/store/slices/broadcast.ts +++ b/src/store/slices/broadcast.ts @@ -827,9 +827,10 @@ export default function createBroadcastSlice( result: undefined, error: 'Transaction failed', } - } catch (e: unknown) { - const error = typeof e === 'string' ? e : 'Transaction failed' - return { result: undefined, error } + } catch (error) { + const e = error as { message: string } + console.log(e) + return { result: undefined, error: e.message } } }, } diff --git a/src/types/interfaces/asset.d.ts b/src/types/interfaces/asset.d.ts index 67afa00f..7f504408 100644 --- a/src/types/interfaces/asset.d.ts +++ b/src/types/interfaces/asset.d.ts @@ -3,38 +3,42 @@ interface Asset { name: string denom: string symbol: - | 'OSMO' | 'ATOM' + | 'AXL' + | 'INJ' | 'MARS' + | 'OSMO' | 'stATOM' | 'stOSMO' - | 'AXL' | 'TIA' | 'USDC.axl' | 'USDC' + | 'USDT' | 'WBTC.axl' | 'WETH.axl' | 'OSMO-USDC.n' - | '$' | 'OSMO-ATOM' | 'OSMO-USDC.axl' | 'OSMO-WETH.axl' | 'OSMO-WBTC.axl' | 'stATOM-ATOM' + | '$' id: - | 'OSMO' | 'ATOM' - | 'MARS' - | 'stATOM' - | 'stOSMO' | 'AXL' - | 'TIA' + | 'INJ' | 'axlUSDC' | 'axlWBTC' | 'axlWETH' - | 'USDC' - | 'OSMO-USDC.n' + | 'MARS' + | 'OSMO' + | 'stATOM' + | 'stOSMO' + | 'TIA' | 'USD' + | 'USDC' + | 'USDT' + | 'OSMO-USDC.n' | 'gamm/pool/12' | 'gamm/pool/1' | 'gamm/pool/678' diff --git a/src/utils/broadcast.ts b/src/utils/broadcast.ts index e0271d54..4231d9c3 100644 --- a/src/utils/broadcast.ts +++ b/src/utils/broadcast.ts @@ -16,6 +16,6 @@ export function getSingleValueFromBroadcastResult( export function generateErrorMessage(result: BroadcastResult, errorMessage?: string) { const error = result.error ? result.error : result.result?.rawLogs if (errorMessage) return errorMessage - if (error === 'Transaction failed') return 'Transaction rejected by user' + if (error === 'Transaction failed: Request rejected') return 'Transaction rejected by user' return `Transaction failed: ${error}` }