listed: TIA and USDT

This commit is contained in:
Linkie Link 2023-11-14 16:43:09 +01:00
parent eba9951d61
commit 88fc1d4f59
No known key found for this signature in database
GPG Key ID: 5318B0F2564D38EA
5 changed files with 58 additions and 18 deletions

View File

@ -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)

View File

@ -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',

View File

@ -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 }
}
},
}

View File

@ -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'

View File

@ -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}`
}