Skip to content

Commit 56d7b1f

Browse files
committed
Test account exporting
1 parent 5cf6e8d commit 56d7b1f

File tree

1 file changed

+39
-3
lines changed
  • packages/mobile-app/app/(drawer)/account/account-settings/export-account

1 file changed

+39
-3
lines changed

packages/mobile-app/app/(drawer)/account/account-settings/export-account/index.tsx

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,54 @@
11
import { StatusBar } from "expo-status-bar";
22
import { Button, StyleSheet, Text, View } from "react-native";
33
import { useRouter } from "expo-router";
4+
import { useFacade } from "@/data/facades";
5+
import { AccountFormat } from "@ironfish/sdk";
46

57
export default function ExportAccount() {
68
const router = useRouter();
79

10+
const facade = useFacade();
11+
const { data, isLoading } = facade.getAccount.useQuery({});
12+
const exportAccount = facade.exportAccount.useMutation();
13+
14+
if (isLoading) return <Text>Loading...</Text>;
15+
if (!data) return <Text>No Account</Text>;
16+
817
return (
918
<View style={styles.container}>
1019
<Button title="Back" onPress={() => router.dismiss()} />
1120

1221
<View>
13-
<Text>Mnemonic Phrase</Text>
14-
<Text>Encoded Key</Text>
15-
<Text>Spending Key</Text>
22+
<Button
23+
onPress={async () => {
24+
const acc = await exportAccount.mutateAsync({
25+
name: data.name,
26+
format: AccountFormat.Mnemonic,
27+
});
28+
console.log(acc);
29+
}}
30+
title="Mnemonic Phrase"
31+
/>
32+
<Button
33+
onPress={async () => {
34+
const acc = await exportAccount.mutateAsync({
35+
name: data.name,
36+
format: AccountFormat.Base64Json,
37+
});
38+
console.log(acc);
39+
}}
40+
title="Encoded Key"
41+
/>
42+
<Button
43+
onPress={async () => {
44+
const acc = await exportAccount.mutateAsync({
45+
name: data.name,
46+
format: AccountFormat.SpendingKey,
47+
});
48+
console.log(acc);
49+
}}
50+
title="Spending Key"
51+
/>
1652
</View>
1753
<StatusBar style="auto" />
1854
</View>

0 commit comments

Comments
 (0)