Skip to content
6 changes: 4 additions & 2 deletions mobile/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"jsEngine": "hermes",
"ios": {
"jsEngine": "jsc"
}
},
"associatedDomains": ["applinks:gno.berty.io"]
},
"android": {
"adaptiveIcon": {
Expand All @@ -42,7 +43,8 @@
"versionCode": "1"
},
"web": {
"favicon": "./assets/images/favicon.png"
"favicon": "./assets/images/favicon.png",
"output": "server"
},
"experiments": {
"tsconfigPaths": true
Expand Down
2 changes: 1 addition & 1 deletion mobile/app/(app)/home/(modal)/vault-detail-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const Page = () => {
<View style={{ flex: 1, justifyContent: 'space-between', flexDirection: 'row', alignItems: 'flex-end' }}>
<Button
style={{ width: 110 }}
color="tertirary"
color="tertiary"
onPress={onDeleteVault}
endIcon={<FontAwesome6 name="trash-can" size={16} color="black" />}
>
Expand Down
44 changes: 27 additions & 17 deletions mobile/app/(app)/home/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { Layout } from '@/components/index'
import { checkForKeyOnChains, useAppDispatch, useAppSelector, selectVaults, setBookmark, Vault } from '@/redux'
import VaultListItem from '@/components/list/vault-list/VaultListItem'
import { setVaultToEdit, fetchVaults } from '@/redux'
import { AppBar, ButtonIcon, Button, TextField, Spacer, Text } from '@/modules/ui-components'
import { FontAwesome6 } from '@expo/vector-icons'
import { AppBar, ButtonIcon, Spacer, Text } from '@/modules/ui-components'
import { FontAwesome6, FontAwesome } from '@expo/vector-icons'
import styled from 'styled-components/native'
import { ModalConfirm } from '@/components/modal/ModalConfirm'
import { SearchInput } from '@/components/textinput/SearchInput'

export default function Page() {
const isFirstRender = useRef(true)
Expand Down Expand Up @@ -42,12 +43,17 @@ export default function Page() {
}, [])

useEffect(() => {
doSearch()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [nameSearch, vaults])

const doSearch = () => {
if (nameSearch) {
setFilteredAccounts(vaults ? vaults.filter((account) => account.keyInfo.name.includes(nameSearch)) : [])
} else {
setFilteredAccounts(vaults || [])
}
}, [nameSearch, vaults])
}

const onChangeAccountHandler = async (vault: Vault) => {
await dispatch(setVaultToEdit({ vault }))
Expand Down Expand Up @@ -77,13 +83,12 @@ export default function Page() {
<>
<Layout.Container>
<AppBar>
<ButtonIcon onPress={() => route.push('/home/profile')} size={40} color="tertirary">
<ButtonIcon onPress={() => route.push('/home/profile')} size={40} color="tertiary">
<FontAwesome6 name="network-wired" size={20} color="black" />
</ButtonIcon>
<ButtonIcon onPress={() => route.push('/home/profile')} size={40} color="tertiary">
<FontAwesome6 name="user" size={20} color="black" />
</ButtonIcon>

<Button onPress={navigateToAddKey} color="tertirary" endIcon={<FontAwesome6 name="add" size={16} color="black" />}>
New Vault
</Button>
</AppBar>

<BodyAlignedBotton>
Expand All @@ -92,16 +97,21 @@ export default function Page() {
<Text.H1 style={{ color: 'white' }}>Vault List</Text.H1>
</View>

<TextField
placeholder="Search Vault"
value={nameSearch}
onChangeText={setNameSearch}
autoCapitalize="none"
autoCorrect={false}
/>

<Spacer />
<Text.Body style={{ textAlign: 'center' }}>

<View style={{ padding: 4 }}>
<View style={{ flexDirection: 'row' }}>
<SearchInput placeholder="Search Vault" onChangeText={setNameSearch} autoCapitalize="none" autoCorrect={false} />
<ButtonIcon onPress={doSearch} color="tertiary">
<FontAwesome name="search" size={16} color="black" />
</ButtonIcon>
<Spacer spaceH={16} />
<ButtonIcon onPress={navigateToAddKey} color="tertiary">
<FontAwesome6 name="add" size={16} color="black" />
</ButtonIcon>
</View>
</View>
<Text.Body style={{ textAlign: 'center', paddingTop: 8 }}>
{filteredAccounts.length} {filteredAccounts.length > 1 ? 'results' : 'result'}
</Text.Body>
<Spacer />
Expand Down
2 changes: 1 addition & 1 deletion mobile/app/(app)/home/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function Page() {
<View />
<Button
onPress={() => navigation.goBack()}
color="tertirary"
color="tertiary"
endIcon={<FontAwesome6 name="xmark" size={16} color="black" />}
>
Cancel
Expand Down
145 changes: 145 additions & 0 deletions mobile/app/(app)/toexecute/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
import { Layout, Ruller } from '@/components'
import {
useAppDispatch,
useAppSelector,
clearExecute,
clearLinking,
selectLoadingContract,
selectFunc,
selectDoc,
selectExtimateGas,
selectFuncDoc
} from '@/redux'
import { router } from 'expo-router'
import { useState } from 'react'
import { ScrollView, View, TouchableOpacity } from 'react-native'
import { Button, ButtonText, FormItem, FormItemInline, PrettyJSON, Spacer, Text } from '@/modules/ui-components'
import styled from 'styled-components/native'
import { Loading } from '@/components/loading'
import { DynamicItem } from '@/modules/ui-components/src/dynamic'

export default function Page() {
const loading = useAppSelector(selectLoadingContract)
const func = useAppSelector(selectFunc)
const doc = useAppSelector(selectDoc)
const estimateGas = useAppSelector(selectExtimateGas)
const funcDoc = useAppSelector(selectFuncDoc)

const dispatch = useAppDispatch()

const onCancel = () => {
dispatch(clearLinking())
dispatch(clearExecute())
router.replace('/home')
}

if (loading) {
return <Loading message="Loading Smart Contract metadata. Please wait." />
}

if (!func) {
return (
<Layout.Container>
<View style={{ flexDirection: 'row', justifyContent: 'flex-end' }}>
<ButtonText onPress={onCancel}>
<Text.ButtonLabelBlack>Cancel</Text.ButtonLabelBlack>
</ButtonText>
</View>
<Layout.Body>
<Text.H3 style={{ textAlign: 'center', paddingHorizontal: 16 }}>
No function found. Please check the URL and try again.
</Text.H3>
</Layout.Body>
</Layout.Container>
)
}

return (
<>
<Layout.Container>
<View style={{ flexDirection: 'row', justifyContent: 'flex-end' }}>
<ButtonText onPress={onCancel}>
<Text.ButtonLabelBlack>Cancel</Text.ButtonLabelBlack>
</ButtonText>
</View>
<Layout.Body>
<Text.H3 style={{ textAlign: 'center', paddingHorizontal: 16 }}>
Gno.land is requiring permission to execute the <Text.H3 style={{ color: 'white' }}>{func}</Text.H3> function on
chain.
</Text.H3>

<Spacer space={32} />

<ScrollView contentContainerStyle={{}}>
<Ruller />

<FormItemInline label="Function">
<TextBodyWhite>{func}</TextBodyWhite>
</FormItemInline>

<Ruller />

<FormItemInline label="Estimate Gas">
<TextBodyWhite>{String(estimateGas)}</TextBodyWhite>
</FormItemInline>

<Ruller />

<FormItem label="Doc">
<TextBodyWhite>{funcDoc?.func.doc}</TextBodyWhite>
</FormItem>

<Ruller />

<FormItem label="Arguments">
<Spacer space={8} />
{funcDoc?.func.inputs.map((arg, index) => <DynamicItem key={index} paramDoc={arg} />)}
</FormItem>
<Ruller />

<HiddenGroup>
<FormItem label="Raw Contract Doc">{doc && <PrettyJSON data={doc} />}</FormItem>
</HiddenGroup>
</ScrollView>

<Spacer space={32} />

<View style={{ height: 100 }}>
<Button color="primary" onPress={() => {}} loading={loading}>
Execute Contract
</Button>
<Spacer />
</View>
</Layout.Body>
</Layout.Container>
</>
)
}

const HiddenGroup = ({ children }: React.PropsWithChildren) => {
const [visible, setVisible] = useState(false)

if (!visible) {
return (
<TouchableOpacity onPress={() => setVisible(true)} style={{ flexDirection: 'row', justifyContent: 'center' }}>
<Text.Body>Show more details...</Text.Body>
</TouchableOpacity>
)
}

return (
<>
{children}

<Ruller />

<TouchableOpacity onPress={() => setVisible(false)} style={{ flexDirection: 'row', justifyContent: 'center' }}>
<Text.Body>Hide details</Text.Body>
</TouchableOpacity>
</>
)
}

const TextBodyWhite = styled(Text.Body)`
color: white;
`
30 changes: 30 additions & 0 deletions mobile/app/(app)/tosign/broadcasting.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react'
import {
BroadcastingFailedView,
BroadcastingSuccessView,
BroadcastingUndefinedView,
BroadcastingView,
Layout
} from '@/components'
import { selectBroadcastResponse, selectBroadcastStatus, useAppSelector } from '@/redux'
import { useRouter } from 'expo-router'

export default function Page() {
const broadcastStatus = useAppSelector(selectBroadcastStatus)
const txResponse = useAppSelector(selectBroadcastResponse)

const router = useRouter()

const goHome = () => router.push('/home')

return (
<Layout.Container>
<Layout.Body>
{!broadcastStatus || broadcastStatus === undefined ? <BroadcastingUndefinedView onCancel={goHome} /> : null}
{broadcastStatus === 'pending' ? <BroadcastingView /> : null}
{broadcastStatus === 'rejected' ? <BroadcastingFailedView txResponse={txResponse} onCancel={goHome} /> : null}
{broadcastStatus === 'fulfilled' ? <BroadcastingSuccessView txResponse={txResponse} onDone={goHome} /> : null}
</Layout.Body>
</Layout.Container>
)
}
Loading