From 84012b587546fc5408d951be6e82bd6b979675d8 Mon Sep 17 00:00:00 2001 From: Dmitrii Podlesnyi Date: Mon, 24 Jun 2024 17:01:08 +0700 Subject: [PATCH 01/10] fix: 1inch discount link --- features/stake/swap-discount-banner/integrations.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/stake/swap-discount-banner/integrations.tsx b/features/stake/swap-discount-banner/integrations.tsx index 894fd7d88..bfc676889 100644 --- a/features/stake/swap-discount-banner/integrations.tsx +++ b/features/stake/swap-discount-banner/integrations.tsx @@ -53,7 +53,7 @@ const STAKE_SWAP_INTEGRATION_CONFIG: StakeSwapDiscountIntegrationMap = { ); }, Icon: OneInchIcon, - linkHref: `https://app.1inch.io/#/1/simple/swap/ETH/stETH`, + linkHref: `https://app.1inch.io/#/1/advanced/swap/ETH/stETH`, matomoEvent: MATOMO_CLICK_EVENTS.oneInchDiscount, CustomLink({ children, ...props }) { const customProps = use1inchDeepLinkProps(); From c60d4c21d2bae02cc1d3ed2dd6f3b4b280d92511 Mon Sep 17 00:00:00 2001 From: Dmitrii Podlesnyi Date: Mon, 24 Jun 2024 17:12:01 +0700 Subject: [PATCH 02/10] chore: balance labels lowercased --- .../withdrawals/request/wallet/wallet-steth-balance.tsx | 2 +- .../withdrawals/request/wallet/wallet-wsteth-balance.tsx | 2 +- features/wsteth/shared/wallet/wallet.tsx | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/features/withdrawals/request/wallet/wallet-steth-balance.tsx b/features/withdrawals/request/wallet/wallet-steth-balance.tsx index d08a38135..2105a375a 100644 --- a/features/withdrawals/request/wallet/wallet-steth-balance.tsx +++ b/features/withdrawals/request/wallet/wallet-steth-balance.tsx @@ -16,7 +16,7 @@ export const WalletStethBalance = () => { return ( diff --git a/features/withdrawals/request/wallet/wallet-wsteth-balance.tsx b/features/withdrawals/request/wallet/wallet-wsteth-balance.tsx index 0c9c785b3..d0736d298 100644 --- a/features/withdrawals/request/wallet/wallet-wsteth-balance.tsx +++ b/features/withdrawals/request/wallet/wallet-wsteth-balance.tsx @@ -31,7 +31,7 @@ export const WalletWstethBalance = () => { return ( diff --git a/features/wsteth/shared/wallet/wallet.tsx b/features/wsteth/shared/wallet/wallet.tsx index 093996266..03d21471c 100644 --- a/features/wsteth/shared/wallet/wallet.tsx +++ b/features/wsteth/shared/wallet/wallet.tsx @@ -33,7 +33,7 @@ const WalletComponent: WalletComponentType = (props) => { { @@ -75,7 +75,7 @@ const WalletComponent: WalletComponentType = (props) => { /> From d9c5a4bde562aebce2183ae7f8dd8ff0544b4ad9 Mon Sep 17 00:00:00 2001 From: Dmitrii Podlesnyi Date: Mon, 24 Jun 2024 17:19:50 +0700 Subject: [PATCH 03/10] chore: consistency of last symbol-dot of sub-tittle of each page --- features/stake/stake-page.tsx | 2 +- pages/rewards.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/features/stake/stake-page.tsx b/features/stake/stake-page.tsx index ea84ae733..2b3571399 100644 --- a/features/stake/stake-page.tsx +++ b/features/stake/stake-page.tsx @@ -9,7 +9,7 @@ export const StakePage: FC = () => { return ( Stake with Lido | Lido diff --git a/pages/rewards.tsx b/pages/rewards.tsx index f48f377e2..b7d5e696d 100644 --- a/pages/rewards.tsx +++ b/pages/rewards.tsx @@ -11,7 +11,7 @@ const Rewards: FC = () => { return ( From 1dacde7418e00e8755066c874f6b1b567bca3070 Mon Sep 17 00:00:00 2001 From: Alexander Khramov Date: Tue, 25 Jun 2024 14:28:29 +0300 Subject: [PATCH 04/10] feat: add better handling for ens errors --- .../components/addressInput/AddressInput.tsx | 13 +++++++++-- .../rewards/components/addressInput/types.ts | 1 + .../rewards/features/top-card/top-card.tsx | 10 ++++++-- .../rewards/hooks/useGetCurrentAddress.ts | 23 ++++++++++++++++--- providers/rewardsHistory.tsx | 12 ++++++++-- 5 files changed, 50 insertions(+), 9 deletions(-) diff --git a/features/rewards/components/addressInput/AddressInput.tsx b/features/rewards/components/addressInput/AddressInput.tsx index 606d3aafb..88bfd0022 100644 --- a/features/rewards/components/addressInput/AddressInput.tsx +++ b/features/rewards/components/addressInput/AddressInput.tsx @@ -6,7 +6,13 @@ import { isValidAnyAddress } from 'features/rewards/utils'; import { AddressInputProps } from './types'; export const AddressInput: FC = (props) => { - const { inputValue, isAddressResolving, handleInputChange, address } = props; + const { + inputValue, + isAddressResolving, + handleInputChange, + address, + addressError, + } = props; return ( = (props) => { } rightDecorator={address ? : null} spellCheck="false" - error={inputValue.length > 0 && !isValidAnyAddress(inputValue)} + error={ + (inputValue.length > 0 && !isValidAnyAddress(inputValue)) || + addressError + } /> ); }; diff --git a/features/rewards/components/addressInput/types.ts b/features/rewards/components/addressInput/types.ts index a35ba9f50..063bc0b23 100644 --- a/features/rewards/components/addressInput/types.ts +++ b/features/rewards/components/addressInput/types.ts @@ -3,4 +3,5 @@ export type AddressInputProps = { isAddressResolving: boolean; handleInputChange: (value: string) => void; address: string; + addressError: string; }; diff --git a/features/rewards/features/top-card/top-card.tsx b/features/rewards/features/top-card/top-card.tsx index d54c4ac36..3f2ee2b8c 100644 --- a/features/rewards/features/top-card/top-card.tsx +++ b/features/rewards/features/top-card/top-card.tsx @@ -11,8 +11,13 @@ const INPUT_DESC_TEXT = 'Current balance may differ from last balance in the table due to rounding.'; export const TopCard: FC = () => { - const { address, isAddressResolving, inputValue, setInputValue } = - useRewardsHistory(); + const { + address, + addressError, + isAddressResolving, + inputValue, + setInputValue, + } = useRewardsHistory(); return ( @@ -20,6 +25,7 @@ export const TopCard: FC = () => { { address: string; + addressError: string; inputValue: string; isAddressResolving: boolean; setInputValue: (value: string) => void; @@ -21,6 +22,7 @@ export const useGetCurrentAddress: UseGetCurrentAddress = () => { }, []); const [isAddressResolving, setIsAddressResolving] = useState(false); const [address, setAddress] = useState(''); + const [addressError, setAddressError] = useState(''); const { account } = useSDK(); const { staticRpcProvider } = useCurrentStaticRpcProvider(); @@ -29,12 +31,26 @@ export const useGetCurrentAddress: UseGetCurrentAddress = () => { const getEnsAddress = useCallback( async (value: string) => { setAddress(''); + let result: string | null = null; + let error: string | null = null; setIsAddressResolving(true); - const result = await resolveEns(value, staticRpcProvider); - setIsAddressResolving(false); + try { + result = await resolveEns(value, staticRpcProvider); + } catch (e) { + console.error(e); + error = 'An error happened during ENS name resolving'; + } finally { + setIsAddressResolving(false); + } - if (result) setAddress(result); + if (result) { + setAddress(result); + } else if (error) { + setAddressError(error); + } else { + setAddressError("The ENS name entered couldn't be found"); + } }, [staticRpcProvider], ); @@ -76,6 +92,7 @@ export const useGetCurrentAddress: UseGetCurrentAddress = () => { return { address, + addressError, inputValue, isAddressResolving, setInputValue, diff --git a/providers/rewardsHistory.tsx b/providers/rewardsHistory.tsx index 6fc4ffda8..05dbb6ced 100644 --- a/providers/rewardsHistory.tsx +++ b/providers/rewardsHistory.tsx @@ -32,6 +32,7 @@ export type RewardsHistoryValue = { page: number; skip: number; address: string; + addressError: string; inputValue: string; isOnlyRewards: boolean; isUseArchiveExchangeRate: boolean; @@ -63,8 +64,13 @@ const RewardsHistoryProvider: FC = (props) => { const skip = page * PAGE_ITEMS; const limit = PAGE_ITEMS; - const { address, inputValue, setInputValue, isAddressResolving } = - useGetCurrentAddress(); + const { + address, + addressError, + inputValue, + setInputValue, + isAddressResolving, + } = useGetCurrentAddress(); const { data, error, loading, initialLoading, isLagging } = useRewardsDataLoad({ @@ -100,12 +106,14 @@ const RewardsHistoryProvider: FC = (props) => { setCurrency, isAddressResolving, address, + addressError, inputValue, setInputValue, isLagging, }), [ address, + addressError, currencyObject, data, error, From 1f04d35d66f2b98281f62a4906b462d9acbbcb26 Mon Sep 17 00:00:00 2001 From: Evgeny Taktarov Date: Fri, 28 Jun 2024 12:07:23 +0700 Subject: [PATCH 05/10] feat: support 422 error for rewards --- .../errorBlocks/ErrorUnprocessable.tsx | 22 +++++++++++++++++++ .../RewardsListErrorMessage.tsx | 5 +++++ 2 files changed, 27 insertions(+) create mode 100644 features/rewards/components/errorBlocks/ErrorUnprocessable.tsx diff --git a/features/rewards/components/errorBlocks/ErrorUnprocessable.tsx b/features/rewards/components/errorBlocks/ErrorUnprocessable.tsx new file mode 100644 index 000000000..0389ea1fa --- /dev/null +++ b/features/rewards/components/errorBlocks/ErrorUnprocessable.tsx @@ -0,0 +1,22 @@ +import Link from 'next/link'; +import { ErrorBlockBase } from './ErrorBlockBase'; + +export const ErrorUnprocessable = () => ( + + This address has too many stETH transfers. For querying such addresses + use{' '} + + Rewards Module from Lido Ethereum SDK + {' '} + and fetch rewards from subgraph directly + + } + /> +); diff --git a/features/rewards/components/rewardsListContent/RewardsListErrorMessage.tsx b/features/rewards/components/rewardsListContent/RewardsListErrorMessage.tsx index 95cea358a..d03076d56 100644 --- a/features/rewards/components/rewardsListContent/RewardsListErrorMessage.tsx +++ b/features/rewards/components/rewardsListContent/RewardsListErrorMessage.tsx @@ -4,6 +4,7 @@ import { ErrorRateLimited } from '../errorBlocks/ErrorRateLimited'; import { extractErrorMessage } from 'utils'; import { FetcherError } from 'utils/fetcherError'; +import { ErrorUnprocessable } from '../errorBlocks/ErrorUnprocessable'; type Props = { error: unknown; @@ -20,5 +21,9 @@ export const RewardsListErrorMessage: React.FC = ({ error }) => { return ; } + if (error instanceof FetcherError && error.status === 422) { + return ; + } + return ; }; From db0a5c412084da786ef7b7adc9dc6a1f5ae6726e Mon Sep 17 00:00:00 2001 From: Evgeny Taktarov Date: Fri, 28 Jun 2024 16:25:44 +0700 Subject: [PATCH 06/10] fix: direction in rewards --- .../components/rewardsTable/RewardsTableCells/TypeCell.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/rewards/components/rewardsTable/RewardsTableCells/TypeCell.tsx b/features/rewards/components/rewardsTable/RewardsTableCells/TypeCell.tsx index 99ae3c02a..03d198326 100644 --- a/features/rewards/components/rewardsTable/RewardsTableCells/TypeCell.tsx +++ b/features/rewards/components/rewardsTable/RewardsTableCells/TypeCell.tsx @@ -17,7 +17,7 @@ export const TypeCell: FC = (props) => { {capitalize(String(value))}{' '} - {data.direction && capitalize(data.direction)}{' '} + {value === 'transfer' && data.direction && capitalize(data.direction)} From 2f4c7c3095faf62219db83899fbd7542fe2d6093 Mon Sep 17 00:00:00 2001 From: Evgeny Taktarov Date: Mon, 1 Jul 2024 17:34:34 +0700 Subject: [PATCH 07/10] fix: unconnected wallet for wrap form --- .../hooks/use-wrap-form-validation-context.ts | 29 ++++++++++------- .../wsteth/wrap/wrap-form-context/types.ts | 16 +++++++--- .../wrap-form-context/wrap-form-validators.ts | 5 ++- .../validation/validate-stake-eth.ts | 32 +++++++++---------- 4 files changed, 46 insertions(+), 36 deletions(-) diff --git a/features/wsteth/wrap/hooks/use-wrap-form-validation-context.ts b/features/wsteth/wrap/hooks/use-wrap-form-validation-context.ts index cdee630bb..6ad2763f3 100644 --- a/features/wsteth/wrap/hooks/use-wrap-form-validation-context.ts +++ b/features/wsteth/wrap/hooks/use-wrap-form-validation-context.ts @@ -24,37 +24,42 @@ export const useWrapFormValidationContext = ({ wrapEthGasCost, } = networkData; - const isDataReady = - stethBalance && - ethBalance && - isMultisig !== undefined && + const waitForAccountData = active + ? stethBalance && ethBalance && isMultisig !== undefined + : true; + + const isDataReady = !!( + waitForAccountData && wrapEthGasCost && - stakeLimitInfo; + stakeLimitInfo + ); const asyncContextValue: WrapFormAsyncValidationContext | undefined = useMemo(() => { return isDataReady - ? { + ? ({ + isWalletActive: active, stethBalance, etherBalance: ethBalance, isMultisig, gasCost: wrapEthGasCost, - stakingLimitLevel: stakeLimitInfo.stakeLimitLevel, - currentStakeLimit: stakeLimitInfo.currentStakeLimit, - } + stakingLimitLevel: stakeLimitInfo?.stakeLimitLevel, + currentStakeLimit: stakeLimitInfo?.currentStakeLimit, + } as WrapFormAsyncValidationContext) : undefined; }, [ isDataReady, + active, + stethBalance, ethBalance, isMultisig, - stakeLimitInfo, - stethBalance, wrapEthGasCost, + stakeLimitInfo?.stakeLimitLevel, + stakeLimitInfo?.currentStakeLimit, ]); const asyncContext = useAwaiter(asyncContextValue).awaiter; return { - isWalletActive: active, asyncContext, }; }; diff --git a/features/wsteth/wrap/wrap-form-context/types.ts b/features/wsteth/wrap/wrap-form-context/types.ts index 5f051d928..76e4720bc 100644 --- a/features/wsteth/wrap/wrap-form-context/types.ts +++ b/features/wsteth/wrap/wrap-form-context/types.ts @@ -16,18 +16,24 @@ export type WrapFormNetworkData = ReturnType; export type WrapFormApprovalData = ReturnType; export type WrapFormValidationContext = { - isWalletActive: boolean; asyncContext: Promise; }; export type WrapFormAsyncValidationContext = { - stethBalance: BigNumber; - etherBalance: BigNumber; stakingLimitLevel: LIMIT_LEVEL; currentStakeLimit: BigNumber; gasCost: BigNumber; - isMultisig: boolean; -}; +} & ( + | { + isWalletActive: true; + stethBalance: BigNumber; + etherBalance: BigNumber; + isMultisig: boolean; + } + | { + isWalletActive: false; + } +); export type WrapFormDataContextValueType = WrapFormNetworkData & WrapFormApprovalData & { diff --git a/features/wsteth/wrap/wrap-form-context/wrap-form-validators.ts b/features/wsteth/wrap/wrap-form-context/wrap-form-validators.ts index e13a5d7bb..6401b12a2 100644 --- a/features/wsteth/wrap/wrap-form-context/wrap-form-validators.ts +++ b/features/wsteth/wrap/wrap-form-context/wrap-form-validators.ts @@ -26,7 +26,7 @@ export const WrapFormValidationResolver: Resolver< const { amount, token } = values; try { invariant(validationContext, 'validation context must be present'); - const { isWalletActive, asyncContext } = validationContext; + const { asyncContext } = validationContext; validateEtherAmount('amount', amount, token); @@ -39,11 +39,10 @@ export const WrapFormValidationResolver: Resolver< // checks active internally after other wallet-less check validateStakeEth({ formField: 'amount', - isWalletActive, amount, ...awaitedContext, }); - } else if (isWalletActive) { + } else if (awaitedContext.isWalletActive) { validateBignumberMax( 'amount', amount, diff --git a/shared/hook-form/validation/validate-stake-eth.ts b/shared/hook-form/validation/validate-stake-eth.ts index 8851aca93..7763dac95 100644 --- a/shared/hook-form/validation/validate-stake-eth.ts +++ b/shared/hook-form/validation/validate-stake-eth.ts @@ -9,28 +9,28 @@ import type { BigNumber } from 'ethers'; export type validateStakeEthParams = { formField: string; amount: BigNumber; - isWalletActive: boolean; stakingLimitLevel: LIMIT_LEVEL; currentStakeLimit: BigNumber; gasCost: BigNumber; - etherBalance: BigNumber; - isMultisig: boolean; -}; +} & ( + | { isWalletActive: true; etherBalance: BigNumber; isMultisig: boolean } + | { isWalletActive: false } +); // Runs validation pipeline common between stake and wrapEth -export const validateStakeEth = ({ - isWalletActive, - amount, - formField, - currentStakeLimit, - etherBalance, - gasCost, - isMultisig, - stakingLimitLevel, -}: validateStakeEthParams) => { - validateStakeLimit('amount', stakingLimitLevel); +export const validateStakeEth = (params: validateStakeEthParams) => { + validateStakeLimit('amount', params.stakingLimitLevel); + + if (params.isWalletActive) { + const { + amount, + formField, + currentStakeLimit, + gasCost, - if (isWalletActive) { + etherBalance, + isMultisig, + } = params; validateBignumberMax( formField, amount, From 83fb95113d0fb7463711b49b0b56c64008e56845 Mon Sep 17 00:00:00 2001 From: Alexander Khramov Date: Mon, 1 Jul 2024 14:35:31 +0300 Subject: [PATCH 08/10] chore: rm ipfs-goerli workflow --- .github/workflows/ci-ipfs-goerli.yml | 72 ---------------------------- 1 file changed, 72 deletions(-) delete mode 100644 .github/workflows/ci-ipfs-goerli.yml diff --git a/.github/workflows/ci-ipfs-goerli.yml b/.github/workflows/ci-ipfs-goerli.yml deleted file mode 100644 index 30a5336fc..000000000 --- a/.github/workflows/ci-ipfs-goerli.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: IPFS Goerli - -on: - workflow_dispatch: - -permissions: - contents: write - -env: - ipfs_folder: 'out' -jobs: - prepare-for-ipfs: - runs-on: ubuntu-latest - environment: IPFS Goerli - outputs: - ipfs_folder: ${{ env.ipfs_folder }} - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - persist-credentials: false - fetch-depth: 0 - fetch-tags: true - - name: Install node - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'yarn' - - name: Set tag, commit and branch name - id: build-info - uses: lidofinance/actions/.github/actions/build-info@main - with: - BRANCH_NAME: ${{ github.ref_name }} - - name: Install dependencies - run: | - yarn install --frozen-lockfile - - name: Build - run: | - yarn build:ipfs - env: - ROOT_ORIGIN: ${{ vars.ROOT_ORIGIN }} - DOCS_ORIGIN: ${{ vars.DOCS_ORIGIN }} - HELP_ORIGIN: ${{ vars.HELP_ORIGIN }} - RESEARCH_ORIGIN: ${{ vars.RESEARCH_ORIGIN }} - DEFAULT_CHAIN: ${{ vars.DEFAULT_CHAIN }} - SUPPORTED_CHAINS: ${{ vars.SUPPORTED_CHAINS }} - WIDGET_API_BASE_PATH_FOR_IPFS: ${{ vars.WIDGET_API_BASE_PATH_FOR_IPFS }} - REWARDS_BACKEND_BASE_PATH: ${{ vars.REWARDS_BACKEND_BASE_PATH }} - WQ_API_BASE_PATH: ${{ vars.WQ_API_BASE_PATH }} - ETH_API_BASE_PATH: ${{ vars.ETH_API_BASE_PATH }} - PREFILL_UNSAFE_EL_RPC_URLS_1: ${{ secrets.PREFILL_UNSAFE_EL_RPC_URLS_1 }} - PREFILL_UNSAFE_EL_RPC_URLS_5: ${{ secrets.PREFILL_UNSAFE_EL_RPC_URLS_5 }} - WALLETCONNECT_PROJECT_ID: ${{ secrets.WALLETCONNECT_PROJECT_ID }} - - uses: actions/upload-artifact@v4 - with: - name: ${{ env.ipfs_folder }} - path: ${{ env.ipfs_folder }} - retention-days: 30 - ipfs-pinning: - needs: prepare-for-ipfs - uses: lidofinance/actions/.github/workflows/ci-ipfs.yml@main - with: - ipfs_folder: ${{ needs.prepare-for-ipfs.outputs.ipfs_folder }} - current_branch: ${{ github.ref_name }} - IS_CREATE_RELEASE: false - FILEBASE_BUCKET_NAME: ${{ vars.FILEBASE_BUCKET_NAME }} - secrets: - W3S_TOKEN: ${{ secrets.W3S_TOKEN }} - W3S_PROOF: ${{ secrets.W3S_PROOF }} - GW3_TOKEN: ${{ secrets.GW3_TOKEN }} - GW3_ACCESS_KEY: ${{ secrets.GW3_ACCESS_KEY }} - FILEBASE_TOKEN: ${{ secrets.FILEBASE_TOKEN }} From 01a1b05ca6db1b8d16c4a692d3804b78157fd821 Mon Sep 17 00:00:00 2001 From: Evgeny Taktarov Date: Mon, 1 Jul 2024 20:37:47 +0700 Subject: [PATCH 09/10] fix: change sdk link --- features/rewards/components/errorBlocks/ErrorUnprocessable.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/rewards/components/errorBlocks/ErrorUnprocessable.tsx b/features/rewards/components/errorBlocks/ErrorUnprocessable.tsx index 0389ea1fa..26cafd9ca 100644 --- a/features/rewards/components/errorBlocks/ErrorUnprocessable.tsx +++ b/features/rewards/components/errorBlocks/ErrorUnprocessable.tsx @@ -10,7 +10,7 @@ export const ErrorUnprocessable = () => ( use{' '} Rewards Module from Lido Ethereum SDK From 5f40497e5377ca748d03a85c321751463307e9cc Mon Sep 17 00:00:00 2001 From: Evgeny Taktarov Date: Mon, 1 Jul 2024 20:44:41 +0700 Subject: [PATCH 10/10] chore: error text --- .../rewards/components/errorBlocks/ErrorUnprocessable.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/features/rewards/components/errorBlocks/ErrorUnprocessable.tsx b/features/rewards/components/errorBlocks/ErrorUnprocessable.tsx index 26cafd9ca..4afdc0a13 100644 --- a/features/rewards/components/errorBlocks/ErrorUnprocessable.tsx +++ b/features/rewards/components/errorBlocks/ErrorUnprocessable.tsx @@ -6,16 +6,16 @@ export const ErrorUnprocessable = () => ( textProps={{ color: 'error' }} text={ <> - This address has too many stETH transfers. For querying such addresses - use{' '} + This address has reached limit for parsed stETH transfers. Fetch rewards + directly from Lido Subgraph using{' '} Rewards Module from Lido Ethereum SDK - {' '} - and fetch rewards from subgraph directly + + . } />