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
4d446236
Unverified
Commit
4d446236
authored
Sep 02, 2022
by
lynn
Committed by
GitHub
Sep 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: add back usd volume to swap submitted from ui instead of infura hook (#4563)
* init * typo
parent
6fe5d436
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
3 deletions
+33
-3
ConfirmSwapModal.tsx
src/components/swap/ConfirmSwapModal.tsx
+18
-2
SwapModalFooter.tsx
src/components/swap/SwapModalFooter.tsx
+13
-1
index.tsx
src/pages/Swap/index.tsx
+2
-0
No files found.
src/components/swap/ConfirmSwapModal.tsx
View file @
4d446236
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trade
}
from
'
@uniswap/router-sdk
'
import
{
Currency
,
Percent
,
TradeType
}
from
'
@uniswap/sdk-core
'
import
{
Currency
,
CurrencyAmount
,
Percent
,
Token
,
TradeType
}
from
'
@uniswap/sdk-core
'
import
{
ModalName
}
from
'
components/AmplitudeAnalytics/constants
'
import
{
Trace
}
from
'
components/AmplitudeAnalytics/Trace
'
import
{
ReactNode
,
useCallback
,
useMemo
,
useState
}
from
'
react
'
...
...
@@ -27,6 +27,8 @@ export default function ConfirmSwapModal({
attemptingTxn
,
txHash
,
swapQuoteReceivedDate
,
fiatValueInput
,
fiatValueOutput
,
}:
{
isOpen
:
boolean
trade
:
InterfaceTrade
<
Currency
,
Currency
,
TradeType
>
|
undefined
...
...
@@ -40,6 +42,8 @@ export default function ConfirmSwapModal({
swapErrorMessage
:
ReactNode
|
undefined
onDismiss
:
()
=>
void
swapQuoteReceivedDate
:
Date
|
undefined
fiatValueInput
?:
CurrencyAmount
<
Token
>
|
null
fiatValueOutput
?:
CurrencyAmount
<
Token
>
|
null
})
{
// shouldLogModalCloseEvent lets the child SwapModalHeader component know when modal has been closed
// and an event triggered by modal closing should be logged.
...
...
@@ -78,9 +82,21 @@ export default function ConfirmSwapModal({
disabledConfirm=
{
showAcceptChanges
}
swapErrorMessage=
{
swapErrorMessage
}
swapQuoteReceivedDate=
{
swapQuoteReceivedDate
}
fiatValueInput=
{
fiatValueInput
}
fiatValueOutput=
{
fiatValueOutput
}
/>
)
:
null
},
[
onConfirm
,
showAcceptChanges
,
swapErrorMessage
,
trade
,
allowedSlippage
,
txHash
,
swapQuoteReceivedDate
])
},
[
onConfirm
,
showAcceptChanges
,
swapErrorMessage
,
trade
,
allowedSlippage
,
txHash
,
swapQuoteReceivedDate
,
fiatValueInput
,
fiatValueOutput
,
])
// text to show while loading
const
pendingText
=
(
...
...
src/components/swap/SwapModalFooter.tsx
View file @
4d446236
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Currency
,
Percent
,
TradeType
}
from
'
@uniswap/sdk-core
'
import
{
Currency
,
CurrencyAmount
,
Percent
,
Token
,
TradeType
}
from
'
@uniswap/sdk-core
'
import
{
ElementName
,
Event
,
EventName
}
from
'
components/AmplitudeAnalytics/constants
'
import
{
TraceEvent
}
from
'
components/AmplitudeAnalytics/TraceEvent
'
import
{
...
...
@@ -31,6 +31,8 @@ interface AnalyticsEventProps {
isAutoRouterApi
:
boolean
swapQuoteReceivedDate
:
Date
|
undefined
routes
:
RoutingDiagramEntry
[]
fiatValueInput
?:
CurrencyAmount
<
Token
>
|
null
fiatValueOutput
?:
CurrencyAmount
<
Token
>
|
null
}
const
formatRoutesEventProperties
=
(
routes
:
RoutingDiagramEntry
[])
=>
{
...
...
@@ -69,6 +71,8 @@ const formatAnalyticsEventProperties = ({
isAutoRouterApi
,
swapQuoteReceivedDate
,
routes
,
fiatValueInput
,
fiatValueOutput
,
}:
AnalyticsEventProps
)
=>
({
estimated_network_fee_usd
:
trade
.
gasUseEstimateUSD
?
formatToDecimal
(
trade
.
gasUseEstimateUSD
,
2
)
:
undefined
,
transaction_hash
:
hash
,
...
...
@@ -79,6 +83,8 @@ const formatAnalyticsEventProperties = ({
token_out_symbol
:
trade
.
outputAmount
.
currency
.
symbol
,
token_in_amount
:
formatToDecimal
(
trade
.
inputAmount
,
trade
.
inputAmount
.
currency
.
decimals
),
token_out_amount
:
formatToDecimal
(
trade
.
outputAmount
,
trade
.
outputAmount
.
currency
.
decimals
),
token_in_amount_usd
:
fiatValueInput
?
parseFloat
(
fiatValueInput
.
toFixed
(
2
))
:
undefined
,
token_out_amount_usd
:
fiatValueOutput
?
parseFloat
(
fiatValueOutput
.
toFixed
(
2
))
:
undefined
,
price_impact_basis_points
:
formatPercentInBasisPointsNumber
(
computeRealizedPriceImpact
(
trade
)),
allowed_slippage_basis_points
:
formatPercentInBasisPointsNumber
(
allowedSlippage
),
is_auto_router_api
:
isAutoRouterApi
,
...
...
@@ -102,6 +108,8 @@ export default function SwapModalFooter({
swapErrorMessage
,
disabledConfirm
,
swapQuoteReceivedDate
,
fiatValueInput
,
fiatValueOutput
,
}:
{
trade
:
InterfaceTrade
<
Currency
,
Currency
,
TradeType
>
hash
:
string
|
undefined
...
...
@@ -110,6 +118,8 @@ export default function SwapModalFooter({
swapErrorMessage
:
ReactNode
|
undefined
disabledConfirm
:
boolean
swapQuoteReceivedDate
:
Date
|
undefined
fiatValueInput
?:
CurrencyAmount
<
Token
>
|
null
fiatValueOutput
?:
CurrencyAmount
<
Token
>
|
null
})
{
const
transactionDeadlineSecondsSinceEpoch
=
useTransactionDeadline
()?.
toNumber
()
// in seconds since epoch
const
isAutoSlippage
=
useUserSlippageTolerance
()[
0
]
===
'
auto
'
...
...
@@ -132,6 +142,8 @@ export default function SwapModalFooter({
isAutoRouterApi
:
!
clientSideRouter
,
swapQuoteReceivedDate
,
routes
,
fiatValueInput
,
fiatValueOutput
,
})
}
>
<
ButtonError
...
...
src/pages/Swap/index.tsx
View file @
4d446236
...
...
@@ -542,6 +542,8 @@ export default function Swap() {
swapErrorMessage=
{
swapErrorMessage
}
onDismiss=
{
handleConfirmDismiss
}
swapQuoteReceivedDate=
{
swapQuoteReceivedDate
}
fiatValueInput=
{
fiatValueInput
}
fiatValueOutput=
{
fiatValueOutput
}
/>
<
AutoColumn
gap=
{
'
0px
'
}
>
...
...
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