Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
aritroCoder committed Dec 10, 2023
2 parents 9f1e296 + 34e47b2 commit eea8011
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/site/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ const Index = () => {
const [isAccountLogin, setIsAccountLogin] = useState(false);
const [open, setOpen] = useState(false);
const [txnHistory, setTxnHistory] = useState([]);
const [txncCronJobActive, setTxnCronJobActive] = useState(false);

const milliToDate = (milli: any) => {
const monthNames = [
Expand All @@ -214,6 +215,14 @@ const Index = () => {
setOpen(!open);
};

const transactionCronJob = () => {
const interval = setInterval( async () => {
const getTxn = await sendTxnHistory();
setTxnHistory(getTxn.txnHistory);
}, 5000);
console.log(interval);
}

const openSendModal = () => {
setIsSendModalOpen(true);
};
Expand Down Expand Up @@ -375,6 +384,10 @@ const Index = () => {
const getTxn = await sendTxnHistory();
setTxnHistory(getTxn.txnHistory);
toggleOpen();
if (!txncCronJobActive) {
transactionCronJob();
setTxnCronJobActive(true);
}
} catch (error) {
console.error(error);
dispatch({ type: MetamaskActions.SetError, payload: error });
Expand Down

0 comments on commit eea8011

Please sign in to comment.