-
Notifications
You must be signed in to change notification settings - Fork 2
/
api.js
44 lines (39 loc) · 940 Bytes
/
api.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
const co = require("co");
const request = require("co-request");
function* create(bet) {
const obj = {
bd: 12,
player_hash: "57052f28d8bd2f9de974fe6fd2722fe6b354e44b",
bet: bet / 1000000,
num_mines: 1
}
return yield post('https://satoshimines.com/action/newgame.php', obj)
}
function* guess(gameId, tileId) {
const obj = {
game_hash: gameId,
guess: tileId,
v04: 1,
}
return yield post('https://satoshimines.com/action/checkboard.php', obj)
}
function* cashout(gameId) {
const obj = {
game_hash: gameId
}
return yield post('https://satoshimines.com/action/cashout.php', obj)
}
function* post(url, data) {
const result = yield request({
uri: url,
method: "POST",
formData: data,
json: true
})
return result.body
}
module.exports = {
create: create,
guess: guess,
cashout: cashout
}