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 apechain using mainnet gas prices #6220

Merged
merged 4 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
12 changes: 10 additions & 2 deletions src/components/coin-icon/ChainBadge.js
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know how many chain badges we need in the app but I guess I missed one

Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ import DegenBadge from '../../assets/badges/degenBadge.png';
import DegenBadgeDark from '../../assets/badges/degenBadgeDark.png';
import DegenBadgeLarge from '../../assets/badges/degenBadgeLarge.png';
import DegenBadgeLargeDark from '../../assets/badges/degenBadgeLargeDark.png';
import ApechainBadge from '../../assets/badges/apechainBadge.png';
import ApechainBadgeDark from '../../assets/badges/apechainBadgeDark.png';
import ApechainBadgeLarge from '../../assets/badges/apechainBadgeLarge.png';
import ApechainBadgeLargeDark from '../../assets/badges/apechainBadgeLargeDark.png';
import { Centered } from '../layout';
import styled from '@/styled-thing';
import { position as positions } from '@/styles';
Expand Down Expand Up @@ -76,7 +80,9 @@ export default function ChainBadge({
const source = useMemo(() => {
let val = null;
if (size === 'large') {
if (chainId === ChainId.arbitrum) {
if (chainId === ChainId.apechain) {
val = isDarkMode ? ApechainBadgeLargeDark : ApechainBadgeLarge;
} else if (chainId === ChainId.arbitrum) {
val = isDarkMode ? ArbitrumBadgeLargeDark : ArbitrumBadgeLarge;
} else if (chainId === ChainId.optimism) {
val = isDarkMode ? OptimismBadgeLargeDark : OptimismBadgeLarge;
Expand All @@ -96,7 +102,9 @@ export default function ChainBadge({
val = isDarkMode ? DegenBadgeLargeDark : DegenBadgeLarge;
}
} else {
if (chainId === ChainId.arbitrum) {
if (chainId === ChainId.apechain) {
val = isDarkMode ? ApechainBadgeDark : ApechainBadge;
} else if (chainId === ChainId.arbitrum) {
val = isDarkMode ? ArbitrumBadgeDark : ArbitrumBadge;
} else if (chainId === ChainId.optimism) {
val = isDarkMode ? OptimismBadgeDark : OptimismBadge;
Expand Down
10 changes: 7 additions & 3 deletions src/components/gas/GasSpeedButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,15 @@ const GasSpeedButton = ({
const estimatedTime = (selectedGasFee?.estimatedTime?.display || '').split(' ');
const [estimatedTimeValue = '0', estimatedTimeUnit = 'min'] = estimatedTime;
const time = parseFloat(estimatedTimeValue).toFixed(0);

const timeSymbol = estimatedTimeUnit === 'hr' ? '>' : '~';
if (!estimatedTime || (time === '0' && estimatedTimeUnit === 'min')) {
if (!estimatedTime) {
return '';
}

if (time === '0') {
return '< 1 sec';
}

const timeSymbol = estimatedTimeUnit === 'hr' ? '>' : '~';
Comment on lines +331 to +339
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was displaying ~ 0 sec so yeah

return `${timeSymbol}${time} ${estimatedTimeUnit}`;
}, [
crossChainServiceTime,
Expand Down
4 changes: 3 additions & 1 deletion src/redux/gas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ const getUpdatedGasFeeParams = (
case ChainId.degen:
nativeTokenPriceUnit = ethereumUtils.getDegenPriceUnit();
break;
case ChainId.apechain:
nativeTokenPriceUnit = ethereumUtils.getApechainPriceUnit();
break;
Comment on lines +140 to +142
Copy link
Contributor Author

Choose a reason for hiding this comment

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

!! This needs to be backend driven too

default:
nativeTokenPriceUnit = ethereumUtils.getEthPriceUnit();
break;
Expand Down Expand Up @@ -341,7 +344,6 @@ export const gasPricesStartPolling =
const meteorologySupportsChainId = meteorologySupportedChainIds.includes(chainId);
if (!meteorologySupportsChainId) {
const adjustedGasFees = await getProviderGasPrices({ chainId });

if (!adjustedGasFees) return;

const gasFeeParamsBySpeed = parseL2GasPrices(adjustedGasFees);
Expand Down
3 changes: 3 additions & 0 deletions src/utils/ethereumUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
BNB_MAINNET_ADDRESS,
AVAX_AVALANCHE_ADDRESS,
DEGEN_CHAIN_DEGEN_ADDRESS,
APECOIN_APECHAIN_ADDRESS,
} from '@/references';
import Routes from '@/navigation/routesNames';
import { logger, RainbowError } from '@/logger';
Expand Down Expand Up @@ -207,6 +208,7 @@ const getMaticPriceUnit = () => getAssetPrice(MATIC_MAINNET_ADDRESS);
const getBnbPriceUnit = () => getAssetPrice(BNB_MAINNET_ADDRESS);
const getAvaxPriceUnit = () => getAssetPrice(getUniqueId(AVAX_AVALANCHE_ADDRESS, ChainId.avalanche));
const getDegenPriceUnit = () => getAssetPrice(getUniqueId(DEGEN_CHAIN_DEGEN_ADDRESS, ChainId.degen));
const getApechainPriceUnit = () => getAssetPrice(getUniqueId(APECOIN_APECHAIN_ADDRESS, ChainId.apechain));

const getBalanceAmount = (
selectedGasFee: SelectedGasFee | LegacySelectedGasFee,
Expand Down Expand Up @@ -527,6 +529,7 @@ export default {
getBnbPriceUnit,
getAvaxPriceUnit,
getDegenPriceUnit,
getApechainPriceUnit,
getNativeAssetForNetwork,
getNetworkNativeAsset,
getPriceOfNativeAssetForNetwork,
Expand Down
Loading