Skip to content

Commit e018f62

Browse files
committed
wip
1 parent e4690e3 commit e018f62

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

packages/core/src/hooks/useractions/useCheckAccStatus.tsx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const useCheckActiveStatus = <C extends FeeInfo>({
4646
chargeFeeTokenList: C[]
4747
checkFeeIsEnough: (props?: { isRequiredAPI: true; intervalTime?: number }) => void
4848
}): { checkActiveStatusProps: CheckActiveStatusProps<C> } => {
49-
const { account } = useAccount()
49+
const { account, updateAccount } = useAccount()
5050
const { status: walletLayer2Status, updateWalletLayer2 } = useWalletLayer2()
5151
// const { chainInfos } = onchainHashInfo.useOnChainInfo();
5252
// const nodeTimer = React.useRef<NodeJS.Timeout | -1>(-1);
@@ -73,6 +73,7 @@ export const useCheckActiveStatus = <C extends FeeInfo>({
7373
setShowActiveAccount({ isShow: true })
7474
}
7575
const onIKnowClick = async () => {
76+
const { account } = store.getState()
7677
const [walletType, coinbaseSW] = await Promise.all([
7778
LoopringAPI?.walletAPI?.getWalletType({
7879
wallet: account.accAddress,
@@ -122,16 +123,7 @@ export const useCheckActiveStatus = <C extends FeeInfo>({
122123
walletLayer2Callback()
123124
checkFeeIsEnough()
124125
}
125-
checkFeeIsEnoughInterval.current = setInterval(() => {
126-
updateWalletLayer2()
127-
walletLayer2Callback()
128-
checkFeeIsEnough()
129-
}, 10 * 1000)
130-
return () => {
131-
if (checkFeeIsEnoughInterval.current !== -1) {
132-
clearInterval(checkFeeIsEnoughInterval.current)
133-
}
134-
}
126+
135127
}, [walletLayer2Status])
136128

137129

@@ -155,6 +147,17 @@ export const useCheckActiveStatus = <C extends FeeInfo>({
155147
if (isShowAccount.isShow && isShowAccount.step === AccountStep.CheckingActive) {
156148
init()
157149
setKnow(false)
150+
checkFeeIsEnoughInterval.current = setInterval(() => {
151+
updateWalletLayer2()
152+
walletLayer2Callback()
153+
checkFeeIsEnough()
154+
updateAccount({})
155+
}, 10 * 1000)
156+
}
157+
return () => {
158+
if (checkFeeIsEnoughInterval.current !== -1) {
159+
clearInterval(checkFeeIsEnoughInterval.current)
160+
}
158161
}
159162
}, [isShowAccount.step, isShowAccount.isShow])
160163

0 commit comments

Comments
 (0)