juice-shop

Форк
0
/
keys.service.ts 
74 строки · 1.8 Кб
1
import { Injectable } from '@angular/core'
2
import { HttpClient } from '@angular/common/http'
3
import { catchError, map } from 'rxjs/operators'
4
import { environment } from '../../environments/environment'
5

6
@Injectable({
7
  providedIn: 'root'
8
})
9
export class KeysService {
10
  private readonly hostServer = environment.hostServer
11
  private readonly host = this.hostServer + '/rest/web3'
12

13
  constructor (private readonly http: HttpClient) {}
14

15
  nftUnlocked () {
16
    return this.http.get(this.host + '/nftUnlocked').pipe(
17
      map((response: any) => response),
18
      catchError((err) => {
19
        throw err
20
      })
21
    )
22
  }
23

24
  nftMintListen () {
25
    return this.http.get(this.host + '/nftMintListen').pipe(
26
      map((response: any) => response),
27
      catchError((err) => {
28
        throw err
29
      })
30
    )
31
  }
32

33
  checkNftMinted () {
34
    return this.http.get(this.hostServer + '/api/Challenges/?key=nftMintChallenge').pipe(
35
      map((response: any) => response),
36
      catchError((err) => {
37
        throw err
38
      })
39
    )
40
  }
41

42
  submitKey (privateKey: string) {
43
    const endpoint = this.host + '/submitKey'
44
    const params = { privateKey }
45
    return this.http.post(endpoint, params).pipe(
46
      map((response: any) => response),
47
      catchError((err) => {
48
        throw err
49
      })
50
    )
51
  }
52

53
  verifyNFTWallet (walletAddress: string) {
54
    const endpoint = this.host + '/walletNFTVerify'
55
    const params = { walletAddress }
56
    return this.http.post(endpoint, params).pipe(
57
      map((response: any) => response),
58
      catchError((err) => {
59
        throw err
60
      })
61
    )
62
  }
63

64
  walletAddressSend (walletAddress: string) {
65
    const endpoint = this.host + '/walletExploitAddress'
66
    const params = { walletAddress }
67
    return this.http.post(endpoint, params).pipe(
68
      map((response: any) => response),
69
      catchError((err) => {
70
        throw err
71
      })
72
    )
73
  }
74
}
75

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.