Use first child node as primary account (#6)

Co-authored-by: Adw8 <adwait@deepstacksoft.com>
This commit is contained in:
shreerang6921 2024-02-12 11:42:47 +05:30 committed by GitHub
parent 6f476a3ac1
commit bd2e348c19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -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()}

View File

@ -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);
}