Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @header
- * @name MyCred API call
- * @description Integrate with MyCred
- * @category Custom APIs
- */
- /**
- * @inspectable
- * @name Transition
- * @description Where this block transitions when it is finished
- * @type transition
- */
- const transition = `57410cd5-9b2c-499a-a3f8-1962ffabffb4`;
- const secretKey = 'HIDDEN';
- const remoteUrl = 'HIDDEN';
- const action = 'CREDIT';
- const account = 'HIDDEN@HIDDEN.edu';
- const amount = 10;
- const ref = 'metaverse';
- //const refId = 0;
- const entry = 'Points for completing a Metaverse Experience!';
- //const data = 'optional extra';
- const pointType = 'mycred_default';
- const host = 'https://www.gonmeta.io';
- // Calculate token
- let token = `${host}${action}${amount}${secretKey}`;
- token = await Meta.actions.post(`http://api.rest7.com/v1/text_hash.php?text=${token}&algo=md5`, { method: 'get' });
- token = await token.json();
- token = JSON.stringify(token);
- token = token.hash;
- Meta.actions.post(remoteUrl, {
- method: 'POST',
- headers: {
- Accept: 'application/x-www-form-urlencoded',
- 'Content-Type': 'application/x-www-form-urlencoded',
- },
- //body: `action=${action}&account=${account}&amount=${amount}&ref=${ref}&ref_id=${refId}&type=${pointType}&entry=${entry}&data=${data}&host=${host}&token=${token}`,
- body: `action=${action}&account=${account}&amount=${amount}&ref=${ref}&type=${pointType}&entry=${entry}&host=${host}&token=${token}`,
- });
- Meta.callbacks.transitionTo(transition);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement