@lifi/widget
Version:
LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.
12 lines (11 loc) • 612 B
JavaScript
import { shallow } from 'zustand/shallow';
import { hasEnumFlag } from '../../utils';
import { useRouteExecutionStore } from './RouteExecutionStore';
import { RouteExecutionStatus } from './types';
export const useTransactionHistory = (address) => {
return useRouteExecutionStore((state) => Object.values(state.routes)
.filter((item) => item?.route.fromAddress === address &&
hasEnumFlag(item.status, RouteExecutionStatus.Done))
.sort((a, b) => (b?.route.steps[0].execution?.process[0].startedAt ?? 0) -
(a?.route.steps[0].execution?.process[0].startedAt ?? 0)), shallow);
};