forked from Uniswap/interface
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(widgets): support wrapping native assets (Uniswap#3301)
* feat(widgets): support wrapping native assets * integrate wrap with swapInfo, start a useWrapCallback hook * add loading state * add pending state to (un)wrap transactions * final cleanup * janky merge conflict fix--disregard! this will change * fixed * 💢 * pr feedback * z's pr feedback * pr feedback * zzmp pr feedback * zzmp pr feedback
- Loading branch information
1 parent
2863971
commit 5a1ef8f
Showing
13 changed files
with
306 additions
and
40 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
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,22 @@ | ||
import { Trans } from '@lingui/macro' | ||
import { WrapError } from 'lib/hooks/swap/useWrapCallback' | ||
import useNativeCurrency from 'lib/hooks/useNativeCurrency' | ||
|
||
export function WrapErrorText({ wrapError }: { wrapError: WrapError }) { | ||
const native = useNativeCurrency() | ||
const wrapped = native?.wrapped | ||
|
||
switch (wrapError) { | ||
case WrapError.ENTER_NATIVE_AMOUNT: | ||
return <Trans>Enter {native?.symbol} amount</Trans> | ||
case WrapError.ENTER_WRAPPED_AMOUNT: | ||
return <Trans>Enter {wrapped?.symbol} amount</Trans> | ||
case WrapError.INSUFFICIENT_NATIVE_BALANCE: | ||
return <Trans>Insufficient {native?.symbol} balance</Trans> | ||
case WrapError.INSUFFICIENT_WRAPPED_BALANCE: | ||
return <Trans>Insufficient {wrapped?.symbol} balance</Trans> | ||
case WrapError.NO_ERROR: | ||
default: | ||
return null | ||
} | ||
} |
Oops, something went wrong.