· 8 years ago · Dec 14, 2017, 04:38 PM
1const transition = `57410cd5-9b2c-499a-a3f8-1962ffabffb4`;
2
3
4const secretKey = 'WQHcJ)PzF2SUCEi3';
5const remoteUrl = 'https://wams.tech/api-dev/';
6
7const action = 'CREDIT';
8const account = 'robert.petitto@woodward.edu';
9const amount = 10;
10const ref = 'metaverse';
11const refId = 0;
12const entry = 'Points for completing a Metaverse Experience!';
13const data = 'optional extra';
14const pointType = 'mycred_default';
15
16const host = 'https://mtvrs.io/HumongousPuzzledMamba';
17
18// Calculate token
19let token = `${host}${action}${amount}${secretKey}`;
20token = await Meta.actions.post(`http://api.rest7.com/v1/text_hash.php?text=${token}&algo=md5`, { method: 'get' });
21token = await token.json();
22token = JSON.stringify(token);
23token = token.hash;
24
25Meta.actions.post(remoteUrl, {
26 method: 'post',
27 headers: {
28 Accept: 'application/x-www-form-urlencoded',
29 'Content-Type': 'application/x-www-form-urlencoded',
30 },
31 body: `action=${action}&account=${account}&amount=${amount}&ref=${ref}&ref_id=${refId}&type=${pointType}&entry=${entry}&data=${data}&host=${host}&token=${token}`,
32});
33
34Meta.callbacks.transitionTo(transition);