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
8eb86442
Unverified
Commit
8eb86442
authored
Oct 25, 2021
by
Justin Domingue
Committed by
GitHub
Oct 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor monitoring (#2682)
parent
af833996
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
57 additions
and
57 deletions
+57
-57
index.tsx
src/components/WalletModal/index.tsx
+3
-3
useMonitoringEventCallback.ts
src/hooks/useMonitoringEventCallback.ts
+47
-20
useSwapCallback.tsx
src/hooks/useSwapCallback.tsx
+1
-16
index.tsx
src/pages/AddLiquidity/index.tsx
+0
-4
index.tsx
src/pages/AddLiquidityV2/index.tsx
+0
-4
V3.tsx
src/pages/RemoveLiquidity/V3.tsx
+0
-5
index.tsx
src/pages/RemoveLiquidity/index.tsx
+0
-4
hooks.tsx
src/state/transactions/hooks.tsx
+6
-1
No files found.
src/components/WalletModal/index.tsx
View file @
8eb86442
...
@@ -5,7 +5,7 @@ import { WalletConnectConnector } from '@web3-react/walletconnect-connector'
...
@@ -5,7 +5,7 @@ import { WalletConnectConnector } from '@web3-react/walletconnect-connector'
import
{
AutoColumn
}
from
'
components/Column
'
import
{
AutoColumn
}
from
'
components/Column
'
import
{
PrivacyPolicy
}
from
'
components/PrivacyPolicy
'
import
{
PrivacyPolicy
}
from
'
components/PrivacyPolicy
'
import
Row
,
{
AutoRow
,
RowBetween
}
from
'
components/Row
'
import
Row
,
{
AutoRow
,
RowBetween
}
from
'
components/Row
'
import
{
useMonitoringEventCallback
}
from
'
hooks/useMonitoringEventCallback
'
import
{
use
WalletConnect
MonitoringEventCallback
}
from
'
hooks/useMonitoringEventCallback
'
import
{
useEffect
,
useState
}
from
'
react
'
import
{
useEffect
,
useState
}
from
'
react
'
import
{
ArrowLeft
,
ArrowRight
,
Info
}
from
'
react-feather
'
import
{
ArrowLeft
,
ArrowRight
,
Info
}
from
'
react-feather
'
import
ReactGA
from
'
react-ga
'
import
ReactGA
from
'
react-ga
'
...
@@ -151,7 +151,7 @@ export default function WalletModal({
...
@@ -151,7 +151,7 @@ export default function WalletModal({
const
previousAccount
=
usePrevious
(
account
)
const
previousAccount
=
usePrevious
(
account
)
const
logMonitoringEvent
=
useMonitoringEventCallback
()
const
logMonitoringEvent
=
use
WalletConnect
MonitoringEventCallback
()
// close on connection, when logged out before
// close on connection, when logged out before
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -203,7 +203,7 @@ export default function WalletModal({
...
@@ -203,7 +203,7 @@ export default function WalletModal({
activate
(
connector
,
undefined
,
true
)
activate
(
connector
,
undefined
,
true
)
.
then
(
async
()
=>
{
.
then
(
async
()
=>
{
const
walletAddress
=
await
connector
.
getAccount
()
const
walletAddress
=
await
connector
.
getAccount
()
logMonitoringEvent
(
'
wallet connected
'
,
{
walletAddress
})
logMonitoringEvent
({
walletAddress
})
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
if
(
error
instanceof
UnsupportedChainIdError
)
{
if
(
error
instanceof
UnsupportedChainIdError
)
{
...
...
src/hooks/useMonitoringEventCallback.ts
View file @
8eb86442
...
@@ -2,33 +2,34 @@ import { TransactionResponse } from '@ethersproject/providers'
...
@@ -2,33 +2,34 @@ import { TransactionResponse } from '@ethersproject/providers'
import
{
initializeApp
}
from
'
firebase/app
'
import
{
initializeApp
}
from
'
firebase/app
'
import
{
getDatabase
,
push
,
ref
}
from
'
firebase/database
'
import
{
getDatabase
,
push
,
ref
}
from
'
firebase/database
'
import
{
useCallback
}
from
'
react
'
import
{
useCallback
}
from
'
react
'
import
{
TransactionInfo
,
TransactionType
}
from
'
state/transactions/actions
'
import
{
useActiveWeb3React
}
from
'
./web3
'
import
{
useActiveWeb3React
}
from
'
./web3
'
type
MonitoringEvent
=
type
PartialTransactionResponse
=
Pick
<
TransactionResponse
,
'
hash
'
|
'
v
'
|
'
r
'
|
'
s
'
>
|
'
wallet connected
'
|
'
swap
'
|
'
add liquidity/v3
'
|
'
add liquidity/v2
'
|
'
remove liquidity/v3
'
|
'
remove liquidity/v2
'
const
FIREBASE_API_KEY
=
process
.
env
.
REACT_APP_FIREBASE_KEY
const
SUPPORTED_TRANSACTION_TYPES
=
[
TransactionType
.
ADD_LIQUIDITY_V2_POOL
,
TransactionType
.
ADD_LIQUIDITY_V3_POOL
,
TransactionType
.
CREATE_V3_POOL
,
TransactionType
.
REMOVE_LIQUIDITY_V3
,
TransactionType
.
SWAP
,
]
const
FIREBASE_API_KEY
=
process
.
env
.
REACT_APP_FIREBASE_KEY
const
firebaseEnabled
=
typeof
FIREBASE_API_KEY
!==
'
undefined
'
const
firebaseEnabled
=
typeof
FIREBASE_API_KEY
!==
'
undefined
'
if
(
firebaseEnabled
)
initializeFirebase
()
if
(
firebaseEnabled
)
initializeFirebase
()
export
function
useMonitoringEventCallback
()
{
function
useMonitoringEventCallback
()
{
const
{
account
,
chainId
}
=
useActiveWeb3React
()
const
{
chainId
}
=
useActiveWeb3React
()
return
useCallback
(
return
useCallback
(
async
function
log
(
async
function
log
(
type
:
MonitoringEvent
,
type
:
string
,
{
{
transactionResponse
,
transactionResponse
,
walletAddress
=
account
,
walletAddress
,
}:
{
transactionResponse
?:
TransactionResponse
;
walletAddress
?:
typeof
account
}
}:
{
transactionResponse
?:
PartialTransactionResponse
;
walletAddress
:
string
|
undefined
}
)
{
)
{
if
(
!
firebaseEnabled
)
return
if
(
!
firebaseEnabled
)
return
...
@@ -42,12 +43,8 @@ export function useMonitoringEventCallback() {
...
@@ -42,12 +43,8 @@ export function useMonitoringEventCallback() {
push
(
ref
(
db
,
'
trm
'
),
{
push
(
ref
(
db
,
'
trm
'
),
{
chainId
,
chainId
,
origin
:
location
.
origin
,
origin
:
location
.
origin
,
tx
:
transactionResponse
?
(({
hash
,
v
,
r
,
s
}:
Pick
<
TransactionResponse
,
'
hash
'
|
'
v
'
|
'
r
'
|
'
s
'
>
)
=>
({
hash
,
v
,
r
,
s
}))(
transactionResponse
)
:
undefined
,
timestamp
:
Date
.
now
(),
timestamp
:
Date
.
now
(),
tx
:
transactionResponse
,
type
,
type
,
walletAddress
,
walletAddress
,
})
})
...
@@ -55,7 +52,37 @@ export function useMonitoringEventCallback() {
...
@@ -55,7 +52,37 @@ export function useMonitoringEventCallback() {
console
.
debug
(
'
Error adding document:
'
,
e
)
console
.
debug
(
'
Error adding document:
'
,
e
)
}
}
},
},
[
account
,
chainId
]
[
chainId
]
)
}
export
function
useTransactionMonitoringEventCallback
()
{
const
{
account
}
=
useActiveWeb3React
()
const
log
=
useMonitoringEventCallback
()
return
useCallback
(
(
info
:
TransactionInfo
,
transactionResponse
:
TransactionResponse
)
=>
{
if
(
SUPPORTED_TRANSACTION_TYPES
.
includes
(
info
.
type
))
{
log
(
TransactionType
[
info
.
type
],
{
transactionResponse
:
(({
hash
,
v
,
r
,
s
}:
PartialTransactionResponse
)
=>
({
hash
,
v
,
r
,
s
}))(
transactionResponse
),
walletAddress
:
account
??
undefined
,
})
}
},
[
account
,
log
]
)
}
export
function
useWalletConnectMonitoringEventCallback
()
{
const
log
=
useMonitoringEventCallback
()
return
useCallback
(
(
walletAddress
)
=>
{
log
(
'
WALLET_CONNECTED
'
,
{
walletAddress
})
},
[
log
]
)
)
}
}
...
...
src/hooks/useSwapCallback.tsx
View file @
8eb86442
...
@@ -17,7 +17,6 @@ import { useArgentWalletContract } from './useArgentWalletContract'
...
@@ -17,7 +17,6 @@ import { useArgentWalletContract } from './useArgentWalletContract'
import
{
useV2RouterContract
}
from
'
./useContract
'
import
{
useV2RouterContract
}
from
'
./useContract
'
import
useENS
from
'
./useENS
'
import
useENS
from
'
./useENS
'
import
{
SignatureData
}
from
'
./useERC20Permit
'
import
{
SignatureData
}
from
'
./useERC20Permit
'
import
{
useMonitoringEventCallback
}
from
'
./useMonitoringEventCallback
'
import
useTransactionDeadline
from
'
./useTransactionDeadline
'
import
useTransactionDeadline
from
'
./useTransactionDeadline
'
import
{
useActiveWeb3React
}
from
'
./web3
'
import
{
useActiveWeb3React
}
from
'
./web3
'
...
@@ -279,8 +278,6 @@ export function useSwapCallback(
...
@@ -279,8 +278,6 @@ export function useSwapCallback(
const
addTransaction
=
useTransactionAdder
()
const
addTransaction
=
useTransactionAdder
()
const
logMonitoringEvent
=
useMonitoringEventCallback
()
const
{
address
:
recipientAddress
}
=
useENS
(
recipientAddressOrName
)
const
{
address
:
recipientAddress
}
=
useENS
(
recipientAddressOrName
)
const
recipient
=
recipientAddressOrName
===
null
?
account
:
recipientAddress
const
recipient
=
recipientAddressOrName
===
null
?
account
:
recipientAddress
...
@@ -394,7 +391,6 @@ export function useSwapCallback(
...
@@ -394,7 +391,6 @@ export function useSwapCallback(
expectedInputCurrencyAmountRaw
:
trade
.
inputAmount
.
quotient
.
toString
(),
expectedInputCurrencyAmountRaw
:
trade
.
inputAmount
.
quotient
.
toString
(),
}
}
)
)
logMonitoringEvent
(
'
swap
'
,
{
transactionResponse
:
response
})
return
response
.
hash
return
response
.
hash
})
})
...
@@ -412,16 +408,5 @@ export function useSwapCallback(
...
@@ -412,16 +408,5 @@ export function useSwapCallback(
},
},
error
:
null
,
error
:
null
,
}
}
},
[
},
[
trade
,
library
,
account
,
chainId
,
recipient
,
recipientAddressOrName
,
swapCalls
,
addTransaction
,
allowedSlippage
])
trade
,
library
,
account
,
chainId
,
recipient
,
recipientAddressOrName
,
swapCalls
,
addTransaction
,
allowedSlippage
,
logMonitoringEvent
,
])
}
}
src/pages/AddLiquidity/index.tsx
View file @
8eb86442
...
@@ -5,7 +5,6 @@ import { Currency, CurrencyAmount, Percent } from '@uniswap/sdk-core'
...
@@ -5,7 +5,6 @@ import { Currency, CurrencyAmount, Percent } from '@uniswap/sdk-core'
import
{
FeeAmount
,
NonfungiblePositionManager
}
from
'
@uniswap/v3-sdk
'
import
{
FeeAmount
,
NonfungiblePositionManager
}
from
'
@uniswap/v3-sdk
'
import
DowntimeWarning
from
'
components/DowntimeWarning
'
import
DowntimeWarning
from
'
components/DowntimeWarning
'
import
UnsupportedCurrencyFooter
from
'
components/swap/UnsupportedCurrencyFooter
'
import
UnsupportedCurrencyFooter
from
'
components/swap/UnsupportedCurrencyFooter
'
import
{
useMonitoringEventCallback
}
from
'
hooks/useMonitoringEventCallback
'
import
{
useCallback
,
useContext
,
useEffect
,
useState
}
from
'
react
'
import
{
useCallback
,
useContext
,
useEffect
,
useState
}
from
'
react
'
import
{
AlertTriangle
}
from
'
react-feather
'
import
{
AlertTriangle
}
from
'
react-feather
'
import
ReactGA
from
'
react-ga
'
import
ReactGA
from
'
react-ga
'
...
@@ -90,8 +89,6 @@ export default function AddLiquidity({
...
@@ -90,8 +89,6 @@ export default function AddLiquidity({
const
addTransaction
=
useTransactionAdder
()
const
addTransaction
=
useTransactionAdder
()
const
positionManager
=
useV3NFTPositionManagerContract
()
const
positionManager
=
useV3NFTPositionManagerContract
()
const
logMonitoringEvent
=
useMonitoringEventCallback
()
// check for existing position if tokenId in url
// check for existing position if tokenId in url
const
{
position
:
existingPositionDetails
,
loading
:
positionLoading
}
=
useV3PositionFromTokenId
(
const
{
position
:
existingPositionDetails
,
loading
:
positionLoading
}
=
useV3PositionFromTokenId
(
tokenId
?
BigNumber
.
from
(
tokenId
)
:
undefined
tokenId
?
BigNumber
.
from
(
tokenId
)
:
undefined
...
@@ -348,7 +345,6 @@ export default function AddLiquidity({
...
@@ -348,7 +345,6 @@ export default function AddLiquidity({
action
:
'
Add
'
,
action
:
'
Add
'
,
label
:
[
currencies
[
Field
.
CURRENCY_A
]?.
symbol
,
currencies
[
Field
.
CURRENCY_B
]?.
symbol
].
join
(
'
/
'
),
label
:
[
currencies
[
Field
.
CURRENCY_A
]?.
symbol
,
currencies
[
Field
.
CURRENCY_B
]?.
symbol
].
join
(
'
/
'
),
})
})
logMonitoringEvent
(
'
add liquidity/v3
'
,
{
transactionResponse
:
response
})
})
})
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
...
...
src/pages/AddLiquidityV2/index.tsx
View file @
8eb86442
...
@@ -4,7 +4,6 @@ import { Trans } from '@lingui/macro'
...
@@ -4,7 +4,6 @@ import { Trans } from '@lingui/macro'
import
{
Currency
,
CurrencyAmount
,
Percent
}
from
'
@uniswap/sdk-core
'
import
{
Currency
,
CurrencyAmount
,
Percent
}
from
'
@uniswap/sdk-core
'
import
UnsupportedCurrencyFooter
from
'
components/swap/UnsupportedCurrencyFooter
'
import
UnsupportedCurrencyFooter
from
'
components/swap/UnsupportedCurrencyFooter
'
import
{
SwitchLocaleLink
}
from
'
components/SwitchLocaleLink
'
import
{
SwitchLocaleLink
}
from
'
components/SwitchLocaleLink
'
import
{
useMonitoringEventCallback
}
from
'
hooks/useMonitoringEventCallback
'
import
{
useCallback
,
useContext
,
useState
}
from
'
react
'
import
{
useCallback
,
useContext
,
useState
}
from
'
react
'
import
{
Plus
}
from
'
react-feather
'
import
{
Plus
}
from
'
react-feather
'
import
ReactGA
from
'
react-ga
'
import
ReactGA
from
'
react-ga
'
...
@@ -57,8 +56,6 @@ export default function AddLiquidity({
...
@@ -57,8 +56,6 @@ export default function AddLiquidity({
const
{
account
,
chainId
,
library
}
=
useActiveWeb3React
()
const
{
account
,
chainId
,
library
}
=
useActiveWeb3React
()
const
theme
=
useContext
(
ThemeContext
)
const
theme
=
useContext
(
ThemeContext
)
const
logMonitoringEvent
=
useMonitoringEventCallback
()
const
currencyA
=
useCurrency
(
currencyIdA
)
const
currencyA
=
useCurrency
(
currencyIdA
)
const
currencyB
=
useCurrency
(
currencyIdB
)
const
currencyB
=
useCurrency
(
currencyIdB
)
...
@@ -206,7 +203,6 @@ export default function AddLiquidity({
...
@@ -206,7 +203,6 @@ export default function AddLiquidity({
action
:
'
Add
'
,
action
:
'
Add
'
,
label
:
[
currencies
[
Field
.
CURRENCY_A
]?.
symbol
,
currencies
[
Field
.
CURRENCY_B
]?.
symbol
].
join
(
'
/
'
),
label
:
[
currencies
[
Field
.
CURRENCY_A
]?.
symbol
,
currencies
[
Field
.
CURRENCY_B
]?.
symbol
].
join
(
'
/
'
),
})
})
logMonitoringEvent
(
'
add liquidity/v2
'
,
{
transactionResponse
:
response
})
})
})
)
)
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
...
...
src/pages/RemoveLiquidity/V3.tsx
View file @
8eb86442
...
@@ -19,7 +19,6 @@ import Toggle from 'components/Toggle'
...
@@ -19,7 +19,6 @@ import Toggle from 'components/Toggle'
import
{
SupportedChainId
}
from
'
constants/chains
'
import
{
SupportedChainId
}
from
'
constants/chains
'
import
{
useV3NFTPositionManagerContract
}
from
'
hooks/useContract
'
import
{
useV3NFTPositionManagerContract
}
from
'
hooks/useContract
'
import
useDebouncedChangeHandler
from
'
hooks/useDebouncedChangeHandler
'
import
useDebouncedChangeHandler
from
'
hooks/useDebouncedChangeHandler
'
import
{
useMonitoringEventCallback
}
from
'
hooks/useMonitoringEventCallback
'
import
useTheme
from
'
hooks/useTheme
'
import
useTheme
from
'
hooks/useTheme
'
import
useTransactionDeadline
from
'
hooks/useTransactionDeadline
'
import
useTransactionDeadline
from
'
hooks/useTransactionDeadline
'
import
{
useV3PositionFromTokenId
}
from
'
hooks/useV3Positions
'
import
{
useV3PositionFromTokenId
}
from
'
hooks/useV3Positions
'
...
@@ -69,8 +68,6 @@ function Remove({ tokenId }: { tokenId: BigNumber }) {
...
@@ -69,8 +68,6 @@ function Remove({ tokenId }: { tokenId: BigNumber }) {
const
theme
=
useTheme
()
const
theme
=
useTheme
()
const
{
account
,
chainId
,
library
}
=
useActiveWeb3React
()
const
{
account
,
chainId
,
library
}
=
useActiveWeb3React
()
const
logMonitoringEvent
=
useMonitoringEventCallback
()
// flag for receiving WETH
// flag for receiving WETH
const
[
receiveWETH
,
setReceiveWETH
]
=
useState
(
false
)
const
[
receiveWETH
,
setReceiveWETH
]
=
useState
(
false
)
...
@@ -155,7 +152,6 @@ function Remove({ tokenId }: { tokenId: BigNumber }) {
...
@@ -155,7 +152,6 @@ function Remove({ tokenId }: { tokenId: BigNumber }) {
action
:
'
RemoveV3
'
,
action
:
'
RemoveV3
'
,
label
:
[
liquidityValue0
.
currency
.
symbol
,
liquidityValue1
.
currency
.
symbol
].
join
(
'
/
'
),
label
:
[
liquidityValue0
.
currency
.
symbol
,
liquidityValue1
.
currency
.
symbol
].
join
(
'
/
'
),
})
})
logMonitoringEvent
(
'
remove liquidity/v3
'
,
{
transactionResponse
:
response
})
setTxnHash
(
response
.
hash
)
setTxnHash
(
response
.
hash
)
setAttemptingTxn
(
false
)
setAttemptingTxn
(
false
)
addTransaction
(
response
,
{
addTransaction
(
response
,
{
...
@@ -185,7 +181,6 @@ function Remove({ tokenId }: { tokenId: BigNumber }) {
...
@@ -185,7 +181,6 @@ function Remove({ tokenId }: { tokenId: BigNumber }) {
library
,
library
,
tokenId
,
tokenId
,
allowedSlippage
,
allowedSlippage
,
logMonitoringEvent
,
addTransaction
,
addTransaction
,
])
])
...
...
src/pages/RemoveLiquidity/index.tsx
View file @
8eb86442
...
@@ -3,7 +3,6 @@ import { Contract } from '@ethersproject/contracts'
...
@@ -3,7 +3,6 @@ import { Contract } from '@ethersproject/contracts'
import
{
TransactionResponse
}
from
'
@ethersproject/providers
'
import
{
TransactionResponse
}
from
'
@ethersproject/providers
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Currency
,
Percent
}
from
'
@uniswap/sdk-core
'
import
{
Currency
,
Percent
}
from
'
@uniswap/sdk-core
'
import
{
useMonitoringEventCallback
}
from
'
hooks/useMonitoringEventCallback
'
import
{
useCallback
,
useContext
,
useMemo
,
useState
}
from
'
react
'
import
{
useCallback
,
useContext
,
useMemo
,
useState
}
from
'
react
'
import
{
ArrowDown
,
Plus
}
from
'
react-feather
'
import
{
ArrowDown
,
Plus
}
from
'
react-feather
'
import
ReactGA
from
'
react-ga
'
import
ReactGA
from
'
react-ga
'
...
@@ -58,8 +57,6 @@ export default function RemoveLiquidity({
...
@@ -58,8 +57,6 @@ export default function RemoveLiquidity({
const
theme
=
useContext
(
ThemeContext
)
const
theme
=
useContext
(
ThemeContext
)
const
logMonitoringEvent
=
useMonitoringEventCallback
()
// toggle wallet when disconnected
// toggle wallet when disconnected
const
toggleWalletModal
=
useWalletModalToggle
()
const
toggleWalletModal
=
useWalletModalToggle
()
...
@@ -283,7 +280,6 @@ export default function RemoveLiquidity({
...
@@ -283,7 +280,6 @@ export default function RemoveLiquidity({
action
:
'
Remove
'
,
action
:
'
Remove
'
,
label
:
[
currencyA
.
symbol
,
currencyB
.
symbol
].
join
(
'
/
'
),
label
:
[
currencyA
.
symbol
,
currencyB
.
symbol
].
join
(
'
/
'
),
})
})
logMonitoringEvent
(
'
remove liquidity/v2
'
,
{
transactionResponse
:
response
})
})
})
.
catch
((
error
:
Error
)
=>
{
.
catch
((
error
:
Error
)
=>
{
setAttemptingTxn
(
false
)
setAttemptingTxn
(
false
)
...
...
src/state/transactions/hooks.tsx
View file @
8eb86442
import
{
TransactionResponse
}
from
'
@ethersproject/providers
'
import
{
TransactionResponse
}
from
'
@ethersproject/providers
'
import
{
useTransactionMonitoringEventCallback
}
from
'
hooks/useMonitoringEventCallback
'
import
{
useCallback
,
useMemo
}
from
'
react
'
import
{
useCallback
,
useMemo
}
from
'
react
'
import
{
useAppDispatch
,
useAppSelector
}
from
'
state/hooks
'
import
{
useAppDispatch
,
useAppSelector
}
from
'
state/hooks
'
...
@@ -11,6 +12,8 @@ export function useTransactionAdder(): (response: TransactionResponse, info: Tra
...
@@ -11,6 +12,8 @@ export function useTransactionAdder(): (response: TransactionResponse, info: Tra
const
{
chainId
,
account
}
=
useActiveWeb3React
()
const
{
chainId
,
account
}
=
useActiveWeb3React
()
const
dispatch
=
useAppDispatch
()
const
dispatch
=
useAppDispatch
()
const
logMonitoringEvent
=
useTransactionMonitoringEventCallback
()
return
useCallback
(
return
useCallback
(
(
response
:
TransactionResponse
,
info
:
TransactionInfo
)
=>
{
(
response
:
TransactionResponse
,
info
:
TransactionInfo
)
=>
{
if
(
!
account
)
return
if
(
!
account
)
return
...
@@ -21,8 +24,10 @@ export function useTransactionAdder(): (response: TransactionResponse, info: Tra
...
@@ -21,8 +24,10 @@ export function useTransactionAdder(): (response: TransactionResponse, info: Tra
throw
Error
(
'
No transaction hash found.
'
)
throw
Error
(
'
No transaction hash found.
'
)
}
}
dispatch
(
addTransaction
({
hash
,
from
:
account
,
info
,
chainId
}))
dispatch
(
addTransaction
({
hash
,
from
:
account
,
info
,
chainId
}))
logMonitoringEvent
(
info
,
response
)
},
},
[
dispatch
,
chainId
,
accou
nt
]
[
account
,
chainId
,
dispatch
,
logMonitoringEve
nt
]
)
)
}
}
...
...
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