Skip to content

Commit

Permalink
Merge pull request #440 from lidofinance/develop
Browse files Browse the repository at this point in the history
Develop to main
  • Loading branch information
itaven authored Aug 20, 2024
2 parents a34df34 + ea66b4a commit be0e77e
Show file tree
Hide file tree
Showing 62 changed files with 744 additions and 546 deletions.
14 changes: 0 additions & 14 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,18 @@ SUPPORTED_CHAINS=1,17000,11155111
# this chain uses when a wallet is not connected
DEFAULT_CHAIN=1

# api key for ethplorer for token data
ETHPLORER_API_KEY=freekey

# comma-separated trusted hosts for Content Security Policy
# e.g. http://localhost:PORT for local development
CSP_TRUSTED_HOSTS=https://*.lido.fi

# put "true" enable report only mode for CSP
CSP_REPORT_ONLY=true

# api endpoint for reporting csp violations
CSP_REPORT_URI=https://stake.lido.fi/api/csp-report

# Subgraph endpoint
SUBGRAPH_MAINNET=https://gateway-arbitrum.network.thegraph.com/api/[api-key]/subgraphs/id/Sxx812XgeKyzQPaBpR5YZWmGV5fZuBaPdh7DFhzSwiQ
SUBGRAPH_HOLESKY=
SUBGRAPH_SEPOLIA=

SUBGRAPH_REQUEST_TIMEOUT=5000

# allow some state overrides from browser console for QA
ENABLE_QA_HELPERS=false

# 1inch API token to power /api/oneinch-rate
ONE_INCH_API_KEY=

REWARDS_BACKEND=http://127.0.0.1:4000

# rate limit
Expand Down
1 change: 1 addition & 0 deletions assets/dvv-banner/dvv-banner-lido-logo-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/dvv-banner/dvv-banner-lido-logo-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/dvv-banner/dvv-banner-partners-logo-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/dvv-banner/dvv-banner-partners-logo-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/error-triangle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions config/groups/stake.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { BigNumber } from 'ethers';
import { parseEther } from '@ethersproject/units';
import { AddressZero } from '@ethersproject/constants';

import { StakeSwapDiscountIntegrationKey } from 'features/stake/swap-discount-banner';

Expand All @@ -26,11 +25,11 @@ export const STAKE_GASLIMIT_FALLBACK = BigNumber.from(
),
);

export const STAKE_WIDGET_METRIC_SUFFIX = '01';
export const LIDO_ADDRESS = '0x11D00000000000000000000000000000000011D0';

export const STAKE_FALLBACK_REFERRAL_ADDRESS = preConfig.ipfsMode
? IPFS_REFERRAL_ADDRESS
: AddressZero;
: LIDO_ADDRESS;

export const STAKE_SWAP_INTEGRATION: StakeSwapDiscountIntegrationKey =
'one-inch';
24 changes: 24 additions & 0 deletions consts/matomo-click-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export const enum MATOMO_CLICK_EVENTS_TYPES {
lidoOnLidoMultichainOpportunities = 'lidoOnLidoMultichainOpportunities',
vaultsBannerLearnMore = 'vaultsBannerLearnMore',
vaultsBannerExploreAll = 'vaultsBannerExploreAll',
obolBannerProceed = 'obolBannerProceed',
obolBannerDVVLink = 'obolBannerDVVLink',
exploreAllStrategiesAfterStake = 'exploreAllStrategiesAfterStake',
exploreAllStrategiesAfterWrap = 'exploreAllStrategiesAfterWrap',
// FAQ
faqSafeWorkWithLidoAudits = 'faqSafeWorkWithLidoAudits',
faqLidoEthAprEthLandingPage = 'faqLidoEthAprEthLandingPage',
Expand Down Expand Up @@ -129,6 +133,26 @@ export const MATOMO_CLICK_EVENTS: Record<
'Push "Explore all strategies"',
'eth_widget_explore_all_strategies',
],
[MATOMO_CLICK_EVENTS_TYPES.obolBannerProceed]: [
'Ethereum_Staking_Widget',
'Push "Proceed" Obol SSV',
'eth_widget_proceed_obol_ssv',
],
[MATOMO_CLICK_EVENTS_TYPES.obolBannerDVVLink]: [
'Ethereum_Staking_Widget',
'Push "the DVV Vault" link on Obol SSV banner',
'eth_widget_the_dvv_vault_link_obol_ssv',
],
[MATOMO_CLICK_EVENTS_TYPES.exploreAllStrategiesAfterStake]: [
'Ethereum_Staking_Widget',
'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
1 change: 0 additions & 1 deletion consts/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ export const METRICS_PREFIX = 'eth_stake_widget_ui_';
export const enum METRIC_NAMES {
REQUESTS_TOTAL = 'requests_total',
API_RESPONSE = 'api_response',
SUBGRAPHS_RESPONSE = 'subgraphs_response',
ETH_CALL_ADDRESS_TO = 'eth_call_address_to',
}
50 changes: 50 additions & 0 deletions features/rewards/components/address-input/address-input.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { FC, useMemo } from 'react';
import { Input, Loader, Identicon } from '@lidofinance/lido-ui';
import CopyAddressUrl from 'features/rewards/components/CopyAddressUrl';
import { isValidAnyAddress } from 'features/rewards/utils';
import { ReactComponent as ErrorTriangle } from 'assets/icons/error-triangle.svg';

import { AddressInputProps } from './types';

export const AddressInput: FC<AddressInputProps> = (props) => {
const {
inputValue,
isAddressResolving,
handleInputChange,
address,
addressError: invalidENSAddress,
loading,
} = props;

const invalidEthereumAddress = useMemo(
() => inputValue.length > 0 && !isValidAnyAddress(inputValue),
[inputValue],
);

return (
<Input
fullwidth
value={inputValue}
onChange={(e) => handleInputChange(e.target.value)}
placeholder="Ethereum address"
leftDecorator={
loading || isAddressResolving ? (
<Loader size="small" />
) : invalidEthereumAddress || invalidENSAddress ? (
<ErrorTriangle />
) : address ? (
<Identicon data-testid="addressIcon" address={address} />
) : null
}
rightDecorator={address ? <CopyAddressUrl address={inputValue} /> : null}
spellCheck="false"
error={
invalidEthereumAddress
? 'Invalid ethereum address'
: invalidENSAddress
? invalidENSAddress
: null
}
/>
);
};
1 change: 1 addition & 0 deletions features/rewards/components/address-input/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './address-input';
8 changes: 8 additions & 0 deletions features/rewards/components/address-input/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export type AddressInputProps = {
inputValue: string;
isAddressResolving: boolean;
handleInputChange: (value: string) => void;
address: string;
addressError: string;
loading: boolean;
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { ErrorBlockBase } from './ErrorBlockBase';
export const ErrorBlockServer = () => (
<ErrorBlockBase
textProps={{ color: 'error' }}
text="Subgraph returned a fatal error. Lido contributors were alerted and are working on a fix. Please repeat the request in a while."
text="Failed to fetch data from the Subgraph. Maintainers are notified and working on a fix."
/>
);
Loading

0 comments on commit be0e77e

Please sign in to comment.