Skip to content

Commit

Permalink
Merge pull request #415 from lidofinance/develop
Browse files Browse the repository at this point in the history
Merge develop to main
  • Loading branch information
jake4take authored Jul 29, 2024
2 parents 4f54408 + 8b2d531 commit 8f99c9d
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 118 deletions.
5 changes: 0 additions & 5 deletions assets/icons/jumper.svg

This file was deleted.

6 changes: 0 additions & 6 deletions consts/matomo-click-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export const enum MATOMO_CLICK_EVENTS_TYPES {
withdrawalGoToCowSwap = 'withdrawalGoToCowSwap',
withdrawalGoToParaswap = 'withdrawalGoToParaswap',
withdrawalGoToOpenOcean = 'withdrawalGoToOpenOcean',
withdrawalGoToJumper = 'withdrawalGoToJumper',
withdrawalEtherscanSuccessTemplate = 'withdrawalEtherscanSuccessTemplate',
withdrawalGuideSuccessTemplate = 'withdrawalGuideSuccessTemplate',

Expand Down Expand Up @@ -325,11 +324,6 @@ export const MATOMO_CLICK_EVENTS: Record<
'Click on «Go to OpenOcean in aggregators list on Request tab',
'eth_withdrawals_request_go_to_OpenOcean',
],
[MATOMO_CLICK_EVENTS_TYPES.withdrawalGoToJumper]: [
'Ethereum_Withdrawals_Widget',
'Click on «Go to Jumper in aggregators list on Request tab',
'eth_withdrawals_request_go_to_Jumper',
],
[MATOMO_CLICK_EVENTS_TYPES.withdrawalEtherscanSuccessTemplate]: [
'Ethereum_Withdrawals_Widget',
'Click on "Etherscan" on success template after withdrawal request',
Expand Down
2 changes: 1 addition & 1 deletion features/stake/stake-form/wallet/wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export const Wallet: WalletComponentType = memo((props) => {
);

if (isL2Chain && showL2Chain) {
return <L2Fallback {...props} />;
return <L2Fallback textEnding={'to stake'} {...props} />;
}

if (!isDappActive) {
Expand Down
2 changes: 1 addition & 1 deletion features/withdrawals/claim/wallet/wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const ClaimWallet: WalletComponentType = memo((props) => {
);

if (isL2Chain && showL2Chain) {
return <L2Fallback {...props} />;
return <L2Fallback textEnding={'to claim withdrawals'} {...props} />;
}

if (!isDappActive) {
Expand Down
2 changes: 1 addition & 1 deletion features/withdrawals/request/wallet/wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const RequestWallet: WalletComponentType = memo((props) => {
);

if (isL2Chain && showL2Chain) {
return <L2Fallback {...props} />;
return <L2Fallback textEnding={'to request withdrawals'} {...props} />;
}

if (!isDappActive) {
Expand Down
8 changes: 0 additions & 8 deletions features/withdrawals/request/withdrawal-rates/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import OpenOcean from 'assets/icons/open-ocean.svg';
import Paraswap from 'assets/icons/paraswap-circle.svg';
import Oneinch from 'assets/icons/oneinch-circle.svg';
import Bebop from 'assets/icons/bebop.svg';
import Jumper from 'assets/icons/jumper.svg';

export const OpenOceanIcon = styled.img.attrs({
src: OpenOcean,
Expand Down Expand Up @@ -32,10 +31,3 @@ export const BebopIcon = styled.img.attrs({
})`
display: block;
`;

export const JumperIcon = styled.img.attrs({
src: Jumper,
alt: 'Jumper',
})`
display: block;
`;
36 changes: 1 addition & 35 deletions features/withdrawals/request/withdrawal-rates/integrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,14 @@ import { getBebopRate } from 'utils/get-bebop-rate';
import { getOpenOceanRate } from 'utils/get-open-ocean-rate';
import { standardFetcher } from 'utils/standardFetcher';

import {
BebopIcon,
OneInchIcon,
OpenOceanIcon,
ParaSwapIcon,
JumperIcon,
} from './icons';
import { BebopIcon, OneInchIcon, OpenOceanIcon, ParaSwapIcon } from './icons';

import type {
DexWithdrawalApi,
DexWithdrawalIntegrationMap,
GetRateType,
RateCalculationResult,
} from './types';
import { getJumperRate } from 'utils/get-jumper-rate';

const RATE_PRECISION = 100000;
const RATE_PRECISION_BN = BigNumber.from(RATE_PRECISION);
Expand Down Expand Up @@ -151,23 +144,6 @@ const getBebopWithdrawalRate: GetRateType = async ({ amount, token }) => {
};
};

const getJumperWithdrawalRate: GetRateType = async ({ amount, token }) => {
try {
if (amount.gt(Zero)) {
return await getJumperRate(amount, token, 'ETH');
}
} catch (e) {
console.warn(
'[getOneInchWithdrawalRate] Failed to receive withdraw rate',
e,
);
}
return {
rate: null,
toReceive: null,
};
};

const dexWithdrawalMap: DexWithdrawalIntegrationMap = {
'open-ocean': {
title: 'OpenOcean',
Expand Down Expand Up @@ -212,16 +188,6 @@ const dexWithdrawalMap: DexWithdrawalIntegrationMap = {
getTokenAddress(CHAINS.Mainnet, token),
)}&sellAmounts=${formatEther(amount)}&source=lido`,
},
jumper: {
title: 'Jumper',
icon: JumperIcon,
fetcher: getJumperWithdrawalRate,
matomoEvent: MATOMO_CLICK_EVENTS_TYPES.withdrawalGoToJumper,
link: (amount, token) =>
`https://jumper.exchange/?fromAmount=${formatEther(amount)}&fromChain=1&fromToken=${getAddress(
getTokenAddress(CHAINS.Mainnet, token),
)}&source=lido&toChain=1&toToken=0x0000000000000000000000000000000000000000`,
},
} as const;

export const getDexConfig = (dexKey: DexWithdrawalApi) =>
Expand Down
7 changes: 1 addition & 6 deletions features/withdrawals/request/withdrawal-rates/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@ export type SingleWithdrawalRateResult = {
toReceive: BigNumber | null;
};

export type DexWithdrawalApi =
| 'paraswap'
| 'open-ocean'
| 'one-inch'
| 'bebop'
| 'jumper';
export type DexWithdrawalApi = 'paraswap' | 'open-ocean' | 'one-inch' | 'bebop';

export type DexWithdrawalIntegration = {
title: string;
Expand Down
2 changes: 1 addition & 1 deletion features/wsteth/shared/wallet/wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const Wallet: WalletComponentType = memo((props) => {
);

if (isL2Chain && showL2Chain) {
return <L2Fallback {...props} />;
return <L2Fallback textEnding={'to wrap/unwrap'} {...props} />;
}

if (!isDappActive) {
Expand Down
11 changes: 6 additions & 5 deletions shared/wallet/l2-fallback/l2-fallback.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useMemo } from 'react';
import { FC, useMemo } from 'react';
import { useAccount } from 'wagmi';
import { Link } from '@lidofinance/lido-ui';
import { BlockProps, Link } from '@lidofinance/lido-ui';

import { ReactComponent as ArbitrumLogo } from 'assets/icons/l2/arbitrum.svg';
import { ReactComponent as BaseLogo } from 'assets/icons/l2/base.svg';
Expand All @@ -15,10 +15,11 @@ import { config } from 'config';
import { useUserConfig } from 'config/user-config';
import { CHAINS, L2_CHAINS } from 'consts/chains';
import { MATOMO_CLICK_EVENTS_TYPES } from 'consts/matomo-click-events';
import { WalletCardComponent } from 'shared/wallet/card/types';

import { L2FallbackWalletStyle, TextStyle, ButtonStyle } from './styles';

export type L2FallbackComponent = FC<{ textEnding: string } & BlockProps>;

const l2Logos = {
[L2_CHAINS.Arbitrum]: ArbitrumLogo,
[L2_CHAINS.Base]: BaseLogo,
Expand All @@ -35,7 +36,7 @@ const getL2Logo = (chainId: L2_CHAINS) => {
return SVGLogo ? <SVGLogo style={{ marginBottom: '13px' }} /> : null;
};

export const L2Fallback: WalletCardComponent = (props) => {
export const L2Fallback: L2FallbackComponent = (props) => {
const { chainId } = useAccount();
const { defaultChain } = useUserConfig();

Expand All @@ -53,7 +54,7 @@ export const L2Fallback: WalletCardComponent = (props) => {
{getL2Logo(chainId as L2_CHAINS)}
<TextStyle>
Learn about Lido on L2 opportunities on {l2ChainName} network or switch
to Ethereum {defaultChainName} to stake
to Ethereum {defaultChainName} {props.textEnding}
</TextStyle>
<Link
href={`${config.rootOrigin}/lido-on-l2`}
Expand Down
49 changes: 0 additions & 49 deletions utils/get-jumper-rate.ts

This file was deleted.

0 comments on commit 8f99c9d

Please sign in to comment.