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
2ffc8a0b
Unverified
Commit
2ffc8a0b
authored
Apr 10, 2023
by
Tina
Committed by
GitHub
Apr 10, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: Remove SWAP_TRANSACTION_COMPLETED event (#6328)
remove swap completed event
parent
5ec9cdc5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
52 deletions
+1
-52
updater.tsx
src/state/transactions/updater.tsx
+1
-52
No files found.
src/state/transactions/updater.tsx
View file @
2ffc8a0b
import
{
sendAnalyticsEvent
}
from
'
@uniswap/analytics
'
import
{
SwapEventName
}
from
'
@uniswap/analytics-events
'
import
{
Currency
,
Percent
,
TradeType
}
from
'
@uniswap/sdk-core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
DEFAULT_TXN_DISMISS_MS
,
L2_TXN_DISMISS_MS
}
from
'
constants/misc
'
import
{
DEFAULT_TXN_DISMISS_MS
,
L2_TXN_DISMISS_MS
}
from
'
constants/misc
'
import
LibUpdater
from
'
lib/hooks/transactions/updater
'
import
LibUpdater
from
'
lib/hooks/transactions/updater
'
import
{
formatPercentInBasisPointsNumber
,
formatToDecimal
,
getTokenAddress
}
from
'
lib/utils/analytics
'
import
{
useCallback
,
useMemo
}
from
'
react
'
import
{
useCallback
,
useMemo
}
from
'
react
'
import
{
useAppDispatch
,
useAppSelector
}
from
'
state/hooks
'
import
{
useAppDispatch
,
useAppSelector
}
from
'
state/hooks
'
import
{
InterfaceTrade
}
from
'
state/routing/types
'
import
{
TransactionType
}
from
'
state/transactions/types
'
import
{
computeRealizedPriceImpact
}
from
'
utils/prices
'
import
{
L2_CHAIN_IDS
}
from
'
../../constants/chains
'
import
{
L2_CHAIN_IDS
}
from
'
../../constants/chains
'
import
{
useDerivedSwapInfo
}
from
'
../../state/swap/hooks
'
import
{
useAddPopup
}
from
'
../application/hooks
'
import
{
useAddPopup
}
from
'
../application/hooks
'
import
{
checkedTransaction
,
finalizeTransaction
}
from
'
./reducer
'
import
{
checkedTransaction
,
finalizeTransaction
}
from
'
./reducer
'
import
{
SerializableTransactionReceipt
}
from
'
./types
'
import
{
SerializableTransactionReceipt
}
from
'
./types
'
interface
AnalyticsEventProps
{
trade
:
InterfaceTrade
<
Currency
,
Currency
,
TradeType
>
hash
:
string
|
undefined
allowedSlippage
:
Percent
succeeded
:
boolean
}
const
formatAnalyticsEventProperties
=
({
trade
,
hash
,
allowedSlippage
,
succeeded
}:
AnalyticsEventProps
)
=>
({
estimated_network_fee_usd
:
trade
.
gasUseEstimateUSD
?
formatToDecimal
(
trade
.
gasUseEstimateUSD
,
2
)
:
undefined
,
transaction_hash
:
hash
,
token_in_address
:
getTokenAddress
(
trade
.
inputAmount
.
currency
),
token_out_address
:
getTokenAddress
(
trade
.
outputAmount
.
currency
),
token_in_symbol
:
trade
.
inputAmount
.
currency
.
symbol
,
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
),
price_impact_basis_points
:
formatPercentInBasisPointsNumber
(
computeRealizedPriceImpact
(
trade
)),
allowed_slippage_basis_points
:
formatPercentInBasisPointsNumber
(
allowedSlippage
),
chain_id
:
trade
.
inputAmount
.
currency
.
chainId
===
trade
.
outputAmount
.
currency
.
chainId
?
trade
.
inputAmount
.
currency
.
chainId
:
undefined
,
swap_quote_block_number
:
trade
.
blockNumber
,
succeeded
,
})
export
default
function
Updater
()
{
export
default
function
Updater
()
{
const
{
chainId
}
=
useWeb3React
()
const
{
chainId
}
=
useWeb3React
()
const
addPopup
=
useAddPopup
()
const
addPopup
=
useAddPopup
()
// speed up popup dismisall time if on L2
// speed up popup dismisall time if on L2
const
isL2
=
Boolean
(
chainId
&&
L2_CHAIN_IDS
.
includes
(
chainId
))
const
isL2
=
Boolean
(
chainId
&&
L2_CHAIN_IDS
.
includes
(
chainId
))
const
transactions
=
useAppSelector
((
state
)
=>
state
.
transactions
)
const
transactions
=
useAppSelector
((
state
)
=>
state
.
transactions
)
const
{
trade
:
{
trade
},
allowedSlippage
,
}
=
useDerivedSwapInfo
()
const
dispatch
=
useAppDispatch
()
const
dispatch
=
useAppDispatch
()
const
onCheck
=
useCallback
(
const
onCheck
=
useCallback
(
...
@@ -79,19 +41,6 @@ export default function Updater() {
...
@@ -79,19 +41,6 @@ export default function Updater() {
})
})
)
)
const
tx
=
transactions
[
chainId
]?.[
hash
]
if
(
tx
.
info
.
type
===
TransactionType
.
SWAP
&&
trade
)
{
sendAnalyticsEvent
(
SwapEventName
.
SWAP_TRANSACTION_COMPLETED
,
formatAnalyticsEventProperties
({
trade
,
hash
,
allowedSlippage
,
succeeded
:
receipt
.
status
===
1
,
})
)
}
addPopup
(
addPopup
(
{
{
txn
:
{
hash
},
txn
:
{
hash
},
...
@@ -100,7 +49,7 @@ export default function Updater() {
...
@@ -100,7 +49,7 @@ export default function Updater() {
isL2
?
L2_TXN_DISMISS_MS
:
DEFAULT_TXN_DISMISS_MS
isL2
?
L2_TXN_DISMISS_MS
:
DEFAULT_TXN_DISMISS_MS
)
)
},
},
[
addPopup
,
allowedSlippage
,
dispatch
,
isL2
,
trade
,
transactions
]
[
addPopup
,
dispatch
,
isL2
]
)
)
const
pendingTransactions
=
useMemo
(()
=>
(
chainId
?
transactions
[
chainId
]
??
{}
:
{}),
[
chainId
,
transactions
])
const
pendingTransactions
=
useMemo
(()
=>
(
chainId
?
transactions
[
chainId
]
??
{}
:
{}),
[
chainId
,
transactions
])
...
...
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