seed phrase

This commit is contained in:
emochka2007 2024-05-25 01:45:12 +03:00
parent d257227497
commit fa6f595736
2 changed files with 9 additions and 0 deletions

View File

@ -9,4 +9,9 @@ export class EthereumController {
async getAddressFromPrivateKey(@Param('privateKey') privateKey: string) {
return this.ethereumService.getAddressFromPrivateKey(privateKey);
}
@Get('/address-from-seed/:seedPhrase')
async getAddressFromSeedPhrase(@Param('seedPhrase') seedPhrase: string) {
return this.ethereumService.getAddressFromSeedPhrase(seedPhrase);
}
}

View File

@ -7,4 +7,8 @@ export class EthereumService {
const wallet = new ethers.Wallet(privateKey);
return wallet.address;
}
async getAddressFromSeedPhrase(seedPhrase: string) {
const wallet = ethers.Wallet.fromPhrase(seedPhrase);
return wallet.address;
}
}