-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github.com:lidofinance/ethereum-staking-wid…
…get into feature/si-1228-return-1inch-to-aggregators
- Loading branch information
Showing
44 changed files
with
1,232 additions
and
1,052 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
export const STANDARD_GAS_LIMIT = 21000; | ||
import { BigNumber } from 'ethers'; | ||
|
||
export const WSTETH_APPROVE_GAS_LIMIT = 78000; | ||
export const WSTETH_APPROVE_GAS_LIMIT = BigNumber.from(78000); | ||
|
||
export const WRAP_FROM_ETH_GAS_LIMIT = 100000; | ||
export const WRAP_GAS_LIMIT = 140000; | ||
export const WRAP_GAS_LIMIT_GOERLI = 120000; | ||
export const UNWRAP_GAS_LIMIT = 115000; | ||
export const WRAP_FROM_ETH_GAS_LIMIT = BigNumber.from(100000); | ||
export const WRAP_GAS_LIMIT = BigNumber.from(140000); | ||
export const WRAP_GAS_LIMIT_GOERLI = BigNumber.from(120000); | ||
export const UNWRAP_GAS_LIMIT = BigNumber.from(115000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
features/withdrawals/claim/form/requests-list/requests-empty.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,30 @@ | ||
import { parseEther } from '@ethersproject/units'; | ||
import { BigNumber } from 'ethers'; | ||
import { useMemo } from 'react'; | ||
import { useContractSWR, useWSTETHContractRPC } from '@lido-sdk/react'; | ||
|
||
import { useStethByWsteth } from 'shared/hooks'; | ||
import { isValidEtherValue } from 'utils/isValidEtherValue'; | ||
import { STRATEGY_LAZY } from 'utils/swrStrategies'; | ||
|
||
type useEthAmountByInputProps = { | ||
isSteth: boolean; | ||
input?: string; | ||
amount: BigNumber | null; | ||
}; | ||
|
||
export const useEthAmountByStethWsteth = ({ | ||
isSteth, | ||
input, | ||
amount, | ||
}: useEthAmountByInputProps) => { | ||
const isValidValue = | ||
input && !isNaN(Number(input)) && isValidEtherValue(input); | ||
const inputBN = useMemo( | ||
() => (isValidValue ? parseEther(input) : BigNumber.from(0)), | ||
[input, isValidValue], | ||
); | ||
const wsteth = isSteth ? null : amount; | ||
const { data: stethByWstethBalance, loading } = useContractSWR({ | ||
contract: useWSTETHContractRPC(), | ||
method: 'getStETHByWstETH', | ||
params: [wsteth], | ||
shouldFetch: !!wsteth, | ||
config: STRATEGY_LAZY, | ||
}); | ||
|
||
const stethByWstethBalance = useStethByWsteth(isSteth ? undefined : inputBN); | ||
|
||
if (!isValidValue) return undefined; | ||
if (isSteth) return inputBN; | ||
return stethByWstethBalance; | ||
if (isSteth) | ||
return { | ||
amount: amount ?? undefined, | ||
loading: false, | ||
}; | ||
else return { amount: stethByWstethBalance, loading }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.