Skip to content

Commit

Permalink
fix(neuron-ui): fix the address prefix on tx view according to the ch…
Browse files Browse the repository at this point in the history
…ain type.
  • Loading branch information
Keith-CY committed Nov 10, 2019
1 parent 22ab3d8 commit ffedca7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/neuron-ui/src/components/Addresses/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { StateWithDispatch } from 'states/stateProvider/reducer'
import { useLocalDescription } from 'utils/hooks'
import { localNumberFormatter, shannonToCKBFormatter } from 'utils/formatters'
import { onRenderRow } from 'utils/fabricUIRender'
import { MAINNET_TAG } from 'utils/const'

const Addresses = ({
app: {
Expand All @@ -30,8 +31,7 @@ const Addresses = ({
settings: { networks = [] },
dispatch,
}: React.PropsWithoutRef<StateWithDispatch & RouteComponentProps>) => {
const isMainnet =
(networks.find(n => n.id === networkID) || {}).chain === (process.env.REACT_APP_MAINNET_TAG || 'ckb')
const isMainnet = (networks.find(n => n.id === networkID) || {}).chain === MAINNET_TAG
const [showMainnetAddress, setShowMainnetAddress] = useState(false)
const [t] = useTranslation()

Expand Down
6 changes: 2 additions & 4 deletions packages/neuron-ui/src/components/Transaction/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ckbCore } from 'services/chain'
import { transactionState } from 'states/initStates/chain'

import { localNumberFormatter, uniformTimeFormatter, shannonToCKBFormatter } from 'utils/formatters'
import { ErrorCode } from 'utils/const'
import { ErrorCode, MAINNET_TAG } from 'utils/const'
import { explorerNavButton } from './style.module.scss'

const MIN_CELL_WIDTH = 70
Expand Down Expand Up @@ -199,9 +199,7 @@ const Transaction = () => {
}

setAddressPrefix(
network.chain === process.env.REACT_APP_MAINNET_TAG
? ckbCore.utils.AddressPrefix.Mainnet
: ckbCore.utils.AddressPrefix.Testnet
network.chain === MAINNET_TAG ? ckbCore.utils.AddressPrefix.Mainnet : ckbCore.utils.AddressPrefix.Testnet
)
}
})
Expand Down
1 change: 1 addition & 0 deletions packages/neuron-ui/src/utils/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const UNREMOVABLE_NETWORK_ID = '0'
export const CONFIRMATION_THRESHOLD = 30

export const MAX_DECIMAL_DIGITS = 8
export const MAINNET_TAG = 'ckb'

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

0 comments on commit ffedca7

Please sign in to comment.