From 4d8585c3314e93e7f2081b6bee505023447d212f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Apr 2024 18:56:33 +0000 Subject: [PATCH 01/13] chore(deps): bump @solana/web3.js from 1.89.1 to 1.91.6 Bumps [@solana/web3.js](https://github.com/solana-labs/solana-web3.js) from 1.89.1 to 1.91.6. - [Release notes](https://github.com/solana-labs/solana-web3.js/releases) - [Commits](https://github.com/solana-labs/solana-web3.js/compare/v1.89.1...v1.91.6) --- updated-dependencies: - dependency-name: "@solana/web3.js" dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/yarn.lock b/yarn.lock index 0d253c524..7ef7e82fb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2429,11 +2429,16 @@ dependencies: "@noble/hashes" "1.3.3" -"@noble/hashes@1.3.3", "@noble/hashes@^1.3.2": +"@noble/hashes@1.3.3": version "1.3.3" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.3.tgz#39908da56a4adc270147bb07968bf3b16cfe1699" integrity sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA== +"@noble/hashes@^1.3.3": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" + integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg== + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -2831,13 +2836,13 @@ buffer "~6.0.3" "@solana/web3.js@^1.70.1": - version "1.89.1" - resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.89.1.tgz#52df6820f2d088c4558aa359af40580a03d10ec9" - integrity sha512-t9TTLtPQxtQB3SAf/5E8xPXfVDsC6WGOsgKY02l2cbe0HLymT7ynE8Hu48Lk5qynHCquj6nhISfEHcjMkYpu/A== + version "1.91.6" + resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.91.6.tgz#c090661c344cbc61e6cdeb0da67d3ea80d5848e1" + integrity sha512-dm20nN6HQvXToo+kM51nxHdtaa2wMSRdeK37p+WIWESfeiVHqV8XbV4XnWupq6ngt5vIckhGFG7ZnTBxUgLzDA== dependencies: "@babel/runtime" "^7.23.4" "@noble/curves" "^1.2.0" - "@noble/hashes" "^1.3.2" + "@noble/hashes" "^1.3.3" "@solana/buffer-layout" "^4.0.1" agentkeepalive "^4.5.0" bigint-buffer "^1.1.5" From 6cd88d67104f2e8fcf2239867f8642364dad3d53 Mon Sep 17 00:00:00 2001 From: Evgeny Taktarov Date: Mon, 29 Apr 2024 16:02:33 +0700 Subject: [PATCH 02/13] feat: stake referral shift --- config/groups/stake.ts | 6 ++++-- features/stake/stake-form/utils.ts | 27 +++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/config/groups/stake.ts b/config/groups/stake.ts index 739da46ce..66634749b 100644 --- a/config/groups/stake.ts +++ b/config/groups/stake.ts @@ -1,5 +1,4 @@ import { BigNumber } from 'ethers'; -import { AddressZero } from '@ethersproject/constants'; import { parseEther } from '@ethersproject/units'; import { StakeSwapDiscountIntegrationKey } from 'features/stake/swap-discount-banner'; @@ -26,9 +25,12 @@ export const STAKE_GASLIMIT_FALLBACK = BigNumber.from( ), ); +export const STAKE_REFERRAL_OFFSET = + '0x11D00000000000000000000000000000000011D0'; + export const STAKE_FALLBACK_REFERRAL_ADDRESS = preConfig.ipfsMode ? IPFS_REFERRAL_ADDRESS - : AddressZero; + : STAKE_REFERRAL_OFFSET; export const STAKE_SWAP_INTEGRATION: StakeSwapDiscountIntegrationKey = 'one-inch'; diff --git a/features/stake/stake-form/utils.ts b/features/stake/stake-form/utils.ts index a45596c25..31a02d972 100644 --- a/features/stake/stake-form/utils.ts +++ b/features/stake/stake-form/utils.ts @@ -1,5 +1,5 @@ import { BigNumber } from 'ethers'; -import { isAddress } from 'ethers/lib/utils'; +import { hexlify, isAddress } from 'ethers/lib/utils'; import type { BaseProvider } from '@ethersproject/providers'; import { config } from 'config'; @@ -9,17 +9,36 @@ export const applyGasLimitRatio = (gasLimit: BigNumber): BigNumber => .mul(config.SUBMIT_EXTRA_GAS_TRANSACTION_RATIO * config.PRECISION) .div(config.PRECISION); +const ADDRESS_MODULO = BigNumber.from(2).pow(160); +const applyReferralShift = (address: string) => { + return hexlify( + BigNumber.from(address) + .add(config.STAKE_REFERRAL_OFFSET) + .mod(ADDRESS_MODULO), + ); +}; + export const getAddress = async ( input: string, providerRpc: BaseProvider, ): Promise => { + let address; try { - if (isAddress(input)) return input; - const address = await providerRpc.resolveName(input); - if (address) return address; + // extract address from url or from ens + if (isAddress(input)) { + address = input; + } else { + const resolved = await providerRpc.resolveName(input); + if (resolved) address = resolved; + } + // apply tracking shift + if (address) { + return applyReferralShift(address); + } } catch { // noop } + // if code gets here, ref is invalid and we need to throw error throw new ReferralAddressError(); }; From 24cd5fdb9749815c0f5e0465670682cec9788eb1 Mon Sep 17 00:00:00 2001 From: Alexander Khramov Date: Mon, 20 May 2024 15:15:07 +0300 Subject: [PATCH 03/13] feat: add link to ledger to FAQ --- consts/matomo-click-events.ts | 6 ++++++ .../stake/stake-faq/list/how-can-i-get-steth.tsx | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/consts/matomo-click-events.ts b/consts/matomo-click-events.ts index 7384bf81d..60553768c 100644 --- a/consts/matomo-click-events.ts +++ b/consts/matomo-click-events.ts @@ -20,6 +20,7 @@ export const enum MATOMO_CLICK_EVENTS_TYPES { faqLidoEthAprDocs = 'faqLidoEthAprDocs', faqHowCanIGetStEthWidget = 'faqHowCanIGetStEthWidget', faqHowCanIGetStEthIntegrations = 'faqHowCanIGetStEthIntegrations', + faqHowCanIGetStEthLedger = 'faqHowCanIGetStEthLedger', faqHowCanIUseSteth = 'faqHowCanIUseSteth', faqWhereCanICoverIdleFinance = 'faqWhereCanICoverIdleFinance', faqWhereCanICoverNexusMutual = 'faqWhereCanICoverNexusMutual', @@ -151,6 +152,11 @@ export const MATOMO_CLICK_EVENTS: Record< 'Push «DEX Lido integrations» in FAQ How can I get stETH? on stake widget', 'eth_widget_faq_howCanIGetStEth_dexLidoIntegrations', ], + [MATOMO_CLICK_EVENTS_TYPES.faqHowCanIGetStEthLedger]: [ + 'Ethereum_Staking_Widget', + 'Push «Ledger Ethereum wallet» in FAQ How can I get stETH? on stake widget', + 'eth_widget_faq_howCanIGetStEth_ledgerEthereumWallet', + ], [MATOMO_CLICK_EVENTS_TYPES.faqHowCanIUseSteth]: [ 'Ethereum_Staking_Widget', 'Push «more» in FAQ How can I use stETH? on stake widget', diff --git a/features/stake/stake-faq/list/how-can-i-get-steth.tsx b/features/stake/stake-faq/list/how-can-i-get-steth.tsx index 48b9b33e0..0992e6d8f 100644 --- a/features/stake/stake-faq/list/how-can-i-get-steth.tsx +++ b/features/stake/stake-faq/list/how-can-i-get-steth.tsx @@ -11,7 +11,7 @@ export const HowCanIGetSteth: FC = () => {

You can get stETH many ways, including interacting with the smart - contract directly.Yet, it is much easier to use a{' '} + contract directly. Yet, it is much easier to use a{' '} @@ -20,8 +20,18 @@ export const HowCanIGetSteth: FC = () => { aria-hidden="true" > Lido Ethereum staking widget - {' '} - and in other{' '} + + , stake your tokens directly from{' '} + + trackMatomoEvent(MATOMO_CLICK_EVENTS_TYPES.faqHowCanIGetStEthLedger) + } + aria-hidden="true" + > + Ledger Ethereum wallet + + , or in other{' '} Date: Mon, 20 May 2024 15:25:26 +0300 Subject: [PATCH 04/13] fix: use outerlink for ledger link --- features/stake/stake-faq/list/how-can-i-get-steth.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/features/stake/stake-faq/list/how-can-i-get-steth.tsx b/features/stake/stake-faq/list/how-can-i-get-steth.tsx index 0992e6d8f..9e4d84265 100644 --- a/features/stake/stake-faq/list/how-can-i-get-steth.tsx +++ b/features/stake/stake-faq/list/how-can-i-get-steth.tsx @@ -22,15 +22,12 @@ export const HowCanIGetSteth: FC = () => { Lido Ethereum staking widget , stake your tokens directly from{' '} - - trackMatomoEvent(MATOMO_CLICK_EVENTS_TYPES.faqHowCanIGetStEthLedger) - } - aria-hidden="true" + data-matomo={MATOMO_CLICK_EVENTS_TYPES.faqHowCanIGetStEthLedger} > Ledger Ethereum wallet - + , or in other{' '} Date: Tue, 21 May 2024 18:51:40 +0700 Subject: [PATCH 05/13] fix: use transaction prefix --- features/stake/stake-form/use-stake.ts | 14 +++++++++----- features/stake/stake-form/utils.ts | 14 ++------------ 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/features/stake/stake-form/use-stake.ts b/features/stake/stake-form/use-stake.ts index 2dd903250..e6fc05859 100644 --- a/features/stake/stake-form/use-stake.ts +++ b/features/stake/stake-form/use-stake.ts @@ -74,17 +74,21 @@ export const useStake = ({ onConfirm, onRetry }: StakeOptions) => { maxFeePerGas, }; - const originalGasLimit = await stethContractWeb3.estimateGas.submit( + const tx = await stethContractWeb3.populateTransaction.submit( referralAddress, overrides, ); + // add tracking suffix + tx.data = tx.data + '01'; + + const originalGasLimit = await providerWeb3.estimateGas(tx); const gasLimit = applyGasLimitRatio(originalGasLimit); - return stethContractWeb3.submit(referralAddress, { - ...overrides, - gasLimit, - }); + tx.gasLimit = gasLimit; + + const signer = providerWeb3.getSigner(); + return signer.sendTransaction(tx); } }; diff --git a/features/stake/stake-form/utils.ts b/features/stake/stake-form/utils.ts index 31a02d972..894ba5fbf 100644 --- a/features/stake/stake-form/utils.ts +++ b/features/stake/stake-form/utils.ts @@ -1,5 +1,5 @@ import { BigNumber } from 'ethers'; -import { hexlify, isAddress } from 'ethers/lib/utils'; +import { isAddress } from 'ethers/lib/utils'; import type { BaseProvider } from '@ethersproject/providers'; import { config } from 'config'; @@ -9,15 +9,6 @@ export const applyGasLimitRatio = (gasLimit: BigNumber): BigNumber => .mul(config.SUBMIT_EXTRA_GAS_TRANSACTION_RATIO * config.PRECISION) .div(config.PRECISION); -const ADDRESS_MODULO = BigNumber.from(2).pow(160); -const applyReferralShift = (address: string) => { - return hexlify( - BigNumber.from(address) - .add(config.STAKE_REFERRAL_OFFSET) - .mod(ADDRESS_MODULO), - ); -}; - export const getAddress = async ( input: string, providerRpc: BaseProvider, @@ -31,9 +22,8 @@ export const getAddress = async ( const resolved = await providerRpc.resolveName(input); if (resolved) address = resolved; } - // apply tracking shift if (address) { - return applyReferralShift(address); + return address; } } catch { // noop From e00e07022d7005b1c9766167574257c027ba0c97 Mon Sep 17 00:00:00 2001 From: Evgeny Taktarov Date: Tue, 21 May 2024 19:04:29 +0700 Subject: [PATCH 06/13] fix: remove marker ref fallback --- config/groups/stake.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/config/groups/stake.ts b/config/groups/stake.ts index 66634749b..15aa4d87a 100644 --- a/config/groups/stake.ts +++ b/config/groups/stake.ts @@ -9,6 +9,7 @@ import { IPFS_REFERRAL_ADDRESS } from './ipfs'; // import { config } from '../get-config'; // otherwise you will get something like a cyclic error! import { preConfig } from '../get-preconfig'; +import { AddressZero } from '@ethersproject/constants'; export const PRECISION = 10 ** 6; @@ -25,12 +26,9 @@ export const STAKE_GASLIMIT_FALLBACK = BigNumber.from( ), ); -export const STAKE_REFERRAL_OFFSET = - '0x11D00000000000000000000000000000000011D0'; - export const STAKE_FALLBACK_REFERRAL_ADDRESS = preConfig.ipfsMode ? IPFS_REFERRAL_ADDRESS - : STAKE_REFERRAL_OFFSET; + : AddressZero; export const STAKE_SWAP_INTEGRATION: StakeSwapDiscountIntegrationKey = 'one-inch'; From 3da6a1e52f4c56070380e60021b5095a81e666da Mon Sep 17 00:00:00 2001 From: Evgeny Taktarov Date: Wed, 22 May 2024 16:49:47 +0700 Subject: [PATCH 07/13] fix: use helper func --- features/stake/stake-form/use-stake.ts | 10 +++++++--- features/stake/stake-form/utils.ts | 12 +++++++++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/features/stake/stake-form/use-stake.ts b/features/stake/stake-form/use-stake.ts index e6fc05859..1a3ffa6e5 100644 --- a/features/stake/stake-form/use-stake.ts +++ b/features/stake/stake-form/use-stake.ts @@ -11,7 +11,12 @@ import { isContract } from 'utils/isContract'; import { getFeeData } from 'utils/getFeeData'; import { runWithTransactionLogger } from 'utils'; -import { MockLimitReachedError, getAddress, applyGasLimitRatio } from './utils'; +import { + MockLimitReachedError, + getAddress, + applyGasLimitRatio, + applyCalldataSuffix, +} from './utils'; import { useTxModalStagesStake } from './hooks/use-tx-modal-stages-stake'; type StakeArguments = { @@ -79,8 +84,7 @@ export const useStake = ({ onConfirm, onRetry }: StakeOptions) => { overrides, ); - // add tracking suffix - tx.data = tx.data + '01'; + applyCalldataSuffix(tx); const originalGasLimit = await providerWeb3.estimateGas(tx); const gasLimit = applyGasLimitRatio(originalGasLimit); diff --git a/features/stake/stake-form/utils.ts b/features/stake/stake-form/utils.ts index 894ba5fbf..fa360056b 100644 --- a/features/stake/stake-form/utils.ts +++ b/features/stake/stake-form/utils.ts @@ -1,8 +1,9 @@ -import { BigNumber } from 'ethers'; +import type { BigNumber, PopulatedTransaction } from 'ethers'; import { isAddress } from 'ethers/lib/utils'; import type { BaseProvider } from '@ethersproject/providers'; import { config } from 'config'; +import invariant from 'tiny-invariant'; export const applyGasLimitRatio = (gasLimit: BigNumber): BigNumber => gasLimit @@ -32,6 +33,15 @@ export const getAddress = async ( throw new ReferralAddressError(); }; +// adds metrics indicator for widget tx +export const applyCalldataSuffix = (tx: PopulatedTransaction) => { + if (!config.ipfsMode) { + invariant(tx.data, 'transaction must have calldata'); + tx.data = tx.data + '01'; + } + return tx; +}; + export class ReferralAddressError extends Error { reason: string; constructor() { From ae3cec8abe1ae179424b3f70d4dd4e48529de680 Mon Sep 17 00:00:00 2001 From: Evgeny Taktarov Date: Wed, 22 May 2024 18:11:57 +0700 Subject: [PATCH 08/13] chore: revert getAddress --- features/stake/stake-form/utils.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/features/stake/stake-form/utils.ts b/features/stake/stake-form/utils.ts index fa360056b..3edc32921 100644 --- a/features/stake/stake-form/utils.ts +++ b/features/stake/stake-form/utils.ts @@ -14,18 +14,10 @@ export const getAddress = async ( input: string, providerRpc: BaseProvider, ): Promise => { - let address; try { - // extract address from url or from ens - if (isAddress(input)) { - address = input; - } else { - const resolved = await providerRpc.resolveName(input); - if (resolved) address = resolved; - } - if (address) { - return address; - } + if (isAddress(input)) return input; + const address = await providerRpc.resolveName(input); + if (address) return address; } catch { // noop } From 5fb677f1803ad3ddfd0497405af9230979cb670f Mon Sep 17 00:00:00 2001 From: Evgeny Taktarov Date: Wed, 22 May 2024 18:13:59 +0700 Subject: [PATCH 09/13] chore: revert stake config --- config/groups/stake.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/groups/stake.ts b/config/groups/stake.ts index 15aa4d87a..bc318580d 100644 --- a/config/groups/stake.ts +++ b/config/groups/stake.ts @@ -1,5 +1,6 @@ import { BigNumber } from 'ethers'; import { parseEther } from '@ethersproject/units'; +import { AddressZero } from '@ethersproject/constants'; import { StakeSwapDiscountIntegrationKey } from 'features/stake/swap-discount-banner'; @@ -9,7 +10,6 @@ import { IPFS_REFERRAL_ADDRESS } from './ipfs'; // import { config } from '../get-config'; // otherwise you will get something like a cyclic error! import { preConfig } from '../get-preconfig'; -import { AddressZero } from '@ethersproject/constants'; export const PRECISION = 10 ** 6; From ba9a199933161cb2714df058139b8a0b68a4a8fa Mon Sep 17 00:00:00 2001 From: Evgeny Taktarov Date: Wed, 22 May 2024 18:24:21 +0700 Subject: [PATCH 10/13] fix: move suffix to const --- config/groups/stake.ts | 2 ++ features/stake/stake-form/utils.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config/groups/stake.ts b/config/groups/stake.ts index bc318580d..f687764cb 100644 --- a/config/groups/stake.ts +++ b/config/groups/stake.ts @@ -26,6 +26,8 @@ export const STAKE_GASLIMIT_FALLBACK = BigNumber.from( ), ); +export const STAKE_WIDGET_METRIC_SUFFIX = '01'; + export const STAKE_FALLBACK_REFERRAL_ADDRESS = preConfig.ipfsMode ? IPFS_REFERRAL_ADDRESS : AddressZero; diff --git a/features/stake/stake-form/utils.ts b/features/stake/stake-form/utils.ts index 3edc32921..ed0cd4ead 100644 --- a/features/stake/stake-form/utils.ts +++ b/features/stake/stake-form/utils.ts @@ -29,7 +29,7 @@ export const getAddress = async ( export const applyCalldataSuffix = (tx: PopulatedTransaction) => { if (!config.ipfsMode) { invariant(tx.data, 'transaction must have calldata'); - tx.data = tx.data + '01'; + tx.data = tx.data + config.STAKE_WIDGET_METRIC_SUFFIX; } return tx; }; From c6115f2f33e233cc56c4e7d33e2005a5fd01e80b Mon Sep 17 00:00:00 2001 From: Evgeny Taktarov Date: Thu, 23 May 2024 12:35:24 +0700 Subject: [PATCH 11/13] fix: disable calldata suffix for ledger --- features/stake/stake-form/use-stake.ts | 10 ++++++++-- shared/hooks/useIsLedgerLive.ts | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/features/stake/stake-form/use-stake.ts b/features/stake/stake-form/use-stake.ts index 1a3ffa6e5..dd5a1e849 100644 --- a/features/stake/stake-form/use-stake.ts +++ b/features/stake/stake-form/use-stake.ts @@ -1,5 +1,6 @@ import { BigNumber } from 'ethers'; import { useCallback } from 'react'; +import { useConnectorInfo } from 'reef-knot/core-react'; import { useWeb3 } from 'reef-knot/web3-react'; import invariant from 'tiny-invariant'; @@ -35,6 +36,10 @@ export const useStake = ({ onConfirm, onRetry }: StakeOptions) => { const { staticRpcProvider } = useCurrentStaticRpcProvider(); const { providerWeb3, providerRpc } = useSDK(); const { txModalStages } = useTxModalStagesStake(); + const { isLedgerLive, isLedger } = useConnectorInfo(); + + // modifying calldata brakes clear sign + const shouldApplyCalldataSuffix = !isLedger && !isLedgerLive; return useCallback( async ({ amount, referral }: StakeArguments): Promise => { @@ -84,7 +89,7 @@ export const useStake = ({ onConfirm, onRetry }: StakeOptions) => { overrides, ); - applyCalldataSuffix(tx); + if (shouldApplyCalldataSuffix) applyCalldataSuffix(tx); const originalGasLimit = await providerWeb3.estimateGas(tx); const gasLimit = applyGasLimitRatio(originalGasLimit); @@ -130,10 +135,11 @@ export const useStake = ({ onConfirm, onRetry }: StakeOptions) => { account, providerWeb3, stethContractWeb3, - providerRpc, txModalStages, + providerRpc, onConfirm, staticRpcProvider, + shouldApplyCalldataSuffix, onRetry, ], ); diff --git a/shared/hooks/useIsLedgerLive.ts b/shared/hooks/useIsLedgerLive.ts index 50ff9a0b1..525c250b0 100644 --- a/shared/hooks/useIsLedgerLive.ts +++ b/shared/hooks/useIsLedgerLive.ts @@ -1,4 +1,4 @@ -import { useConnectorInfo } from 'reef-knot/web3-react'; +import { useConnectorInfo } from 'reef-knot/core-react'; import { useAppFlag } from 'providers/app-flag'; export const useIsLedgerLive = () => { From 78976a90c5e6c7b63390bef3fd218e1b6886790a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Apr 2024 18:56:33 +0000 Subject: [PATCH 12/13] chore(deps): bump @solana/web3.js from 1.89.1 to 1.91.6 Bumps [@solana/web3.js](https://github.com/solana-labs/solana-web3.js) from 1.89.1 to 1.91.6. - [Release notes](https://github.com/solana-labs/solana-web3.js/releases) - [Commits](https://github.com/solana-labs/solana-web3.js/compare/v1.89.1...v1.91.6) --- updated-dependencies: - dependency-name: "@solana/web3.js" dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5999403b3..8e74363a1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2429,11 +2429,16 @@ dependencies: "@noble/hashes" "1.3.3" -"@noble/hashes@1.3.3", "@noble/hashes@^1.3.2": +"@noble/hashes@1.3.3": version "1.3.3" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.3.tgz#39908da56a4adc270147bb07968bf3b16cfe1699" integrity sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA== +"@noble/hashes@^1.3.3": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" + integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg== + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -2793,13 +2798,13 @@ buffer "~6.0.3" "@solana/web3.js@^1.70.1": - version "1.89.1" - resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.89.1.tgz#52df6820f2d088c4558aa359af40580a03d10ec9" - integrity sha512-t9TTLtPQxtQB3SAf/5E8xPXfVDsC6WGOsgKY02l2cbe0HLymT7ynE8Hu48Lk5qynHCquj6nhISfEHcjMkYpu/A== + version "1.91.6" + resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.91.6.tgz#c090661c344cbc61e6cdeb0da67d3ea80d5848e1" + integrity sha512-dm20nN6HQvXToo+kM51nxHdtaa2wMSRdeK37p+WIWESfeiVHqV8XbV4XnWupq6ngt5vIckhGFG7ZnTBxUgLzDA== dependencies: "@babel/runtime" "^7.23.4" "@noble/curves" "^1.2.0" - "@noble/hashes" "^1.3.2" + "@noble/hashes" "^1.3.3" "@solana/buffer-layout" "^4.0.1" agentkeepalive "^4.5.0" bigint-buffer "^1.1.5" From 84be585216688ab6465f1a825fd366f8e0387f2a Mon Sep 17 00:00:00 2001 From: Evgeny Taktarov Date: Tue, 7 May 2024 14:41:14 +0700 Subject: [PATCH 13/13] fix: ref param not parsing --- .../stake-form-context/stake-form-context.tsx | 11 ++++++----- pages/index.tsx | 5 +++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/features/stake/stake-form/stake-form-context/stake-form-context.tsx b/features/stake/stake-form/stake-form-context/stake-form-context.tsx index ca7d189c1..0a0d6dd1c 100644 --- a/features/stake/stake-form/stake-form-context/stake-form-context.tsx +++ b/features/stake/stake-form/stake-form-context/stake-form-context.tsx @@ -151,7 +151,6 @@ const useStakeFormNetworkData = (): StakeFormNetworkData => { // Data provider // export const StakeFormProvider: FC = ({ children }) => { - const router = useRouter(); const networkData = useStakeFormNetworkData(); const validationContextPromise = useStakeFormValidationContext(networkData); @@ -168,22 +167,24 @@ export const StakeFormProvider: FC = ({ children }) => { // consumes amount query param // SSG safe + const { isReady, query, pathname, replace } = useRouter(); useEffect(() => { - if (!router.isReady) return; + if (!isReady) return; try { - const { amount, ref, ...rest } = router.query; + const { amount, ref, ...rest } = query; + if (typeof ref === 'string') { setValue('referral', ref); } if (typeof amount === 'string') { - void router.replace({ pathname: router.pathname, query: rest }); + void replace({ pathname, query: rest }); const amountBN = parseEther(amount); setValue('amount', amountBN); } } catch { //noop } - }, [router, setValue]); + }, [isReady, pathname, query, replace, setValue]); const { retryEvent, retryFire } = useFormControllerRetry(); diff --git a/pages/index.tsx b/pages/index.tsx index 1d106536b..3cea362e5 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -2,5 +2,10 @@ import { config } from 'config'; import { StakePage } from 'features/stake'; import { HomePageIpfs } from 'features/ipfs'; +import { GetStaticProps } from 'next'; + +export const getStaticProps: GetStaticProps = async () => { + return { props: {} }; +}; export default config.ipfsMode ? HomePageIpfs : StakePage;