Skip to content

Commit

Permalink
sale status
Browse files Browse the repository at this point in the history
  • Loading branch information
Szegoo committed Aug 19, 2024
1 parent 8389826 commit c5c36ad
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/contexts/sales/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { getBlockTime, getBlockTimestamp } from '@/utils/functions';
import { getCorePriceAt, getCurrentPhase } from '@/utils/sale';

import {
BrokerStatus,
ContextStatus,
PhaseEndpoints,
RELAY_CHAIN_BLOCK_TIME,
Expand All @@ -21,6 +22,7 @@ interface SaleData {
status: ContextStatus;
saleInfo: SaleInfo;
config: SaleConfig;
saleStatus: BrokerStatus;
phase: SalePhaseInfo;
fetchSaleInfo: () => void;
}
Expand Down Expand Up @@ -61,10 +63,19 @@ const defaultSalePhase = {
endpoints: defaultEndpoints,
};

const defaultSaleStatus: BrokerStatus = {
coreCount: 0,
lastCommittedTimeslice: 0,
lastTimeslice: 0,
privatePoolSize: 0,
systemPoolSize: 0
};

const defaultSaleData: SaleData = {
status: ContextStatus.UNINITIALIZED,
saleInfo: defaultSaleInfo,
config: defaultSaleConfig,
saleStatus: defaultSaleStatus,
phase: defaultSalePhase,
fetchSaleInfo: () => {
/** */
Expand All @@ -89,6 +100,7 @@ const SaleInfoProvider = ({ children }: Props) => {
} = useRelayApi();

const [saleInfo, setSaleInfo] = useState<SaleInfo>(defaultSaleData.saleInfo);
const [saleStatus, setSaleStatus] = useState<BrokerStatus>(defaultSaleData.saleStatus);
const [config, setConfig] = useState<SaleConfig>(defaultSaleData.config);

const [status, setStatus] = useState(ContextStatus.UNINITIALIZED);
Expand Down Expand Up @@ -194,6 +206,7 @@ const SaleInfoProvider = ({ children }: Props) => {
status,
saleInfo,
config,
saleStatus,
phase: {
currentPhase,
currentPrice,
Expand Down

0 comments on commit c5c36ad

Please sign in to comment.