From 5f97b641c08d883386c022e01386abab405d842a Mon Sep 17 00:00:00 2001 From: emochka2007 Date: Sat, 25 May 2024 01:49:53 +0300 Subject: [PATCH] update ethereum --- chain-api/src/ethereum/ethereum.controller.ts | 9 ++++++--- chain-api/src/ethereum/ethereum.dto.ts | 8 ++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 chain-api/src/ethereum/ethereum.dto.ts diff --git a/chain-api/src/ethereum/ethereum.controller.ts b/chain-api/src/ethereum/ethereum.controller.ts index e0c4ae2..5aae8ea 100644 --- a/chain-api/src/ethereum/ethereum.controller.ts +++ b/chain-api/src/ethereum/ethereum.controller.ts @@ -1,17 +1,20 @@ -import { Controller, Get, Param } from '@nestjs/common'; +import { Body, Controller, Get, Param } from '@nestjs/common'; import { EthereumService } from './ethereum.service'; import { ApiTags } from '@nestjs/swagger'; +import { GetSeedPhraseDto } from './ethereum.dto'; + @ApiTags('Ethereum') @Controller() export class EthereumController { constructor(private readonly ethereumService: EthereumService) {} + @Get('/address/:privateKey') 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); + async getAddressFromSeedPhrase(@Body() body: GetSeedPhraseDto) { + return this.ethereumService.getAddressFromSeedPhrase(body.seedPhrase); } } diff --git a/chain-api/src/ethereum/ethereum.dto.ts b/chain-api/src/ethereum/ethereum.dto.ts new file mode 100644 index 0000000..f91cd9d --- /dev/null +++ b/chain-api/src/ethereum/ethereum.dto.ts @@ -0,0 +1,8 @@ +import {IsString} from "class-validator"; +import {ApiProperty} from "@nestjs/swagger"; + +export class GetSeedPhraseDto { + @ApiProperty() + @IsString() + seedPhrase: string; +} \ No newline at end of file