forked from cerc-io/laconic-wallet
Use first child node as primary account (#6)
Co-authored-by: Adw8 <adwait@deepstacksoft.com>
This commit is contained in:
parent
6f476a3ac1
commit
bd2e348c19
2
App.tsx
2
App.tsx
@ -57,7 +57,7 @@ const App = (): React.JSX.Element => {
|
||||
<View>
|
||||
{isWalletCreated ? (
|
||||
<View>
|
||||
<Section title="Wallet Details" />
|
||||
<Section title="Account 1" />
|
||||
<View style={{ marginTop: 32, paddingHorizontal: 24 }}>
|
||||
<Text style={{ fontSize: 16, color: 'black' }}>
|
||||
Address: {wallet && wallet.address.toString()}
|
||||
|
5
utils.ts
5
utils.ts
@ -16,12 +16,13 @@ const generateWallet = async (): Promise<HDNode | undefined> => {
|
||||
try {
|
||||
const mnemonic = utils.entropyToMnemonic(utils.randomBytes(32));
|
||||
const hdNode = HDNode.fromMnemonic(mnemonic);
|
||||
const ethNode = hdNode.derivePath("m/44'/60'/0'/0/0");
|
||||
|
||||
await setInternetCredentials('keyServer', 'key', hdNode.privateKey);
|
||||
await setInternetCredentials('keyServer', 'key', ethNode.privateKey);
|
||||
await setInternetCredentials('mnemonicServer', 'mnemonic', mnemonic);
|
||||
|
||||
Alert.alert('Wallet created successfully ');
|
||||
return hdNode;
|
||||
return ethNode;
|
||||
} catch (error) {
|
||||
console.error('Error creating wallet ', error);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user