diff --git a/src/controllers/nft.controller.ts b/src/controllers/nft.controller.ts index 4ad98ba..4f51719 100644 --- a/src/controllers/nft.controller.ts +++ b/src/controllers/nft.controller.ts @@ -18,7 +18,6 @@ export class NftController { constructor(private readonly nftService: NftService, private readonly userService: UserService, private readonly dataService: DataService, - private readonly walletService: WalletService, ) { } @Get(":id") @@ -100,7 +99,7 @@ export class NftController { }; } const user = await verifyAccessToken(accessToken); - const wallet = await this.walletService.findWalletById(user.id); + // check address wallet in nodes network // check if user is owner of data in blockchain return { id: data.id, diff --git a/src/controllers/oauth.controller.ts b/src/controllers/oauth.controller.ts index b8c448e..d8ffc9f 100644 --- a/src/controllers/oauth.controller.ts +++ b/src/controllers/oauth.controller.ts @@ -17,7 +17,6 @@ export class OauthController { constructor( private configService: ConfigService, private readonly userService: UserService, - private readonly walletService: WalletService, private readonly socialUserService: SocialUserService ) { this.oAuth2Client = new OAuth2Client( @@ -33,37 +32,14 @@ export class OauthController { if (!code) { throw new BadRequestException("Missing code"); } - const { tokens } = await this.oAuth2Client.getToken(code); const { access_token } = tokens; const user: User = await verifyAccessToken(`Bearer ${access_token}`); const existedUser = await this.userService.findUserById(user.id); - // const wallet: any = await gaxios({ - // url: "http://localhost:3001/proxy", - // method: 'POST', - // data: { - // owner: user.email, - // idToken: tokens.id_token, - // verifier: "google" - // }, - // headers: { - // 'Content-Type': 'application/json', - // }, - // }); - const wallet = { - data: { - ethAddress: "0x0", - privKey: "0x0" - } - } if (!existedUser) { await this.userService.createUser(user); const socialUser = await this.socialUserService.createSocialUser(user.id, [], [], [], 0, 0, 0, 0); - if (!wallet.data.ethAddress) { - throw new BadRequestException("Can not create wallet"); - } - await this.walletService.createWallet(user.id, wallet.data.ethAddress); return { user: { id: user.id, @@ -75,10 +51,6 @@ export class OauthController { family_name: user.family_name, given_name: user.given_name }, - wallet: { - address: wallet?.data.ethAddress ?? "", - privateKey: wallet?.data.privKey ?? "" - }, socialUser: { bookmarks: socialUser.bookmarks, following: socialUser.following, @@ -104,14 +76,6 @@ export class OauthController { if (!socialUser) await this.socialUserService.createSocialUser(user.id, [], [], [], 0, 0, 0, 0); - const walletStorage = await this.walletService.findWalletById(user.id); - if (!walletStorage) { - await this.walletService.createWallet(user.id, wallet.data.ethAddress); - } - if (walletStorage.address !== wallet.data.ethAddress) { - await this.walletService.updateWallet(user.id, wallet.data.ethAddress); - } - return { user: { id: user.id, @@ -123,10 +87,6 @@ export class OauthController { family_name: user.family_name, given_name: user.given_name }, - wallet: { - address: wallet?.data.ethAddress ?? "", - privateKey: wallet?.data.privKey ?? "" - }, socialUser: { bookmarks: socialUser.bookmarks ?? [], following: socialUser.following ?? [], diff --git a/src/controllers/user.controller.ts b/src/controllers/user.controller.ts index c12f441..89e6388 100644 --- a/src/controllers/user.controller.ts +++ b/src/controllers/user.controller.ts @@ -35,9 +35,6 @@ export class UserController { given_name: info.given_name, email: info.email, locale: info.locale, - wallet: { - address: wallet.address, - }, socialUser: { following: listUserByFlowing?.map((user) => { return { @@ -72,15 +69,15 @@ export class UserController { } // get wallet by email - @Get("/wallet/:email") - async getWalletByEmail(@Param("email") email: string) { - const user = await this.userService.findUserByEmail(email); - const wallet = await this.walletService.findWalletById(user.id); - return { - id: user.id, - email: user.email, - address: wallet.address, - }; - } + // @Get("/wallet/:email") + // async getWalletByEmail(@Param("email") email: string) { + // const user = await this.userService.findUserByEmail(email); + // const wallet = await this.walletService.findWalletById(user.id); + // return { + // id: user.id, + // email: user.email, + // address: wallet.address, + // }; + // } } \ No newline at end of file