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
77a6d158
Unverified
Commit
77a6d158
authored
Nov 14, 2022
by
Zach Pomerantz
Committed by
GitHub
Nov 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: imperatively send SwapSigned (#5207)
parent
28be15ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
12 deletions
+10
-12
ConfirmSwapModal.tsx
src/components/swap/ConfirmSwapModal.tsx
+3
-12
useSwapCallback.tsx
src/hooks/useSwapCallback.tsx
+7
-0
No files found.
src/components/swap/ConfirmSwapModal.tsx
View file @
77a6d158
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
sendAnalyticsEvent
,
Trace
}
from
'
@uniswap/analytics
'
import
{
Trace
}
from
'
@uniswap/analytics
'
import
{
EventName
,
ModalName
}
from
'
@uniswap/analytics-events
'
import
{
ModalName
}
from
'
@uniswap/analytics-events
'
import
{
Trade
}
from
'
@uniswap/router-sdk
'
import
{
Trade
}
from
'
@uniswap/router-sdk
'
import
{
Currency
,
CurrencyAmount
,
Percent
,
Token
,
TradeType
}
from
'
@uniswap/sdk-core
'
import
{
Currency
,
CurrencyAmount
,
Percent
,
Token
,
TradeType
}
from
'
@uniswap/sdk-core
'
import
{
formatSwapSignedAnalyticsEventProperties
}
from
'
lib/utils/analytics
'
import
{
ReactNode
,
useCallback
,
useMemo
,
useState
}
from
'
react
'
import
{
ReactNode
,
useCallback
,
useEffect
,
useMemo
,
useState
}
from
'
react
'
import
{
InterfaceTrade
}
from
'
state/routing/types
'
import
{
InterfaceTrade
}
from
'
state/routing/types
'
import
{
tradeMeaningfullyDiffers
}
from
'
utils/tradeMeaningFullyDiffer
'
import
{
tradeMeaningfullyDiffers
}
from
'
utils/tradeMeaningFullyDiffer
'
...
@@ -49,7 +48,6 @@ export default function ConfirmSwapModal({
...
@@ -49,7 +48,6 @@ export default function ConfirmSwapModal({
// shouldLogModalCloseEvent lets the child SwapModalHeader component know when modal has been closed
// shouldLogModalCloseEvent lets the child SwapModalHeader component know when modal has been closed
// and an event triggered by modal closing should be logged.
// and an event triggered by modal closing should be logged.
const
[
shouldLogModalCloseEvent
,
setShouldLogModalCloseEvent
]
=
useState
(
false
)
const
[
shouldLogModalCloseEvent
,
setShouldLogModalCloseEvent
]
=
useState
(
false
)
const
[
lastTxnHashLogged
,
setLastTxnHashLogged
]
=
useState
<
string
|
null
>
(
null
)
const
showAcceptChanges
=
useMemo
(
const
showAcceptChanges
=
useMemo
(
()
=>
Boolean
(
trade
&&
originalTrade
&&
tradeMeaningfullyDiffers
(
trade
,
originalTrade
)),
()
=>
Boolean
(
trade
&&
originalTrade
&&
tradeMeaningfullyDiffers
(
trade
,
originalTrade
)),
[
originalTrade
,
trade
]
[
originalTrade
,
trade
]
...
@@ -123,13 +121,6 @@ export default function ConfirmSwapModal({
...
@@ -123,13 +121,6 @@ export default function ConfirmSwapModal({
[
onModalDismiss
,
modalBottom
,
modalHeader
,
swapErrorMessage
]
[
onModalDismiss
,
modalBottom
,
modalHeader
,
swapErrorMessage
]
)
)
useEffect
(()
=>
{
if
(
!
attemptingTxn
&&
isOpen
&&
txHash
&&
trade
&&
txHash
!==
lastTxnHashLogged
)
{
sendAnalyticsEvent
(
EventName
.
SWAP_SIGNED
,
formatSwapSignedAnalyticsEventProperties
({
trade
,
txHash
}))
setLastTxnHashLogged
(
txHash
)
}
},
[
attemptingTxn
,
isOpen
,
txHash
,
trade
,
lastTxnHashLogged
])
return
(
return
(
<
Trace
modal=
{
ModalName
.
CONFIRM_SWAP
}
>
<
Trace
modal=
{
ModalName
.
CONFIRM_SWAP
}
>
<
TransactionConfirmationModal
<
TransactionConfirmationModal
...
...
src/hooks/useSwapCallback.tsx
View file @
77a6d158
// eslint-disable-next-line no-restricted-imports
// eslint-disable-next-line no-restricted-imports
import
{
sendAnalyticsEvent
}
from
'
@uniswap/analytics
'
import
{
EventName
}
from
'
@uniswap/analytics-events
'
import
{
Trade
}
from
'
@uniswap/router-sdk
'
import
{
Trade
}
from
'
@uniswap/router-sdk
'
import
{
Currency
,
Percent
,
TradeType
}
from
'
@uniswap/sdk-core
'
import
{
Currency
,
Percent
,
TradeType
}
from
'
@uniswap/sdk-core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
SwapCallbackState
,
useSwapCallback
as
useLibSwapCallBack
}
from
'
lib/hooks/swap/useSwapCallback
'
import
{
SwapCallbackState
,
useSwapCallback
as
useLibSwapCallBack
}
from
'
lib/hooks/swap/useSwapCallback
'
import
{
formatSwapSignedAnalyticsEventProperties
}
from
'
lib/utils/analytics
'
import
{
ReactNode
,
useMemo
}
from
'
react
'
import
{
ReactNode
,
useMemo
}
from
'
react
'
import
{
useTransactionAdder
}
from
'
../state/transactions/hooks
'
import
{
useTransactionAdder
}
from
'
../state/transactions/hooks
'
...
@@ -47,6 +50,10 @@ export function useSwapCallback(
...
@@ -47,6 +50,10 @@ export function useSwapCallback(
}
}
return
()
=>
return
()
=>
libCallback
().
then
((
response
)
=>
{
libCallback
().
then
((
response
)
=>
{
sendAnalyticsEvent
(
EventName
.
SWAP_SIGNED
,
formatSwapSignedAnalyticsEventProperties
({
trade
,
txHash
:
response
.
hash
})
)
addTransaction
(
addTransaction
(
response
,
response
,
trade
.
tradeType
===
TradeType
.
EXACT_INPUT
trade
.
tradeType
===
TradeType
.
EXACT_INPUT
...
...
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