Skip to content

Commit

Permalink
Merge pull request #596 from lidofinance/develop
Browse files Browse the repository at this point in the history
Develop to main
  • Loading branch information
jake4take authored Mar 3, 2025
2 parents 91fdbce + 3927c16 commit cf4d0c8
Show file tree
Hide file tree
Showing 33 changed files with 427 additions and 46 deletions.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ EL_RPC_URLS_10=
EL_RPC_URLS_11155420=
EL_RPC_URLS_1868=https://rpc.soneium.org
EL_RPC_URLS_1946=https://rpc.minato.soneium.org
EL_RPC_URLS_130=https://unichain-rpc.publicnode.com
EL_RPC_URLS_1301=https://unichain-sepolia-rpc.publicnode.com

# IPFS prefill RPC URLs - list of URLs delimited by commas
PREFILL_UNSAFE_EL_RPC_URLS_1=
Expand All @@ -22,6 +24,8 @@ PREFILL_UNSAFE_EL_RPC_URLS_10=
PREFILL_UNSAFE_EL_RPC_URLS_11155420=
PREFILL_UNSAFE_EL_RPC_URLS_1868=
PREFILL_UNSAFE_EL_RPC_URLS_1946=
PREFILL_UNSAFE_EL_RPC_URLS_130=
PREFILL_UNSAFE_EL_RPC_URLS_1301=

# supported networks for connecting wallet
SUPPORTED_CHAINS=1,17000,11155111,1115542
Expand Down
3 changes: 2 additions & 1 deletion IPFS.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"config": {
"enabledWithdrawalDexes": ["one-inch", "paraswap", "bebop"],
"multiChainBanner": [
324, 10, 42161, 137, 8453, 5000, 59144, 534352, 56, 34443, 48900, 1868
324, 10, 42161, 137, 8453, 5000, 59144, 534352, 56, 34443, 48900, 1868,
130
],
"featureFlags": {}
}
Expand Down
16 changes: 16 additions & 0 deletions assets/icons/chain-toggler/unichain.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions config/get-secret-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export type SecretConfigType = Modify<
rpcUrls_1868: [string, ...string[]];
rpcUrls_1946: [string, ...string[]];

rpcUrls_130: [string, ...string[]];
rpcUrls_1301: [string, ...string[]];

// Dynamic keys like rpcUrls_<number>
[key: `rpcUrls_${number}`]: string[];

Expand Down Expand Up @@ -67,6 +70,14 @@ export const getSecretConfig = (): SecretConfigType => {
string,
...string[],
],
rpcUrls_130: (serverRuntimeConfig.rpcUrls_130?.split(',') ?? []) as [
string,
...string[],
],
rpcUrls_1301: (serverRuntimeConfig.rpcUrls_1301?.split(',') ?? []) as [
string,
...string[],
],

cspReportOnly: toBoolean(serverRuntimeConfig.cspReportOnly),

Expand Down
2 changes: 2 additions & 0 deletions config/user-config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export type UserConfigDefaultType = {
[CHAINS.Optimism]: string[];
[CHAINS.Soneium]: string[];
[CHAINS.SoneiumMinato]: string[];
[CHAINS.Unichain]: string[];
[CHAINS.UnichainSepolia]: string[];
};
walletconnectProjectId: string | undefined;
};
2 changes: 2 additions & 0 deletions config/user-config/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export const getUserConfigDefault = (): UserConfigDefaultType => {
[CHAINS.OptimismSepolia]: config.prefillUnsafeElRpcUrls11155420,
[CHAINS.Soneium]: config.prefillUnsafeElRpcUrls1868,
[CHAINS.SoneiumMinato]: config.prefillUnsafeElRpcUrls1946,
[CHAINS.Unichain]: config.prefillUnsafeElRpcUrls130,
[CHAINS.UnichainSepolia]: config.prefillUnsafeElRpcUrls1301,
},
walletconnectProjectId: config.walletconnectProjectId,
};
Expand Down
13 changes: 11 additions & 2 deletions consts/chains.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { LIDO_L2_CONTRACT_ADDRESSES } from '@lidofinance/lido-ethereum-sdk/common';
import {
LIDO_L2_CONTRACT_ADDRESSES,
SUPPORTED_CHAINS as SDK_SUPPORTED_CHAINS,
} from '@lidofinance/lido-ethereum-sdk/common';

export enum CHAINS {
Mainnet = 1,
Expand All @@ -8,6 +11,8 @@ export enum CHAINS {
OptimismSepolia = 11155420,
Soneium = 1868,
SoneiumMinato = 1946,
Unichain = 130,
UnichainSepolia = 1301,
}

export enum LIDO_MULTICHAIN_CHAINS {
Expand All @@ -29,5 +34,9 @@ export enum LIDO_MULTICHAIN_CHAINS {

// TODO: move to @lidofinance/lido-ethereum-sdk package
export const isSDKSupportedL2Chain = (chainId?: CHAINS) => {
return chainId && !!LIDO_L2_CONTRACT_ADDRESSES[chainId];
return Boolean(chainId && LIDO_L2_CONTRACT_ADDRESSES[chainId]);
};

export const isSDKSupportedChain = (chainId?: CHAINS) => {
return Boolean(chainId && SDK_SUPPORTED_CHAINS.includes(chainId));
};
48 changes: 48 additions & 0 deletions consts/matomo-click-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ export const enum MATOMO_CLICK_EVENTS_TYPES {
faqWhatHappensIfIWantToUnstakeETHOnEthereumCanIDoThatFromSoneiumBridgeYourWstETHOrStETHBack = 'faqWhatHappensIfIWantToUnstakeETHOnEthereumCanIDoThatFromSoneiumBridgeYourWstETHOrStETHBack',
faqWhatHappensIfIWantToUnstakeETHOnEthereumCanIDoThatFromSoneiumWithdrawalsRequestAndClaim = 'faqWhatHappensIfIWantToUnstakeETHOnEthereumCanIDoThatFromSoneiumWithdrawalsRequestAndClaim',

// Unichain
faqHowCanIGetWstethOnUnichainWrapLink = 'faqHowCanIGetWstethOnUnichainWrapLink',
faqHowCanIGetWstethOnUnichainBridgeYourWstETHFromEthereumToUnichain = 'faqHowCanIGetWstethOnUnichainBridgeYourWstETHFromEthereumToUnichain',
faqHowCanIGetWstethOnUnichainIntegrations = 'faqHowCanIGetWstethOnUnichainIntegrations',
faqHowCanIUseWstethOnUnichainDefiProtocols = 'faqHowCanIUseWstethOnUnichainDefiProtocols',
faqHowCouldIUnwrapWstETHBackToStETHOnUnichainUnwrapLink = 'faqHowCouldIUnwrapWstETHBackToStETHOnUnichainUnwrapLink',
faqWhatHappensIfIWantToUnstakeETHOnEthereumCanIDoThatFromUnichainBridgeYourWstETHOrStETHBack = 'faqWhatHappensIfIWantToUnstakeETHOnEthereumCanIDoThatFromUnichainBridgeYourWstETHOrStETHBack',
faqWhatHappensIfIWantToUnstakeETHOnEthereumCanIDoThatFromUnichainWithdrawalsRequestAndClaim = 'faqWhatHappensIfIWantToUnstakeETHOnEthereumCanIDoThatFromUnichainWithdrawalsRequestAndClaim',

// /wrap page
wrapTokenSelectSTETH = 'wrapTokenSelectSteth',
wrapTokenSelectETH = 'wrapTokenSelectEth',
Expand Down Expand Up @@ -266,6 +275,11 @@ export const MATOMO_CLICK_EVENTS: Record<
'Push «Wrap & Unwrap staking widget» in FAQ How can I get wstETH (Soneium)',
'eth_widget_faq_howgetwsteth_wrap_soneium',
],
[MATOMO_CLICK_EVENTS_TYPES.faqHowCanIGetWstethOnUnichainWrapLink]: [
'Ethereum_Staking_Widget',
'Push «Wrap & Unwrap staking widget» in FAQ How can I get wstETH (Unichain)',
'eth_widget_faq_howgetwsteth_wrap_unichain',
],
[MATOMO_CLICK_EVENTS_TYPES.faqHowCanIGetWstethOnOptimismBridgeYourWstETHFromEthereumToOptimism]:
[
'Ethereum_Staking_Widget',
Expand All @@ -278,6 +292,12 @@ export const MATOMO_CLICK_EVENTS: Record<
'Push «bridge your wstETH from Ethereum to Soneium» in How can I get wstETH on Soneium?',
'eth_widget_faq_howCanIGetWstethOnSoneium_bridgeYourWstETHFromEthereumToSoneium',
],
[MATOMO_CLICK_EVENTS_TYPES.faqHowCanIGetWstethOnUnichainBridgeYourWstETHFromEthereumToUnichain]:
[
'Ethereum_Staking_Widget',
'Push «bridge your wstETH from Ethereum to Unichain in How can I get wstETH on Unichain?',
'eth_widget_faq_howCanIGetWstethOnUnichain_bridgeYourWstETHFromEthereumToUnichain',
],
[MATOMO_CLICK_EVENTS_TYPES.faqHowCanIGetWstethOnOptimismIntegrations]: [
'Ethereum_Staking_Widget',
'Push «DEX Lido integrations» in FAQ How can I get wstETH (Optimism)',
Expand All @@ -288,6 +308,11 @@ export const MATOMO_CLICK_EVENTS: Record<
'Push «DEX Lido integrations» in FAQ How can I get wstETH (Soneium)',
'eth_widget_faq_howgetwsteth_dexLidoIntegrations_soneium',
],
[MATOMO_CLICK_EVENTS_TYPES.faqHowCanIGetWstethOnUnichainIntegrations]: [
'Ethereum_Staking_Widget',
'Push «DEX Lido integrations» in FAQ How can I get wstETH (Unichain)',
'eth_widget_faq_howgetwsteth_dexLidoIntegrations_unichain',
],
[MATOMO_CLICK_EVENTS_TYPES.faqHowDoIUnwrapWstethUnwrapLink]: [
'Ethereum_Staking_Widget',
'Push «stake.lido.fi/wrap/unwrap» How do I unwrap wstETH back to stETH?',
Expand All @@ -308,6 +333,11 @@ export const MATOMO_CLICK_EVENTS: Record<
'Push «L2» How can I use wstETH? (Soneium)',
'eth_widget_faq_howCanIUseWstETH_l2_soneium',
],
[MATOMO_CLICK_EVENTS_TYPES.faqHowCanIUseWstethOnUnichainDefiProtocols]: [
'Ethereum_Staking_Widget',
'Push «L2» How can I use wstETH? (Unichain)',
'eth_widget_faq_howCanIUseWstETH_l2_unichain',
],
[MATOMO_CLICK_EVENTS_TYPES.faqHowCanIUseWstethDefiProtocols]: [
'Ethereum_Staking_Widget',
'Push «DeFi protocols» How can I use wstETH?',
Expand All @@ -330,6 +360,12 @@ export const MATOMO_CLICK_EVENTS: Record<
'Push «Wrap & Unwrap staking widget» How could I unwrap wstETH back to stETH on Soneium?',
'eth_widget_faq_howCouldIUnwrapWstETHBackToStETHOnSoneiumUnwrapLink',
],
[MATOMO_CLICK_EVENTS_TYPES.faqHowCouldIUnwrapWstETHBackToStETHOnUnichainUnwrapLink]:
[
'Ethereum_Staking_Widget',
'Push «Wrap & Unwrap staking widget» How could I unwrap wstETH back to stETH on Unichain?',
'eth_widget_faq_howCouldIUnwrapWstETHBackToStETHOnUnichainUnwrapLink',
],
[MATOMO_CLICK_EVENTS_TYPES.faqWhatHappensIfIWantToUnstakeETHOnEthereumCanIDoThatFromOptimismBridgeYourWstETHOrStETHBack]:
[
'Ethereum_Staking_Widget',
Expand All @@ -342,6 +378,12 @@ export const MATOMO_CLICK_EVENTS: Record<
'Push «bridge your wstETH or stETH back» What happens if I want to unstake ETH on Ethereum? Can I do that from Soneium?',
'eth_widget_faq_WhatHappensIfIWantToUnstakeETHOnEthereumCanIDoThatFromSoneiumBridgeYourWstETHOrStETHBack',
],
[MATOMO_CLICK_EVENTS_TYPES.faqWhatHappensIfIWantToUnstakeETHOnEthereumCanIDoThatFromUnichainBridgeYourWstETHOrStETHBack]:
[
'Ethereum_Staking_Widget',
'Push «bridge your wstETH or stETH back» What happens if I want to unstake ETH on Ethereum? Can I do that from Unichain?',
'eth_widget_faq_WhatHappensIfIWantToUnstakeETHOnEthereumCanIDoThatFromUnichainBridgeYourWstETHOrStETHBack',
],
[MATOMO_CLICK_EVENTS_TYPES.faqWhatHappensIfIWantToUnstakeETHOnEthereumCanIDoThatFromOptimismWithdrawalsRequestAndClaim]:
[
'Ethereum_Staking_Widget',
Expand All @@ -354,6 +396,12 @@ export const MATOMO_CLICK_EVENTS: Record<
'Push «Withdrawals Request and Claim» What happens if I want to unstake ETH on Ethereum? Can I do that from Soneium?',
'eth_widget_faq_WhatHappensIfIWantToUnstakeETHOnEthereumCanIDoThatFromSoneiumWithdrawalsRequestAndClaim',
],
[MATOMO_CLICK_EVENTS_TYPES.faqWhatHappensIfIWantToUnstakeETHOnEthereumCanIDoThatFromUnichainWithdrawalsRequestAndClaim]:
[
'Ethereum_Staking_Widget',
'Push «Withdrawals Request and Claim» What happens if I want to unstake ETH on Ethereum? Can I do that from Unichain?',
'eth_widget_faq_WhatHappensIfIWantToUnstakeETHOnEthereumCanIDoThatFromUnichainWithdrawalsRequestAndClaim',
],
// /wrap page
[MATOMO_CLICK_EVENTS_TYPES.wrapTokenSelectETH]: [
'Ethereum_Staking_Widget',
Expand Down
4 changes: 4 additions & 0 deletions env-dynamics.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ export const prefillUnsafeElRpcUrls11155420 = process.env.PREFILL_UNSAFE_EL_RPC_
export const prefillUnsafeElRpcUrls1868 = process.env.PREFILL_UNSAFE_EL_RPC_URLS_1868?.split(',') ?? [];
/** @type string[] */
export const prefillUnsafeElRpcUrls1946 = process.env.PREFILL_UNSAFE_EL_RPC_URLS_1946?.split(',') ?? [];
/** @type string[] */
export const prefillUnsafeElRpcUrls130 = process.env.PREFILL_UNSAFE_EL_RPC_URLS_130?.split(',') ?? [];
/** @type string[] */
export const prefillUnsafeElRpcUrls1301 = process.env.PREFILL_UNSAFE_EL_RPC_URLS_1301?.split(',') ?? [];

/** @type boolean */
export const enableQaHelpers = toBoolean(process.env.ENABLE_QA_HELPERS);
Expand Down
26 changes: 16 additions & 10 deletions features/wsteth/shared/wallet/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
import { Card } from 'shared/wallet';
import styled from 'styled-components';
import { DAPP_CHAIN_TYPE } from 'modules/web3';

interface StyledCardProps {
$optimism?: boolean;
$soneium?: boolean;
$chainType?: DAPP_CHAIN_TYPE;
}

const backgrounds: Partial<Record<DAPP_CHAIN_TYPE, string>> & {
default: string;
} = {
[DAPP_CHAIN_TYPE.Optimism]:
'linear-gradient(52.01deg, #37394A 0%, #1D1E35 0.01%, #B73544 100%)',
[DAPP_CHAIN_TYPE.Soneium]:
'linear-gradient(52.01deg, #9d1451 0.01%, #630876 100%)',
[DAPP_CHAIN_TYPE.Unichain]:
'linear-gradient(52.01deg, #fc0fa4 0.01%, #8e1459 100%)',
default: 'linear-gradient(52.01deg, #1b3349 0%, #25697e 100%)',
};

export const StyledCard = styled(Card)<StyledCardProps>`
background: ${({ $optimism, $soneium }) => {
if ($optimism) {
return 'linear-gradient(52.01deg, #37394A 0%, #1D1E35 0.01%, #B73544 100%)';
}
if ($soneium) {
return 'linear-gradient(52.01deg, #9d1451 0.01%, #630876 100%);';
}
return 'linear-gradient(52.01deg, #1b3349 0%, #25697e 100%)';
background: ${({ $chainType }) => {
return backgrounds[$chainType ?? 'default'] ?? backgrounds['default'];
}};
`;
23 changes: 10 additions & 13 deletions features/wsteth/shared/wallet/wallet.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useConnectorInfo } from 'reef-knot/core-react';
import { Divider, Text } from '@lidofinance/lido-ui';
import styled from 'styled-components';

import { FormatToken } from 'shared/formatters';
import { TokenToWallet } from 'shared/components';
Expand All @@ -9,7 +10,6 @@ import {
useStethBalance,
useWstethBalance,
useWstethBySteth,
DAPP_CHAIN_TYPE,
useStETHByWstETH,
} from 'modules/web3';
import { CardBalance, CardRow, CardAccount, Fallback } from 'shared/wallet';
Expand All @@ -18,6 +18,10 @@ import { StyledCard } from './styles';
import { useIsLedgerLive } from 'shared/hooks/useIsLedgerLive';
import { useConfig } from 'config';

const SecondaryBalanceText = styled(Text).attrs({ size: 'xxs' })`
color: var(--lido-color-accentContrastSecondary);
`;

const WalletComponent = () => {
const { chainType } = useDappStatus();
const ethBalance = useEthereumBalance();
Expand All @@ -27,15 +31,8 @@ const WalletComponent = () => {
const wstethBySteth = useWstethBySteth(stethBalance?.data);
const stethByWsteth = useStETHByWstETH(wstethBalance?.data);

const isOptimism = chainType === DAPP_CHAIN_TYPE.Optimism;
const isSoneium = chainType === DAPP_CHAIN_TYPE.Soneium;

return (
<StyledCard
data-testid="wrapCardSection"
$optimism={isOptimism}
$soneium={isSoneium}
>
<StyledCard data-testid="wrapCardSection" $chainType={chainType}>
<CardRow>
<CardBalance
title="ETH balance"
Expand Down Expand Up @@ -67,14 +64,14 @@ const WalletComponent = () => {
data-testid="addStethToWalletBtn"
address={stethBalance.tokenAddress}
/>
<Text size={'xxs'} color={'secondary'}>
<SecondaryBalanceText>
<FormatToken
data-testid="wstEthBalanceOption"
amount={wstethBySteth.data}
symbol="wstETH"
approx={true}
/>
</Text>
</SecondaryBalanceText>
</>
}
/>
Expand All @@ -93,14 +90,14 @@ const WalletComponent = () => {
data-testid="addWstethToWalletBtn"
address={wstethBalance.tokenAddress}
/>
<Text size={'xxs'} color={'secondary'}>
<SecondaryBalanceText>
<FormatToken
data-testid="stethBalanceOption"
amount={stethByWsteth.data}
symbol="stETH"
approx={true}
/>
</Text>
</SecondaryBalanceText>
</>
}
/>
Expand Down
23 changes: 23 additions & 0 deletions features/wsteth/shared/wrap-faq/unichain-faq/faq.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import {
WhatIsWstethOnUnichain,
HowCanIGetWstethOnUnichain,
HowCanIUseWstethOnUnichain,
CanIStakeMyETHDirectlyOnUnichain,
DoIStillGetStakingRewardsWithStETHOrWstETHOnUnichain,
DoINeedToClaimMyStakingRewardsIfIWrapStETHToWstETHOnUnichain,
HowCouldIUnwrapWstETHBackToStETHOnUnichain,
WhatHappensIfIWantToUnstakeETHOnEthereumCanIDoThatFromUnichain,
} from './list';

export const UnichainFAQ = () => (
<>
<WhatIsWstethOnUnichain />
<HowCanIGetWstethOnUnichain />
<HowCanIUseWstethOnUnichain />
<CanIStakeMyETHDirectlyOnUnichain />
<DoIStillGetStakingRewardsWithStETHOrWstETHOnUnichain />
<DoINeedToClaimMyStakingRewardsIfIWrapStETHToWstETHOnUnichain />
<HowCouldIUnwrapWstETHBackToStETHOnUnichain />
<WhatHappensIfIWantToUnstakeETHOnEthereumCanIDoThatFromUnichain />
</>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { FC } from 'react';
import { Accordion } from '@lidofinance/lido-ui';

export const CanIStakeMyETHDirectlyOnUnichain: FC = () => {
return (
<Accordion summary="Can I stake my ETH directly on Unichain?">
<p>
No, staking in the Lido Protocol is available only on the Ethereum
mainnet.
</p>
</Accordion>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { FC } from 'react';
import { Accordion } from '@lidofinance/lido-ui';

export const DoINeedToClaimMyStakingRewardsIfIWrapStETHToWstETHOnUnichain: FC =
() => {
return (
<Accordion summary="Do I need to claim my staking rewards if I wrap stETH to wstETH on Unichain?">
<p>No, staking rewards accrue to wstETH automatically.</p>
</Accordion>
);
};
Loading

0 comments on commit cf4d0c8

Please sign in to comment.