Skip to content

Commit ffedca7

Browse files
committed
fix(neuron-ui): fix the address prefix on tx view according to the chain type.
1 parent 22ab3d8 commit ffedca7

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

packages/neuron-ui/src/components/Addresses/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { StateWithDispatch } from 'states/stateProvider/reducer'
2020
import { useLocalDescription } from 'utils/hooks'
2121
import { localNumberFormatter, shannonToCKBFormatter } from 'utils/formatters'
2222
import { onRenderRow } from 'utils/fabricUIRender'
23+
import { MAINNET_TAG } from 'utils/const'
2324

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

packages/neuron-ui/src/components/Transaction/index.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { ckbCore } from 'services/chain'
88
import { transactionState } from 'states/initStates/chain'
99

1010
import { localNumberFormatter, uniformTimeFormatter, shannonToCKBFormatter } from 'utils/formatters'
11-
import { ErrorCode } from 'utils/const'
11+
import { ErrorCode, MAINNET_TAG } from 'utils/const'
1212
import { explorerNavButton } from './style.module.scss'
1313

1414
const MIN_CELL_WIDTH = 70
@@ -199,9 +199,7 @@ const Transaction = () => {
199199
}
200200

201201
setAddressPrefix(
202-
network.chain === process.env.REACT_APP_MAINNET_TAG
203-
? ckbCore.utils.AddressPrefix.Mainnet
204-
: ckbCore.utils.AddressPrefix.Testnet
202+
network.chain === MAINNET_TAG ? ckbCore.utils.AddressPrefix.Mainnet : ckbCore.utils.AddressPrefix.Testnet
205203
)
206204
}
207205
})

packages/neuron-ui/src/utils/const.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const UNREMOVABLE_NETWORK_ID = '0'
1010
export const CONFIRMATION_THRESHOLD = 30
1111

1212
export const MAX_DECIMAL_DIGITS = 8
13+
export const MAINNET_TAG = 'ckb'
1314

1415
export enum ConnectionStatus {
1516
Online = 'online',

0 commit comments

Comments
 (0)