Skip to content

Commit c66e75d

Browse files
author
bot
committed
update prime&stake API
1 parent 762ad11 commit c66e75d

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

src/api/models/prime.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = class PrimeDice extends BaseDice {
1414

1515
async login(userName, password, twoFactor ,apiKey, req) {
1616
let data = {};
17-
data.query = "{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses amount profit currency}}}";
17+
data.query = "{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses amount profitAmount currency}}}";
1818
let ret = await this._send('', 'POST', data, apiKey);
1919
req.session.accessToken = apiKey;
2020
req.session.username = apiKey;
@@ -32,7 +32,7 @@ module.exports = class PrimeDice extends BaseDice {
3232
return false;
3333
}
3434
let data = {};
35-
data.query = "{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses betAmount profit currency}}}";
35+
data.query = "{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses betAmount profitAmount currency}}}";
3636
let ret = await this._send('', 'POST', data, req.session.accessToken);
3737
ret = ret.user;
3838
let userinfo = {
@@ -50,7 +50,8 @@ module.exports = class PrimeDice extends BaseDice {
5050
}
5151
for (let i=0; i<ret.statistic.length; i++) {
5252
if(req.query.currency == ret.statistic[i].currency) {
53-
userinfo.profit = parseFloat(ret.statistic[i].profit).toFixed(8);
53+
console.log(ret.statistic[i]);
54+
userinfo.profit = parseFloat(ret.statistic[i].profitAmount).toFixed(8);
5455
userinfo.wins = ret.statistic[i].wins;
5556
userinfo.bets = ret.statistic[i].bets;
5657
userinfo.losses = ret.statistic[i].losses;
@@ -66,7 +67,7 @@ module.exports = class PrimeDice extends BaseDice {
6667
async clear(req) {
6768
console.log('loading....');
6869
let data = {};
69-
data.query = "{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses betAmount profit currency}}}";
70+
data.query = "{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses betAmount profitAmount currency}}}";
7071
let ret = await this._send('', 'POST', data, req.session.accessToken);
7172
ret=ret.user;
7273
let info = {};
@@ -96,7 +97,8 @@ module.exports = class PrimeDice extends BaseDice {
9697

9798
for (let i=0; i<ret.statistic.length; i++) {
9899
if(req.query.currency == ret.statistic[i].currency) {
99-
userinfo.profit = parseFloat(ret.statistic[i].profit).toFixed(8);
100+
console.log(ret.statistic[i]);
101+
userinfo.profit = parseFloat(ret.statistic[i].profitAmount).toFixed(8);
100102
userinfo.wins = ret.statistic[i].wins;
101103
userinfo.bets = ret.statistic[i].bets;
102104
userinfo.losses = ret.statistic[i].losses;
@@ -121,7 +123,7 @@ module.exports = class PrimeDice extends BaseDice {
121123
}
122124
target = parseFloat(target/100).toFixed(2);
123125
let data = {};
124-
data.query = " mutation{primediceRoll(amount:"+amount+",target:"+target+",condition:"+ condition +",currency:"+currency+ ") { id nonce currency amount payout state { ... on CasinoGamePrimedice { result target condition } } createdAt serverSeed{seedHash seed nonce} clientSeed{seed} user{balances{available{amount currency}} statistic{game bets wins losses betAmount profit currency}}}}";
126+
data.query = " mutation{primediceRoll(amount:"+amount+",target:"+target+",condition:"+ condition +",currency:"+currency+ ") { id nonce currency amount payout state { ... on CasinoGamePrimedice { result target condition } } createdAt serverSeed{seedHash seed nonce} clientSeed{seed} user{balances{available{amount currency}} statistic{game bets wins losses betAmount profitAmount currency}}}}";
125127
let ret = await this._send('', 'POST', data, req.session.accessToken);
126128
let info = req.session.info;
127129
let betInfo = ret.primediceRoll;

src/api/models/stake.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = class StakeDice extends BaseDice {
1414

1515
async login(userName, password, twoFactor ,apiKey, req) {
1616
let data = {};
17-
data.query = "{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses amount profit currency}}}";
17+
data.query = "{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses amount profitAmount currency}}}";
1818
let ret = await this._send('', 'POST', data, apiKey);
1919
req.session.accessToken = apiKey;
2020
req.session.username = apiKey;
@@ -32,7 +32,7 @@ module.exports = class StakeDice extends BaseDice {
3232
return false;
3333
}
3434
let data = {};
35-
data.query = "{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses betAmount profit currency}}}";
35+
data.query = "{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses betAmount profitAmount currency}}}";
3636
let ret = await this._send('', 'POST', data, req.session.accessToken);
3737
ret = ret.user;
3838
let userinfo = {
@@ -50,7 +50,8 @@ module.exports = class StakeDice extends BaseDice {
5050
}
5151
for (let i=0; i<ret.statistic.length; i++) {
5252
if(req.query.currency == ret.statistic[i].currency) {
53-
userinfo.profit = parseFloat(ret.statistic[i].profit).toFixed(8);
53+
console.log(ret.statistic[i]);
54+
userinfo.profit = parseFloat(ret.statistic[i].profitAmount).toFixed(8);
5455
userinfo.wins = ret.statistic[i].wins;
5556
userinfo.bets = ret.statistic[i].bets;
5657
userinfo.losses = ret.statistic[i].losses;
@@ -66,7 +67,7 @@ module.exports = class StakeDice extends BaseDice {
6667
async clear(req) {
6768
console.log('loading....');
6869
let data = {};
69-
data.query = "{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses betAmount profit currency}}}";
70+
data.query = "{user {activeServerSeed { seedHash seed nonce} activeClientSeed{seed} id balances{available{currency amount}} statistic {game bets wins losses betAmount profitAmount currency}}}";
7071
let ret = await this._send('', 'POST', data, req.session.accessToken);
7172
ret=ret.user;
7273
let info = {};
@@ -96,7 +97,8 @@ module.exports = class StakeDice extends BaseDice {
9697

9798
for (let i=0; i<ret.statistic.length; i++) {
9899
if(req.query.currency == ret.statistic[i].currency) {
99-
userinfo.profit = parseFloat(ret.statistic[i].profit).toFixed(8);
100+
console.log(ret.statistic[i]);
101+
userinfo.profit = parseFloat(ret.statistic[i].profitAmount).toFixed(8);
100102
userinfo.wins = ret.statistic[i].wins;
101103
userinfo.bets = ret.statistic[i].bets;
102104
userinfo.losses = ret.statistic[i].losses;
@@ -121,7 +123,7 @@ module.exports = class StakeDice extends BaseDice {
121123
}
122124
target = parseFloat(target/10000).toFixed(2);
123125
let data = {};
124-
data.query = " mutation{diceRoll(amount:"+amount+",target:"+target+",condition:"+ condition +",currency:"+currency+ ") { id nonce currency amount payout state { ... on CasinoGameDice { result target condition } } createdAt serverSeed{seedHash seed nonce} clientSeed{seed} user{balances{available{amount currency}} statistic{game bets wins losses betAmount profit currency}}}}";
126+
data.query = " mutation{diceRoll(amount:"+amount+",target:"+target+",condition:"+ condition +",currency:"+currency+ ") { id nonce currency amount payout state { ... on CasinoGameDice { result target condition } } createdAt serverSeed{seedHash seed nonce} clientSeed{seed} user{balances{available{amount currency}} statistic{game bets wins losses betAmount profitAmount currency}}}}";
125127
let ret = await this._send('', 'POST', data, req.session.accessToken);
126128
let info = req.session.info;
127129
let betInfo = ret.diceRoll;

src/package.json.console

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "mydicebot-console-200530",
2+
"name": "mydicebot-console-200602",
33
"version": "1.0.0",
44
"description": "MyDiceBot - Bet more, earn more!",
55
"homepage": "https://mydicebot.com",

0 commit comments

Comments
 (0)