juice-shop
74 строки · 1.8 Кб
1import { Injectable } from '@angular/core'2import { HttpClient } from '@angular/common/http'3import { catchError, map } from 'rxjs/operators'4import { environment } from '../../environments/environment'5
6@Injectable({7providedIn: 'root'8})9export class KeysService {10private readonly hostServer = environment.hostServer11private readonly host = this.hostServer + '/rest/web3'12
13constructor (private readonly http: HttpClient) {}14
15nftUnlocked () {16return this.http.get(this.host + '/nftUnlocked').pipe(17map((response: any) => response),18catchError((err) => {19throw err20})21)22}23
24nftMintListen () {25return this.http.get(this.host + '/nftMintListen').pipe(26map((response: any) => response),27catchError((err) => {28throw err29})30)31}32
33checkNftMinted () {34return this.http.get(this.hostServer + '/api/Challenges/?key=nftMintChallenge').pipe(35map((response: any) => response),36catchError((err) => {37throw err38})39)40}41
42submitKey (privateKey: string) {43const endpoint = this.host + '/submitKey'44const params = { privateKey }45return this.http.post(endpoint, params).pipe(46map((response: any) => response),47catchError((err) => {48throw err49})50)51}52
53verifyNFTWallet (walletAddress: string) {54const endpoint = this.host + '/walletNFTVerify'55const params = { walletAddress }56return this.http.post(endpoint, params).pipe(57map((response: any) => response),58catchError((err) => {59throw err60})61)62}63
64walletAddressSend (walletAddress: string) {65const endpoint = this.host + '/walletExploitAddress'66const params = { walletAddress }67return this.http.post(endpoint, params).pipe(68map((response: any) => response),69catchError((err) => {70throw err71})72)73}74}
75