added type for binary resolution
This commit is contained in:
parent
6dab3c4e29
commit
dfec5ed8fa
|
@ -71,7 +71,7 @@ export type Binary = {
|
||||||
outcomeType: 'BINARY'
|
outcomeType: 'BINARY'
|
||||||
initialProbability: number
|
initialProbability: number
|
||||||
resolutionProbability?: number // Used for BINARY markets resolved to MKT
|
resolutionProbability?: number // Used for BINARY markets resolved to MKT
|
||||||
resolution?: 'YES' | 'NO' | 'MKT' | 'CANCEL'
|
resolution?: resolution
|
||||||
}
|
}
|
||||||
|
|
||||||
export type FreeResponse = {
|
export type FreeResponse = {
|
||||||
|
@ -91,6 +91,7 @@ export type Numeric = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type outcomeType = AnyOutcomeType['outcomeType']
|
export type outcomeType = AnyOutcomeType['outcomeType']
|
||||||
|
export type resolution = 'YES' | 'NO' | 'MKT' | 'CANCEL'
|
||||||
export const OUTCOME_TYPES = ['BINARY', 'FREE_RESPONSE', 'NUMERIC'] as const
|
export const OUTCOME_TYPES = ['BINARY', 'FREE_RESPONSE', 'NUMERIC'] as const
|
||||||
export const MAX_QUESTION_LENGTH = 480
|
export const MAX_QUESTION_LENGTH = 480
|
||||||
export const MAX_DESCRIPTION_LENGTH = 10000
|
export const MAX_DESCRIPTION_LENGTH = 10000
|
||||||
|
|
|
@ -3,13 +3,13 @@ import { ReactNode } from 'react'
|
||||||
import { Answer } from 'common/answer'
|
import { Answer } from 'common/answer'
|
||||||
import { getProbability } from 'common/calculate'
|
import { getProbability } from 'common/calculate'
|
||||||
import { getValueFromBucket } from 'common/calculate-dpm'
|
import { getValueFromBucket } from 'common/calculate-dpm'
|
||||||
import { BinaryContract, Contract, FreeResponseContract } from 'common/contract'
|
import { BinaryContract, Contract, FreeResponseContract, resolution } from 'common/contract'
|
||||||
import { formatPercent } from 'common/util/format'
|
import { formatPercent } from 'common/util/format'
|
||||||
import { ClientRender } from './client-render'
|
import { ClientRender } from './client-render'
|
||||||
|
|
||||||
export function OutcomeLabel(props: {
|
export function OutcomeLabel(props: {
|
||||||
contract: Contract
|
contract: Contract
|
||||||
outcome: 'YES' | 'NO' | 'CANCEL' | 'MKT' | string
|
outcome: resolution | string
|
||||||
truncate: 'short' | 'long' | 'none'
|
truncate: 'short' | 'long' | 'none'
|
||||||
value?: number
|
value?: number
|
||||||
}) {
|
}) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { resolveMarket } from 'web/lib/firebase/fn-call'
|
||||||
import { ProbabilitySelector } from './probability-selector'
|
import { ProbabilitySelector } from './probability-selector'
|
||||||
import { DPM_CREATOR_FEE } from 'common/fees'
|
import { DPM_CREATOR_FEE } from 'common/fees'
|
||||||
import { getProbability } from 'common/calculate'
|
import { getProbability } from 'common/calculate'
|
||||||
import { BinaryContract } from 'common/contract'
|
import { BinaryContract, resolution } from 'common/contract'
|
||||||
import { formatMoney } from 'common/util/format'
|
import { formatMoney } from 'common/util/format'
|
||||||
|
|
||||||
export function ResolutionPanel(props: {
|
export function ResolutionPanel(props: {
|
||||||
|
@ -31,7 +31,7 @@ export function ResolutionPanel(props: {
|
||||||
: `${formatMoney(contract.collectedFees.creatorFee)} in fees`
|
: `${formatMoney(contract.collectedFees.creatorFee)} in fees`
|
||||||
|
|
||||||
const [outcome, setOutcome] = useState<
|
const [outcome, setOutcome] = useState<
|
||||||
'YES' | 'NO' | 'MKT' | 'CANCEL' | undefined
|
resolution | undefined
|
||||||
>()
|
>()
|
||||||
|
|
||||||
const [prob, setProb] = useState(getProbability(contract) * 100)
|
const [prob, setProb] = useState(getProbability(contract) * 100)
|
||||||
|
|
|
@ -3,6 +3,7 @@ import React, { ReactNode } from 'react'
|
||||||
import { formatMoney } from 'common/util/format'
|
import { formatMoney } from 'common/util/format'
|
||||||
import { Col } from './layout/col'
|
import { Col } from './layout/col'
|
||||||
import { Row } from './layout/row'
|
import { Row } from './layout/row'
|
||||||
|
import { resolution } from 'common/contract'
|
||||||
|
|
||||||
export function YesNoSelector(props: {
|
export function YesNoSelector(props: {
|
||||||
selected?: 'YES' | 'NO'
|
selected?: 'YES' | 'NO'
|
||||||
|
@ -65,8 +66,8 @@ export function YesNoSelector(props: {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function YesNoCancelSelector(props: {
|
export function YesNoCancelSelector(props: {
|
||||||
selected: 'YES' | 'NO' | 'MKT' | 'CANCEL' | undefined
|
selected: resolution | undefined
|
||||||
onSelect: (selected: 'YES' | 'NO' | 'MKT' | 'CANCEL') => void
|
onSelect: (selected: resolution) => void
|
||||||
className?: string
|
className?: string
|
||||||
btnClassName?: string
|
btnClassName?: string
|
||||||
}) {
|
}) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user