-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.js
87 lines (74 loc) · 2.4 KB
/
functions.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
const http = require('https');
var HMAC = require("crypto-js/hmac-ripemd160");
let mmogaData = [];
const get_trade_params = (amnt = null, usr = null, pf = null) => {
USERNAME = usr || "mohamed176900";
HASH_KEY = "aeH8pi!s:e3cheiNg5te";
PLATFORM = pf || "ps4";
EMAIL = "mohamed176900@outlook.fr";
GATEAWAY = "skrill";
AMOUNT = amnt || 3000000;
CURRENCY = 'USD';
TIME = Math.round(+ new Date()/1000);
hashed = HMAC(`${PLATFORM}|${AMOUNT}|${GATEAWAY}|${EMAIL}|${CURRENCY}|${TIME}`, HASH_KEY).toString();
// console.log(hashed);
params_obj = {
user: USERNAME,
platform: PLATFORM,
coinAmount: AMOUNT,
paymentGateway: GATEAWAY,
paymentEmail: EMAIL,
paymentCurrency: CURRENCY,
time: TIME,
hash: hashed,
};
return encodeURIComponent(JSON.stringify(params_obj));
};
const send_trade_request = (amount = null, username = null, platform = null) => {
options = {
method: 'GET',
host : 'www.mmoga.com',
port: 443,
path: `/FIFA-Coins/FUT-Coins-Sell/?get_trade=${get_trade_params(amount, username, platform)}`,
headers: {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36'
}
};
return new Promise(function(resolve){
reqLoop = setInterval(function(){
req = http.request(options, res => {
var bb = '';
res.on('data', chunk => {
bb += chunk;
});
res.on('end', () => {
try {
var p = JSON.parse(bb);
if(p["code"] == 200){
mmogaData.push(p);
}
resolve(mmogaData);
}
catch (err) {
console.log(bb);
}
});
});
req.end();
},3000)
})
};
module.exports = {
send_trade_request : send_trade_request,
mmoga_data : mmogaData
};
/*{ code: 200,
transactionID: '9147941-QvR85tY3-o',
platform: 'ps4',
tradeID: '251400374203',
assetID: '163186',
minPrice: 6800,
coinAmount: 10000,
outpaymentValue: '0.45',
outpaymentCurrency: 'USD',
lockExpires: 1559668642 } */