mirror of
https://github.com/emo2007/block-accounting.git
synced 2025-01-18 07:26:27 +00:00
update ethereum
This commit is contained in:
parent
fa6f595736
commit
5f97b641c0
@ -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);
|
||||
}
|
||||
}
|
||||
|
8
chain-api/src/ethereum/ethereum.dto.ts
Normal file
8
chain-api/src/ethereum/ethereum.dto.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import {IsString} from "class-validator";
|
||||
import {ApiProperty} from "@nestjs/swagger";
|
||||
|
||||
export class GetSeedPhraseDto {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
seedPhrase: string;
|
||||
}
|
Loading…
Reference in New Issue
Block a user