Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
5bc21beb
Unverified
Commit
5bc21beb
authored
Feb 08, 2022
by
Ian Lapham
Committed by
GitHub
Feb 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update summary details (#3254)
parent
c3d67274
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
9 deletions
+30
-9
Details.tsx
src/lib/components/Swap/Summary/Details.tsx
+25
-4
index.tsx
src/lib/components/Swap/Summary/index.tsx
+5
-5
No files found.
src/lib/components/Swap/Summary/Details.tsx
View file @
5bc21beb
...
@@ -10,7 +10,7 @@ import styled, { Color, ThemedText } from 'lib/theme'
...
@@ -10,7 +10,7 @@ import styled, { Color, ThemedText } from 'lib/theme'
import
{
useMemo
}
from
'
react
'
import
{
useMemo
}
from
'
react
'
import
{
currencyId
}
from
'
utils/currencyId
'
import
{
currencyId
}
from
'
utils/currencyId
'
import
{
formatCurrencyAmount
}
from
'
utils/formatCurrencyAmount
'
import
{
formatCurrencyAmount
}
from
'
utils/formatCurrencyAmount
'
import
{
computeRealizedPriceImpact
}
from
'
utils/prices
'
import
{
computeRealized
LPFeeAmount
,
computeRealized
PriceImpact
}
from
'
utils/prices
'
import
Row
from
'
../../Row
'
import
Row
from
'
../../Row
'
...
@@ -47,6 +47,8 @@ export default function Details({ trade, allowedSlippage }: DetailsProps) {
...
@@ -47,6 +47,8 @@ export default function Details({ trade, allowedSlippage }: DetailsProps) {
const
outputCurrency
=
outputAmount
.
currency
const
outputCurrency
=
outputAmount
.
currency
const
priceImpact
=
useMemo
(()
=>
computeRealizedPriceImpact
(
trade
),
[
trade
])
const
priceImpact
=
useMemo
(()
=>
computeRealizedPriceImpact
(
trade
),
[
trade
])
const
lpFeeAmount
=
useMemo
(()
=>
computeRealizedLPFeeAmount
(
trade
),
[
trade
])
const
integrator
=
window
.
location
.
hostname
const
integrator
=
window
.
location
.
hostname
const
feeOptions
=
useAtomValue
(
feeOptionsAtom
)
const
feeOptions
=
useAtomValue
(
feeOptionsAtom
)
...
@@ -71,12 +73,20 @@ export default function Details({ trade, allowedSlippage }: DetailsProps) {
...
@@ -71,12 +73,20 @@ export default function Details({ trade, allowedSlippage }: DetailsProps) {
}
}
rows
.
push
(
priceImpactRow
)
rows
.
push
(
priceImpactRow
)
if
(
trade
.
tradeType
===
TradeType
.
EXACT_INPUT
)
{
if
(
lpFeeAmount
)
{
const
localizedFeeAmount
=
formatCurrencyAmount
(
lpFeeAmount
,
6
,
i18n
.
locale
)
rows
.
push
([
t
`Liquidity provider fee`
,
`
${
localizedFeeAmount
}
${
inputCurrency
.
symbol
||
currencyId
(
inputCurrency
)}
`
,
])
}
if
(
trade
.
tradeType
===
TradeType
.
EXACT_OUTPUT
)
{
const
localizedMaxSent
=
formatCurrencyAmount
(
trade
.
maximumAmountIn
(
allowedSlippage
),
6
,
i18n
.
locale
)
const
localizedMaxSent
=
formatCurrencyAmount
(
trade
.
maximumAmountIn
(
allowedSlippage
),
6
,
i18n
.
locale
)
rows
.
push
([
t
`Maximum sent`
,
`
${
localizedMaxSent
}
${
inputCurrency
.
symbol
}
`
])
rows
.
push
([
t
`Maximum sent`
,
`
${
localizedMaxSent
}
${
inputCurrency
.
symbol
}
`
])
}
}
if
(
trade
.
tradeType
===
TradeType
.
EXACT_
OUT
PUT
)
{
if
(
trade
.
tradeType
===
TradeType
.
EXACT_
IN
PUT
)
{
const
localizedMaxSent
=
formatCurrencyAmount
(
trade
.
minimumAmountOut
(
allowedSlippage
),
6
,
i18n
.
locale
)
const
localizedMaxSent
=
formatCurrencyAmount
(
trade
.
minimumAmountOut
(
allowedSlippage
),
6
,
i18n
.
locale
)
rows
.
push
([
t
`Minimum received`
,
`
${
localizedMaxSent
}
${
outputCurrency
.
symbol
}
`
])
rows
.
push
([
t
`Minimum received`
,
`
${
localizedMaxSent
}
${
outputCurrency
.
symbol
}
`
])
}
}
...
@@ -88,7 +98,18 @@ export default function Details({ trade, allowedSlippage }: DetailsProps) {
...
@@ -88,7 +98,18 @@ export default function Details({ trade, allowedSlippage }: DetailsProps) {
rows
.
push
(
slippageToleranceRow
)
rows
.
push
(
slippageToleranceRow
)
return
rows
return
rows
},
[
allowedSlippage
,
feeOptions
,
inputCurrency
,
integrator
,
i18n
,
outputAmount
,
outputCurrency
,
priceImpact
,
trade
])
},
[
feeOptions
,
priceImpact
,
lpFeeAmount
,
trade
,
allowedSlippage
,
outputAmount
,
i18n
.
locale
,
integrator
,
outputCurrency
,
inputCurrency
,
])
return
(
return
(
<>
<>
{
details
.
map
(([
label
,
detail
,
color
])
=>
(
{
details
.
map
(([
label
,
detail
,
color
])
=>
(
...
...
src/lib/components/Swap/Summary/index.tsx
View file @
5bc21beb
...
@@ -151,15 +151,15 @@ export function SummaryDialog({ trade, allowedSlippage, onConfirm }: SummaryDial
...
@@ -151,15 +151,15 @@ export function SummaryDialog({ trade, allowedSlippage, onConfirm }: SummaryDial
<
Trans
>
Output is estimated.
</
Trans
>
<
Trans
>
Output is estimated.
</
Trans
>
{
independentField
===
Field
.
INPUT
&&
(
{
independentField
===
Field
.
INPUT
&&
(
<
Trans
>
<
Trans
>
You will send at most
{
formatCurrencyAmount
(
trade
.
maximumAmountIn
(
allowedSlippage
),
6
,
i18n
.
locale
)
}{
'
'
}
You will receive at least
{
'
'
}
{
inputCurrency
.
symbol
}
or the transaction will revert.
{
formatCurrencyAmount
(
trade
.
minimumAmountOut
(
allowedSlippage
),
6
,
i18n
.
locale
)
}
{
outputCurrency
.
symbol
}{
'
'
}
or the transaction will revert.
</
Trans
>
</
Trans
>
)
}
)
}
{
independentField
===
Field
.
OUTPUT
&&
(
{
independentField
===
Field
.
OUTPUT
&&
(
<
Trans
>
<
Trans
>
You will receive at least
{
'
'
}
You will send at most
{
formatCurrencyAmount
(
trade
.
maximumAmountIn
(
allowedSlippage
),
6
,
i18n
.
locale
)
}{
'
'
}
{
formatCurrencyAmount
(
trade
.
minimumAmountOut
(
allowedSlippage
),
6
,
i18n
.
locale
)
}
{
outputCurrency
.
symbol
}{
'
'
}
{
inputCurrency
.
symbol
}
or the transaction will revert.
or the transaction will revert.
</
Trans
>
</
Trans
>
)
}
)
}
</
Estimate
>
</
Estimate
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment