Skip to content

Commit

Permalink
Merge pull request #451 from lidofinance/develop
Browse files Browse the repository at this point in the history
Develop to main
  • Loading branch information
itaven authored Aug 29, 2024
2 parents 614762a + 4896a51 commit c5cadb4
Show file tree
Hide file tree
Showing 15 changed files with 639 additions and 391 deletions.
12 changes: 0 additions & 12 deletions consts/matomo-click-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ export const enum MATOMO_CLICK_EVENTS_TYPES {
viewEtherscanOnStakePage = 'viewEtherscanOnStakePage',
lidoOnLidoMultichainOpportunities = 'lidoOnLidoMultichainOpportunities',
vaultsBannerLearnMore = 'vaultsBannerLearnMore',
vaultsBannerExploreAll = 'vaultsBannerExploreAll',
obolBannerProceed = 'obolBannerProceed',
obolBannerDVVLink = 'obolBannerDVVLink',
exploreAllStrategiesAfterStake = 'exploreAllStrategiesAfterStake',
exploreAllStrategiesAfterWrap = 'exploreAllStrategiesAfterWrap',
// FAQ
faqSafeWorkWithLidoAudits = 'faqSafeWorkWithLidoAudits',
faqLidoEthAprEthLandingPage = 'faqLidoEthAprEthLandingPage',
Expand Down Expand Up @@ -128,11 +126,6 @@ export const MATOMO_CLICK_EVENTS: Record<
'Click on "Learn more" on Vaults banner',
'eth_widget_learn_more_vaults_banner',
],
[MATOMO_CLICK_EVENTS_TYPES.vaultsBannerExploreAll]: [
'Ethereum_Staking_Widget',
'Push "Explore all strategies"',
'eth_widget_explore_all_strategies',
],
[MATOMO_CLICK_EVENTS_TYPES.obolBannerProceed]: [
'Ethereum_Staking_Widget',
'Push "Proceed" Obol SSV',
Expand All @@ -148,11 +141,6 @@ export const MATOMO_CLICK_EVENTS: Record<
'Push "Explore all strategies" after staking',
'eth_widget_explore_all_strategies_after_staking',
],
[MATOMO_CLICK_EVENTS_TYPES.exploreAllStrategiesAfterWrap]: [
'Ethereum_Staking_Widget',
'Push "Explore all strategies" after wrap',
'eth_widget_explore_all_strategies_after_wraping',
],
// FAQ
[MATOMO_CLICK_EVENTS_TYPES.faqSafeWorkWithLidoAudits]: [
'Ethereum_Staking_Widget',
Expand Down
14 changes: 14 additions & 0 deletions consts/matomo-wallets-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export const enum MATOMO_WALLETS_EVENTS_TYPES {
onConnectBitget = 'onConnectBitget',
onClickBrowser = 'onClickBrowser',
onConnectBrowser = 'onConnectBrowser',
onClickBinance = 'onClickBinance',
onConnectBinance = 'onConnectBinance',
}

export const MATOMO_WALLETS_EVENTS: Record<
Expand Down Expand Up @@ -177,6 +179,16 @@ export const MATOMO_WALLETS_EVENTS: Record<
'Connect Browser wallet',
'eth_widget_connect_browser',
],
[MATOMO_WALLETS_EVENTS_TYPES.onClickBinance]: [
'Ethereum_Staking_Widget',
'Click Binance Web3 wallet',
'eth_widget_click_binance_web3',
],
[MATOMO_WALLETS_EVENTS_TYPES.onConnectBinance]: [
'Ethereum_Staking_Widget',
'Connect Binance Web3 wallet',
'eth_widget_connect_binance_web3_wallet',
],
};

const getMetricHandler = (event: Parameters<typeof trackEvent>) => () =>
Expand All @@ -202,6 +214,7 @@ export const walletsMetrics: Metrics<WalletIdsEthereum> = {
browserExtension: getMetricHandler(
MATOMO_WALLETS_EVENTS.onClickBrowser,
),
binanceWallet: getMetricHandler(MATOMO_WALLETS_EVENTS.onClickBinance),
},
},
connect: {
Expand All @@ -222,6 +235,7 @@ export const walletsMetrics: Metrics<WalletIdsEthereum> = {
browserExtension: getMetricHandler(
MATOMO_WALLETS_EVENTS.onConnectBrowser,
),
binanceWallet: getMetricHandler(MATOMO_WALLETS_EVENTS.onConnectBinance),
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ const useStakeFormNetworkData = (): StakeFormNetworkData => {

const revalidate = useCallback(async () => {
await Promise.allSettled([
updateStethBalance,
updateEtherBalance,
() => mutateStakeLimit(stakingLimitInfo),
updateStethBalance(),
updateEtherBalance(),
mutateStakeLimit(stakingLimitInfo),
]);
}, [
updateStethBalance,
Expand Down
2 changes: 0 additions & 2 deletions features/wsteth/unwrap/hooks/use-tx-modal-stages-unwrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
} from 'shared/transaction-modal/hooks/use-transaction-modal-stage';
import { getGeneralTransactionModalStages } from 'shared/transaction-modal/hooks/get-general-transaction-modal-stages';

import { VaultsBannerStrategies } from 'shared/banners/vaults-banner-strategies';
import { TxStageSignOperationAmount } from 'shared/transaction-modal/tx-stages-composed/tx-stage-amount-operation';
import { TxStageOperationSucceedBalanceShown } from 'shared/transaction-modal/tx-stages-composed/tx-stage-operation-succeed-balance-shown';

Expand Down Expand Up @@ -48,7 +47,6 @@ const getTxModalStagesUnwrap = (
balance={balance}
balanceToken={STAGE_OPERATION_ARGS.willReceiveToken}
operationText={'Unwrapping'}
footer={<VaultsBannerStrategies />}
/>,
{
isClosableOnLedger: true,
Expand Down
11 changes: 2 additions & 9 deletions features/wsteth/unwrap/hooks/use-unwrap-form-processing.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import invariant from 'tiny-invariant';

import { useCallback } from 'react';
import {
useSDK,
useSTETHContractRPC,
useWSTETHContractRPC,
} from '@lido-sdk/react';
import { useSTETHContractRPC, useWSTETHContractRPC } from '@lido-sdk/react';
import { useWeb3 } from 'reef-knot/web3-react';
import { useUnwrapTxProcessing } from './use-unwrap-tx-processing';
import { useTxModalStagesUnwrap } from './use-tx-modal-stages-unwrap';
Expand All @@ -26,7 +22,6 @@ export const useUnwrapFormProcessor = ({
}: UseUnwrapFormProcessorArgs) => {
const { account } = useWeb3();
const { staticRpcProvider } = useCurrentStaticRpcProvider();
const { providerWeb3 } = useSDK();
const processWrapTx = useUnwrapTxProcessing();
const stETHContractRPC = useSTETHContractRPC();
const wstETHContractRPC = useWSTETHContractRPC();
Expand All @@ -37,8 +32,7 @@ export const useUnwrapFormProcessor = ({
try {
invariant(amount, 'amount should be presented');
invariant(account, 'address should be presented');
invariant(providerWeb3, 'provider should be presented');
const isMultisig = await isContract(account, providerWeb3);
const isMultisig = await isContract(account, staticRpcProvider);
const willReceive = await wstETHContractRPC.getStETHByWstETH(amount);

txModalStages.sign(amount, willReceive);
Expand Down Expand Up @@ -71,7 +65,6 @@ export const useUnwrapFormProcessor = ({
},
[
account,
providerWeb3,
wstETHContractRPC,
txModalStages,
stETHContractRPC,
Expand Down
2 changes: 0 additions & 2 deletions features/wsteth/unwrap/unwrap-form/unwrap-form.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { FC, memo } from 'react';

import { InputWrap, WrapBlock } from 'features/wsteth/shared/styles';
import { VaultsBannerInfo } from 'shared/banners/vaults-banner-info';
import { FormController } from 'shared/hook-form/form-controller/form-controller';

import { UnwrapStats } from './unwrap-stats';
Expand All @@ -19,7 +18,6 @@ export const UnwrapForm: FC = memo(() => {
</InputWrap>
<SubmitButtonUnwrap />
</FormController>
<VaultsBannerInfo />
<UnwrapStats />
</WrapBlock>
</UnwrapFormProvider>
Expand Down
23 changes: 0 additions & 23 deletions features/wsteth/wrap/hooks/use-tx-modal-stages-wrap.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { Button, Link } from '@lidofinance/lido-ui';
import { trackEvent } from '@lidofinance/analytics-matomo';

import {
TransactionModalTransitStage,
useTransactionModalStage,
Expand All @@ -9,14 +6,10 @@ import { getGeneralTransactionModalStages } from 'shared/transaction-modal/hooks

import { TxStageSignOperationAmount } from 'shared/transaction-modal/tx-stages-composed/tx-stage-amount-operation';
import { TxStageOperationSucceedBalanceShown } from 'shared/transaction-modal/tx-stages-composed/tx-stage-operation-succeed-balance-shown';
import { LINK_EXPLORE_STRATEGIES } from 'shared/banners/vaults-banner-info/const';

import { getTokenDisplayName } from 'utils/getTokenDisplayName';
import type { BigNumber } from 'ethers';
import type { TokensWrappable } from 'features/wsteth/shared/types';
import { VaultsBannerInfo } from 'shared/banners/vaults-banner-info';

import { MATOMO_CLICK_EVENTS } from 'consts/matomo-click-events';

const STAGE_APPROVE_ARGS = {
willReceiveToken: 'wstETH',
Expand Down Expand Up @@ -89,22 +82,6 @@ const getTxModalStagesWrap = (transitStage: TransactionModalTransitStage) => ({
balance={balance}
balanceToken={'wstETH'}
operationText={'Wrapping'}
footer={
<>
<VaultsBannerInfo isTitleCompact showLearnMoreButton={false} />
<br />
<Link
href={LINK_EXPLORE_STRATEGIES}
onClick={() =>
trackEvent(...MATOMO_CLICK_EVENTS.exploreAllStrategiesAfterWrap)
}
>
<Button fullwidth size="sm">
Explore strategies
</Button>
</Link>
</>
}
/>,
{
isClosableOnLedger: true,
Expand Down
2 changes: 0 additions & 2 deletions features/wsteth/wrap/wrap-form/wrap-form.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { memo } from 'react';

import { VaultsBannerInfo } from 'shared/banners/vaults-banner-info';
import { FormController } from 'shared/hook-form/form-controller';

import { WrapFormStats } from './wrap-stats';
Expand All @@ -17,7 +16,6 @@ export const WrapForm: React.FC = memo(() => {
<InputGroupWrap />
<SubmitButtonWrap />
</FormController>
<VaultsBannerInfo />
<WrapFormStats />
</WrapBlock>
</WrapFormProvider>
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"@lidofinance/rpc": "^0.41.0",
"@lidofinance/satanizer": "^0.41.0",
"@tanstack/react-query": "^5.48.0",
"@wagmi/core": "^2.11.6",
"bignumber.js": "9.1.0",
"copy-to-clipboard": "^3.3.1",
"cors": "^2.8.5",
Expand All @@ -70,7 +69,7 @@
"react-hook-form": "^7.45.2",
"react-is": "^18.2.0",
"react-transition-group": "^4.4.2",
"reef-knot": "5.2.3",
"reef-knot": "5.5.4",
"remark": "^13.0.0",
"remark-external-links": "^8.0.0",
"remark-html": "^13.0.1",
Expand Down
1 change: 0 additions & 1 deletion shared/banners/vaults-banner-strategies/index.ts

This file was deleted.

112 changes: 0 additions & 112 deletions shared/banners/vaults-banner-strategies/styles.ts

This file was deleted.

Loading

0 comments on commit c5cadb4

Please sign in to comment.