Skip to content

Commit ebcae84

Browse files
authored
Add account creation from seed phrase and update dependencies (#83)
* feat: new account from seed phrase * npm update
1 parent e7a84ec commit ebcae84

File tree

6 files changed

+654
-609
lines changed

6 files changed

+654
-609
lines changed

mobile/app/(app)/toselect/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
import { useCallback, useEffect, useState } from 'react'
12
import { Layout } from '@/components'
23
import VaultListItem from '@/components/list/vault-list/VaultListItem'
34
import { fetchVaults, selectCallback, selectVaults, useAppDispatch, useAppSelector } from '@/redux'
45
import { useGnoNativeContext } from '@gnolang/gnonative'
56
import { router, useNavigation } from 'expo-router'
6-
import { useCallback, useEffect, useState } from 'react'
77
import { FlatList } from 'react-native'
88
import * as Linking from 'expo-linking'
9-
import { Button, Spacer, Text } from '@/modules/ui-components'
9+
import { Button, HomeLayout, Spacer, Text } from '@/modules/ui-components'
1010
import { Vault } from '@/types'
1111

1212
export default function Page() {
@@ -52,7 +52,7 @@ export default function Page() {
5252

5353
return (
5454
<>
55-
<Layout.Container>
55+
<HomeLayout header={null} footer={null}>
5656
<Layout.BodyAlignedBotton>
5757
<Text.H3>Select a key to create the transaction</Text.H3>
5858
<Spacer space={16} />
@@ -69,7 +69,7 @@ export default function Page() {
6969
Cancel
7070
</Button>
7171
</Layout.BodyAlignedBotton>
72-
</Layout.Container>
72+
</HomeLayout>
7373
</>
7474
)
7575
}

mobile/app/home/settings/developer-options.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ const Page: React.FC = () => {
5656
title="Developer Mode"
5757
description={`Toggle developer mode features. Currently ${devMode ? 'ON' : 'OFF'}.`}
5858
/>
59+
{devMode && (
60+
<Form.Link
61+
onPress={() => router.navigate('/home/vault/option-phrase/enter-phrase')}
62+
title="Import Seed Phrase"
63+
description="Register a new account using a seed phrase."
64+
/>
65+
)}
5966
</Form.Section>
6067
</ScrollView>
6168
</HomeLayout>

mobile/app/home/vault/add/index.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Alert as RNAlert } from 'react-native'
22
import React, { useState } from 'react'
3-
import { router, useFocusEffect } from 'expo-router'
3+
import { router, useFocusEffect, useLocalSearchParams } from 'expo-router'
44
import {
55
selectMasterPassword,
66
useAppDispatch,
@@ -22,9 +22,14 @@ export default function Page() {
2222
const keyName = useAppSelector(selectKeyName)
2323
const phrase = useAppSelector(selectPhrase)
2424

25+
const params = useLocalSearchParams()
26+
const skipNewPhraseGeneration = params.skipNewPhraseGeneration === 'true'
27+
2528
useFocusEffect(
2629
React.useCallback(() => {
27-
dispatch(generateNewPhrase())
30+
if (!skipNewPhraseGeneration) {
31+
dispatch(generateNewPhrase())
32+
}
2833
// eslint-disable-next-line react-hooks/exhaustive-deps
2934
}, [])
3035
)

mobile/app/home/vault/option-phrase/enter-phrase.tsx

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Button, Spacer, Text, Container, SafeAreaView } from '@/modules/ui-components'
1+
import { Button, Spacer, Text, SafeAreaView, HomeLayout, ScreenHeader } from '@/modules/ui-components'
22
import { useState, useRef } from 'react'
33
import {
44
Alert,
@@ -46,11 +46,24 @@ export default function Page() {
4646
return
4747
}
4848

49-
route.push('/home/vault/option-phrase/enter-vault-name')
49+
route.push({ pathname: '/home/vault/add', params: { skipNewPhraseGeneration: 'true' } })
5050
}
5151

5252
return (
53-
<Container>
53+
<HomeLayout
54+
header={<ScreenHeader title="Import Seed Phrase" />}
55+
footer={
56+
<View style={styles.footer}>
57+
<Button color="secondary" onPress={pasteClipboard}>
58+
Paste
59+
</Button>
60+
<Spacer />
61+
<Button color="primary" onPress={onContinue}>
62+
Continue
63+
</Button>
64+
</View>
65+
}
66+
>
5467
<SafeAreaView>
5568
<KeyboardAvoidingView
5669
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
@@ -85,25 +98,16 @@ export default function Page() {
8598
<View style={styles.container}>
8699
<SeedInputs length={menomicLength} />
87100
</View>
88-
<View style={styles.footer}>
89-
<Button color="secondary" onPress={pasteClipboard}>
90-
Paste
91-
</Button>
92-
<Spacer />
93-
<Button color="primary" onPress={onContinue}>
94-
Continue
95-
</Button>
96-
</View>
97101
</ScrollView>
98102
</TouchableWithoutFeedback>
99103
</KeyboardAvoidingView>
100104
</SafeAreaView>
101-
</Container>
105+
</HomeLayout>
102106
)
103107
}
104108

105109
const SmallButton = styled(Button)`
106-
width: 100px;
110+
width: 120px;
107111
`
108112

109113
const styles = StyleSheet.create({

0 commit comments

Comments
 (0)