@ifvictr/

Dai Code Finder

Nodejs

No description

fork
loading
Files
  • index.js
  • package-lock.json
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const { request } = require('graphql-request')

const vowels = 'aeiouy'
const consonants = 'bcdfghjklmnpqrstvwxz'
// const consonants = 'sgftrndlcmpb'

const randomLetter = str => str.charAt(Math.floor(Math.random() * str.length))

const randomThree = () => randomLetter(consonants) + randomLetter(vowels) + randomLetter(consonants)

const randomSegment = () => randomThree() + randomThree()

const query = `
    query getToken($query: String!) {
        getToken(query: $query) {
            token {
                address
                minter
                redeemer_signs
                metadata {
                    name
                    description
                    image
                    __typename
                }
                __typename
            }
            campaign {
                open
                __typename
            }
            code {
                consumed
                expiry
                __typename
            }
            __typename
        }
    }
`

let right = 0
let wrong = 0

setInterval(() => {
    const code = `${randomSegment()}-${randomSegment()}`
    // console.log(code)
    request('https://makerdao.xlnt.co/api/graphql', query, { query: code })
        .then(data => {
            ++right
            console.log(code)
        })
        .catch(e => {
            ++wrong
            // console.log(e)
        })
        .then(() => {
            if ((right + wrong) % 100 === 0) {
                console.log(`right: ${right}, wrong: ${wrong}`)
            }
        })
}, 10)
node v10.16.0