Skip to content

Commit 29e75ba

Browse files
committed
expert mode on create; fix wallet version test
1 parent 99751d0 commit 29e75ba

File tree

4 files changed

+40
-22
lines changed

4 files changed

+40
-22
lines changed

code/client/src/constants/paths.js

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export default {
33
root: base + '/',
44
dev: base + '/dev',
55
create: base + '/create',
6+
create2: base + '/create2',
67
wallets: base + '/wallets',
78
restore: base + '/restore',
89

code/client/src/pages/Create.jsx

+37-21
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,14 @@ const sectionViews = {
129129
walletSetupDone: 5
130130
}
131131

132-
const Create = () => {
133-
const generateNewOtpName = () => genName(Object.keys(wallets).map(k => wallets[k].name))
134-
132+
const Create = ({ advancedSetting }) => {
133+
const dev = useSelector(state => state.wallet.dev)
135134
const { isMobile, os } = useWindowDimensions()
136135
const dispatch = useDispatch()
137136
const history = useHistory()
138137
const network = useSelector(state => state.wallet.network)
139138
const wallets = useSelector(state => state.wallet.wallets)
139+
const generateNewOtpName = () => genName(Object.keys(wallets).map(k => wallets[k].name))
140140
const [name, setName] = useState(generateNewOtpName())
141141
// eslint-disable-next-line no-unused-vars
142142
const [seed, setSeed] = useState(generateOtpSeed())
@@ -163,7 +163,7 @@ const Create = () => {
163163
: oneWalletTreasurySelectOption
164164

165165
const [lastResortAddress, setLastResortAddress] = useState(defaultRecoveryAddress)
166-
const [dailyLimit] = useState(WalletConstants.defaultDailyLimit)
166+
const [dailyLimit, setDailyLimit] = useState(WalletConstants.defaultDailyLimit)
167167

168168
const [worker, setWorker] = useState()
169169
const [root, setRoot] = useState()
@@ -181,7 +181,6 @@ const Create = () => {
181181
const [qrCodeData, setQRCodeData] = useState()
182182
const [secondOtpQrCodeData, setSecondOtpQrCodeData] = useState()
183183
const [otp, setOtp] = useState('')
184-
185184
const [deploying, setDeploying] = useState()
186185

187186
const otpRef = useRef()
@@ -224,6 +223,18 @@ const Create = () => {
224223
if (otp.length !== 6) {
225224
return
226225
}
226+
if (otp === '0x1337' || otp === 'expert') {
227+
history.push(Paths.create2)
228+
message.success('Expert mode unlocked')
229+
setOtp('')
230+
return
231+
}
232+
if (advancedSetting && (otp === '0x0000' || otp === 'normal')) {
233+
history.push(Paths.create)
234+
message.success('Expert mode disabled')
235+
setOtp('')
236+
return
237+
}
227238
const currentSeed = settingUpSecondOtp ? seed2 : seed
228239
const expected = ONEUtil.genOTP({ seed: currentSeed })
229240
const code = new DataView(expected.buffer).getUint32(0, false).toString()
@@ -376,16 +387,17 @@ const Create = () => {
376387
value={otp}
377388
onChange={setOtp}
378389
/>
379-
<Checkbox onChange={() => setDoubleOtp(!doubleOtp)}>
380-
<Space>
381-
<Hint style={{ fontSize: isMobile ? 12 : undefined }}>
382-
Use two codes to enhance security
383-
</Hint>
384-
<Tooltip title={<div>You will need to scan another QR-code on the next page. Each time you make a transaction, you will need to type in two 6-digit codes, which are shown simultaneously next to each other on your Google Authenticator.<br /><br />This is advisable if you intend to make larger transactions with this wallet</div>}>
385-
<QuestionCircleOutlined />
386-
</Tooltip>
387-
</Space>
388-
</Checkbox>
390+
{advancedSetting &&
391+
<Checkbox onChange={() => setDoubleOtp(!doubleOtp)}>
392+
<Space>
393+
<Hint style={{ fontSize: isMobile ? 12 : undefined }}>
394+
Use two codes to enhance security
395+
</Hint>
396+
<Tooltip title={<div>You will need to scan another QR-code on the next page. Each time you make a transaction, you will need to type in two 6-digit codes, which are shown simultaneously next to each other on your Google Authenticator.<br /><br />This is advisable if you intend to make larger transactions with this wallet</div>}>
397+
<QuestionCircleOutlined />
398+
</Tooltip>
399+
</Space>
400+
</Checkbox>}
389401
</Space>
390402
</Row>
391403
</AnimatedSection>
@@ -416,12 +428,16 @@ const Create = () => {
416428
<Heading>Prepare Your 1wallet</Heading>
417429
</Space>
418430
</Row>
419-
{/* <Row style={{ marginBottom: 16 }}> */}
420-
{/* <Space direction='vertical' size='small'> */}
421-
{/* <Hint>Set up a daily spending limit:</Hint> */}
422-
{/* <InputBox margin={16} width={200} value={dailyLimit} onChange={({ target: { value } }) => setDailyLimit(parseInt(value || 0))} suffix='ONE' /> */}
423-
{/* </Space> */}
424-
{/* </Row> */}
431+
{advancedSetting &&
432+
<Row style={{ marginBottom: 16 }}>
433+
<Space direction='vertical' size='small'>
434+
<Hint>Set up a daily spending limit:</Hint>
435+
<InputBox
436+
margin={16} width={200} value={dailyLimit}
437+
onChange={({ target: { value } }) => setDailyLimit(parseInt(value || 0))} suffix='ONE'
438+
/>
439+
</Space>
440+
</Row>}
425441
<Row style={{ marginBottom: 48 }}>
426442
<Space direction='vertical' size='small' style={{ width: '100%' }}>
427443
<Hint>Set up a fund recovery address:</Hint>

code/client/src/routes.js

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const LocalRoutes = () => {
4949
/>
5050
<Route path={Paths.auth} component={WalletAuth} />
5151
<Route path={Paths.create} component={CreatePage} />
52+
<Route path={Paths.create2} render={() => <CreatePage advancedSetting />} />
5253
<Route path={Paths.wallets} component={ListPage} />
5354
<Route path={Paths.restore} component={RestorePage} />
5455
<Route path={Paths.show} component={ShowPage} />

code/lib/constants.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ module.exports = {
6060
EmptyBech32Address: 'one1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqquzw7vz',
6161
TreasuryAddress: '0x02F2cF45DD4bAcbA091D78502Dba3B2F431a54D3',
6262
MajorVersion: 11,
63-
MinorVersion: 0,
63+
MinorVersion: 1,
6464
Domain: {
6565
DEFAULT_RENT_DURATION: 31536000, // 365 * 24 * 3600,
6666
DEFAULT_TLD: 'one',

0 commit comments

Comments
 (0)