Skip to content

Commit

Permalink
feat(neuron-ui): update confirmation threshold of confirmations
Browse files Browse the repository at this point in the history
1. set the threshold of confirmations to 10.
2. display a recent activity as a pending one if its status is success while its confirmations is less the the threshold of confirmations.
  • Loading branch information
Keith-CY committed Aug 12, 2019
1 parent 2066f61 commit 581fa70
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions packages/neuron-ui/src/components/Overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,16 @@ const Overview = ({
items.map(item => {
let confirmations = '(-)'
let typeLabel: string = item.type
let { status } = item
if (item.blockNumber !== undefined) {
const confirmationCount = 1 + Math.max(+syncedBlockNumber, +tipBlockNumber) - +item.blockNumber

if (status === 'success' && confirmationCount < CONFIRMATION_THRESHOLD) {
status = 'pending'
}

typeLabel = genTypeLabel(item.type, confirmationCount)

if (confirmationCount === 1) {
confirmations = `(${t('overview.confirmation', {
confirmationCount: localNumberFormatter(confirmationCount),
Expand All @@ -298,8 +305,10 @@ const Overview = ({
})})`
}
}

return {
...item,
status,
confirmations: item.status === 'success' ? confirmations : '',
typeLabel: t(`overview.${typeLabel}`),
}
Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-ui/src/utils/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const MIN_AMOUNT = 61
export const PAGE_SIZE = 15
export const UNREMOVABLE_NETWORK = 'Testnet'
export const UNREMOVABLE_NETWORK_ID = '0'
export const CONFIRMATION_THRESHOLD = 6
export const CONFIRMATION_THRESHOLD = 10

export enum ConnectionStatus {
Online = 'online',
Expand Down

0 comments on commit 581fa70

Please sign in to comment.