diff --git a/scripts/development.dump b/scripts/development.dump index 4617b589d..41f6b0281 100644 Binary files a/scripts/development.dump and b/scripts/development.dump differ diff --git a/src/entities/Proposal/utils.ts b/src/entities/Proposal/utils.ts index f71c5d99d..1114ba42f 100644 --- a/src/entities/Proposal/utils.ts +++ b/src/entities/Proposal/utils.ts @@ -6,12 +6,10 @@ import { import 'isomorphic-fetch' import numeral from 'numeral' -import { Governance } from '../../clients/Governance' import { GOVERNANCE_URL } from '../../constants' -import { getEnumDisplayName } from '../../helpers' import { getTile } from '../../utils/Land' import Time from '../../utils/date/Time' -import { SNAPSHOT_SPACE, SNAPSHOT_URL } from '../Snapshot/constants' +import { SNAPSHOT_URL } from '../Snapshot/constants' import { isSameAddress } from '../Snapshot/utils' import { UpdateAttributes } from '../Updates/types' import { DISCOURSE_API } from '../User/utils' @@ -19,16 +17,12 @@ import { VotesForProposals } from '../Votes/types' import { MAX_NAME_SIZE, MIN_NAME_SIZE } from './constants' import { - CatalystType, - PoiType, PriorityProposal, PriorityProposalType, ProposalAttributes, ProposalStatus, ProposalType, SortingOrder, - isCatalystType, - isPoiType, isProposalType, isSortingOrder, } from './types' @@ -51,14 +45,6 @@ export function isValidName(name: string) { return REGEX_NAME.test(name) } -export function isValidDomainName(domain: string) { - return new RegExp('^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$').test(domain) -} - -export async function isValidImage(imageUrl: string) { - return await Governance.get().checkImage(imageUrl) -} - export function isAlreadyBannedName(name: string) { return !!getNameDenylistFromCache('mainnet').find( (bannedName: string) => bannedName.toLowerCase() === name.toLowerCase() @@ -136,12 +122,6 @@ export function forumUrl( return target.toString() } -export function forumUserUrl(username: string) { - const target = new URL(DISCOURSE_API || '') - target.pathname = `/u/${username}` - return target.toString() -} - export function governanceUrl(pathname = '') { const target = new URL(GOVERNANCE_URL) target.pathname = `/governance${pathname}` @@ -158,29 +138,10 @@ export function proposalUrl(id: ProposalAttributes['id']) { return target.toString() } -export const EDIT_DELEGATE_SNAPSHOT_URL = snapshotUrl(`#/delegate/${SNAPSHOT_SPACE}`) - -export function userModifiedForm(stateValue?: Record, initialState?: Record) { - if (!stateValue || !initialState) { - return false - } - const isInitialState = JSON.stringify(stateValue) === JSON.stringify(initialState) - return !isInitialState && Object.values(stateValue).some((value) => !!value) -} - -export function isProposalInCliffPeriod(enactedDate: number) { - const now = Time.utc() - return Time.unix(enactedDate).add(CLIFF_PERIOD_IN_DAYS, 'day').isAfter(now) -} - export function isGovernanceProcessProposal(type: ProposalType) { return type === ProposalType.Poll || type === ProposalType.Draft || type === ProposalType.Governance } -export function isBiddingAndTenderingProposal(type: ProposalType) { - return type === ProposalType.Pitch || type === ProposalType.Tender || type === ProposalType.Bid -} - export function isProposalStatus(value: string | null | undefined): boolean { switch (value) { case ProposalStatus.Pending: @@ -209,18 +170,10 @@ export function toProposalStatus(value: string | null | undefined, orEls return toCustomType(value, isProposalStatus, orElse) } -export function toCatalystType(value: string | null | undefined, orElse: () => OrElse) { - return toCustomType(value, isCatalystType, orElse) -} - export function toProposalType(value: string | null | undefined, orElse: () => OrElse) { return toCustomType(value, isProposalType, orElse) } -export function toPoiType(value: string | null | undefined, orElse: () => OrElse) { - return toCustomType(value, isPoiType, orElse) -} - export function toSortingOrder(value: string | null | undefined, orElse: () => OrElse) { return toCustomType(value, isSortingOrder, orElse) } @@ -245,10 +198,6 @@ export function getProposalEndDate(duration: number) { return Time.utc().set('seconds', 0).add(duration, 'seconds').toDate() } -export function getProposalStatusShortName(status: ProposalStatus) { - return status === ProposalStatus.OutOfBudget ? 'OOB' : getEnumDisplayName(status) -} - export function isGrantProposalSubmitEnabled(now: number) { const ENABLE_START_DATE = Time.utc('2023-03-01').add(8, 'hour') return !Time(now).isBefore(ENABLE_START_DATE) @@ -272,18 +221,6 @@ export function hasTenderProcessStarted(tenderProposals?: ProposalAttributes[]) return !!tenderProposals && tenderProposals.length > 0 && Time(tenderProposals[0].start_at).isBefore(Time()) } -export function getBudget(proposal: ProposalAttributes) { - const { type, configuration } = proposal - switch (type) { - case ProposalType.Grant: - return Number(configuration.size) - case ProposalType.Bid: - return Number(configuration.funding) - default: - return null - } -} - export function getDisplayedPriorityProposals( votes?: VotesForProposals, priorityProposals?: PriorityProposal[],