diff --git a/chain-api/src/ethereum/ethereum.controller.ts b/chain-api/src/ethereum/ethereum.controller.ts index d535715..e0c4ae2 100644 --- a/chain-api/src/ethereum/ethereum.controller.ts +++ b/chain-api/src/ethereum/ethereum.controller.ts @@ -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); + } } diff --git a/chain-api/src/ethereum/ethereum.service.ts b/chain-api/src/ethereum/ethereum.service.ts index 341ab32..fd30cd6 100644 --- a/chain-api/src/ethereum/ethereum.service.ts +++ b/chain-api/src/ethereum/ethereum.service.ts @@ -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; + } }