Skip to content
Snippets Groups Projects
Commit dea6b97b authored by root's avatar root
Browse files

Resolviendo conflictos

parents 709974c3 1e0f8620
No related branches found
No related tags found
No related merge requests found
Showing with 889 additions and 10217 deletions
...@@ -35,6 +35,19 @@ module.exports = { ...@@ -35,6 +35,19 @@ module.exports = {
return res.json(balanceToEther); return res.json(balanceToEther);
}); });
},
// Son las blockchain con las que trabajamos desde la API REST
getPayments : async function(req, res){
var payments = [];
payments.push({name: 'ropsten', enabled: true});
payments.push({name: 'rinkeby', enabled: true});
payments.push({name: 'rsk', enabled: true});
payments.push({name: 'bfa', enabled: false});
payments.push({name: 'celo', enabled: true});
return res.json(payments);
} }
}; };
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
const Web3 = require('web3'); const Web3 = require('web3');
const Tx = require('ethereumjs-tx'); const Tx = require('ethereumjs-tx');
const base64 = require('nodejs-base64-encode'); const base64 = require('nodejs-base64-encode');
const axios = require('axios');
const url = sails.config.custom.urlRpcRopsten; const url = sails.config.custom.urlRpcRopsten;
const web3 = new Web3(url); const web3 = new Web3(url);
const accountAddress = sails.config.custom.accountAddressRopsten; const accountAddress = sails.config.custom.accountAddressRopsten;
...@@ -146,5 +147,106 @@ module.exports = { ...@@ -146,5 +147,106 @@ module.exports = {
}); });
}, },
createAccount : async function (req, res){
sails.log("createAccount()");
var account_data = web3.eth.accounts.create();
return res.json(account_data);
},
getBalance : async function (req, res){
var account = req.params.account;
web3.eth.getBalance(account, async (err, bal) => {
if(err){
return res.json(err.toString());
}
var balanceToEther = web3.utils.fromWei(bal, 'ether')
sails.log("Balance Ether:", balanceToEther);
// Ahora consulto el Balance de esta criptomoneda expresado en USD
try{
var etherToUsd = await sails.helpers.ethToUsd(balanceToEther);
sails.log("EtherToUSD:", etherToUsd);
} catch (e){
throw 'No se pudo obtener la cotización del ETH';
}
// Ahora convierto a Pesos
try{
var usdToArs = await sails.helpers.usdToArs(etherToUsd);
sails.log("USDToARS:", usdToArs);
} catch (e) {
throw 'No se pudo obtener la cotización del USD';
}
sails.log("-------------------------------------------------------");
return res.json(usdToArs);
});
},
send: async function(req, res){
var _from = req.body.from;
var _to = req.body.to;
var _ether = req.body.value;
var private_key = Buffer.from(
req.body.private_key.substr(2),
'hex',
);
// Tengo que convertir el dinero que viene en ARS a USD
try{
var arsToUsd = await sails.helpers.arsToUsd(_ether);
sails.log("ArsToUSD:", arsToUsd);
} catch (e){
throw 'No se pudo obtener la cotización del USD';
}
// Tengo que convertir el dinero USD a ETH
try{
var usdToEth = await sails.helpers.usdToEth(arsToUsd);
sails.log("USDToEth:", usdToEth);
} catch (e){
throw 'No se pudo obtener la cotización ETH';
}
web3.eth.getTransactionCount(_from, (err, txCount) => {
sails.log("Nonce", txCount);
// Construir la transaccion
const txObject = {
nonce: web3.utils.toHex(txCount),
to: _to,
gasLimit: web3.utils.toHex(21000),
gasPrice: web3.utils.toHex(web3.utils.toWei('1000', 'gwei')),
value: web3.utils.toHex(web3.utils.toWei(usdToEth.toString(), "ether")),
}
// Firmar la transaccion
const tx = new Tx(txObject);
tx.sign(private_key);
const serializeTransaction = tx.serialize();
const raw = '0x' + serializeTransaction.toString('hex');
// Transmitir la transacción
web3.eth.sendSignedTransaction(raw, (err, tx_hash) => {
if(err){
return res.json({
status: 'error',
error: err.toString()
});
}
return res.json({
status: 'ok',
tx_hash : tx_hash
});
});
});
},
}; };
/**
* CeloController
*
* @description :: Server-side actions for handling incoming requests.
* @help :: See https://sailsjs.com/docs/concepts/actions
*/
const ContractKit = require('@celo/contractkit');
const kit = ContractKit.newKit(sails.config.custom.urlRpcCelo);
const Web3 = require('web3');
var web3 = new Web3();
module.exports = {
createAccount : async function (req, res){
sails.log("createAccount()");
var account_data = web3.eth.accounts.create();
return res.json(account_data);
},
getBalance : async function (req, res){
var account = req.params.account;
let goldtoken = await kit.contracts.getGoldToken()
let balance = await goldtoken.balanceOf(account)
sails.log("-------------------------------------------------------");
return res.json(balance);
},
send : async function (req, res){
sails.log('Send()');
sails.log(req.body)
// 10. Get your account
let from = req.body.from
// 11. Add your account to ContractKit to sign transactions
kit.addAccount(req.body.private_key)
// 12. Specify recipient Address
let to = req.body.to
// 13. Specify an amount to send
let amount = req.body.value
// 14. Get the Gold Token contract wrapper
let goldtoken = await kit.contracts.getGoldToken()
sails.log("Camperiño")
// 15. Transfer gold from your account to anAddress
let tx = await goldtoken.transfer(to, amount).send({from: from})
// 16. Wait for the transaction to be processed
let receipt = await tx.waitReceipt()
// 17. Print receipt
console.log('Transaction receipt: %o', receipt)
// 18. Get your new balance
let balance = await goldtoken.balanceOf(from)
// 19. Print new balance
console.log(`Your new account balance: ${balance.toString()}`)
if(req.body.phone){
var notificacion = `Your transaction was successfully sent ! The hash is ${receipt.transactionHash}. Greetings team Celo`;
// Notifico por whatsapp
await sails.helpers.enviarWhatsapp.with({
texto: notificacion,
numero: req.body.phone,
});
}
return res.json({
status: 'ok',
tx: receipt
})
}
};
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
const Web3 = require('web3'); const Web3 = require('web3');
const Tx = require('ethereumjs-tx'); const Tx = require('ethereumjs-tx');
const base64 = require('nodejs-base64-encode'); const base64 = require('nodejs-base64-encode');
const axios = require('axios');
const url = sails.config.custom.urlRpcRinkeby; const url = sails.config.custom.urlRpcRinkeby;
const web3 = new Web3(url); const web3 = new Web3(url);
const accountAddress = sails.config.custom.accountAddressRinkeby; const accountAddress = sails.config.custom.accountAddressRinkeby;
...@@ -148,22 +149,108 @@ module.exports = { ...@@ -148,22 +149,108 @@ module.exports = {
}, },
createAccount : async function (req, res){ createAccount : async function (req, res){
sails.log("createAccount()"); sails.log("createAccount()");
var account_data = web3.eth.accounts.create(); try{
return res.json(account_data); var account_data = web3.eth.accounts.create();
} catch (e){
throw 'No se pudo crear la cuenta';
}
return res.json(account_data);
}, },
getBalance : async function (req, res){ getBalance : async function (req, res){
var account = req.params.account; var account = req.params.account;
web3.eth.getBalance(account,async (err, bal) => {
if(err){
return res.json(err.toString());
}
var balanceToEther = web3.utils.fromWei(bal, 'ether')
sails.log("Balance Ether:", balanceToEther);
web3.eth.getBalance(account, (err, bal) => { // Ahora consulto el Balance de esta criptomoneda expresado en USD
if(err){ try{
return res.json(err.toString()); var etherToUsd = await sails.helpers.ethToUsd(balanceToEther);
sails.log("EtherToUSD:", etherToUsd);
} catch (e){
throw 'No se pudo obtener la cotización del ETH';
} }
var balanceToEther = web3.utils.fromWei(bal, 'ether')
return res.json(balanceToEther); // Ahora convierto a Pesos
try{
}); var usdToArs = await sails.helpers.usdToArs(etherToUsd);
} sails.log("USDToARS:", usdToArs);
} catch (e) {
throw 'No se pudo obtener la cotización del USD';
}
sails.log("-------------------------------------------------------");
return res.json(usdToArs);
});
},
send: async function(req, res){
var _from = req.body.from;
var _to = req.body.to;
var _ether = req.body.value;
var private_key = Buffer.from(
req.body.private_key.substr(2),
'hex',
);
// Tengo que convertir el dinero que viene en ARS a USD
try{
var arsToUsd = await sails.helpers.arsToUsd(_ether);
sails.log("ArsToUSD:", arsToUsd);
} catch (e){
throw 'No se pudo obtener la cotización del USD';
}
// Tengo que convertir el dinero USD a ETH
try{
var usdToEth = await sails.helpers.usdToEth(arsToUsd);
sails.log("USDToEth:", usdToEth);
} catch (e){
throw 'No se pudo obtener la cotización ETH';
}
web3.eth.getTransactionCount(_from, (err, txCount) => {
sails.log("Nonce", txCount);
// Construir la transaccion
const txObject = {
nonce: web3.utils.toHex(txCount),
to: _to,
gasLimit: web3.utils.toHex(21000),
gasPrice: web3.utils.toHex(web3.utils.toWei('1000', 'gwei')),
value: web3.utils.toHex(web3.utils.toWei(usdToEth.toString(), "ether")),
}
// Firmar la transaccion
const tx = new Tx(txObject);
tx.sign(private_key);
const serializeTransaction = tx.serialize();
const raw = '0x' + serializeTransaction.toString('hex');
// Transmitir la transacción
web3.eth.sendSignedTransaction(raw, (err, tx_hash) => {
if(err){
return res.json({
status: 'error',
error: err.toString()
});
}
return res.json({
status: 'ok',
tx_hash : tx_hash
});
});
});
},
}; };
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
const Web3 = require('web3'); const Web3 = require('web3');
const Tx = require('ethereumjs-tx'); const Tx = require('ethereumjs-tx');
const base64 = require('nodejs-base64-encode'); const base64 = require('nodejs-base64-encode');
const axios = require('axios');
const url = sails.config.custom.urlRpcRsk; const url = sails.config.custom.urlRpcRsk;
const web3 = new Web3(url); const web3 = new Web3(url);
const accountAddress = sails.config.custom.accountAddressRsk; const accountAddress = sails.config.custom.accountAddressRsk;
...@@ -156,14 +157,97 @@ module.exports = { ...@@ -156,14 +157,97 @@ module.exports = {
getBalance : async function (req, res){ getBalance : async function (req, res){
var account = req.params.account; var account = req.params.account;
web3.eth.getBalance(account, (err, bal) => { web3.eth.getBalance(account,async (err, bal) => {
if(err){ if(err){
return res.json(err.toString()); return res.json(err.toString());
} }
var balanceToEther = web3.utils.fromWei(bal, 'ether') var balanceToEther = web3.utils.fromWei(bal, 'ether')
return res.json(balanceToEther); sails.log("Balance Ether:", balanceToEther);
// Ahora consulto el Balance de esta criptomoneda expresado en USD
try{
var rbtcToUsd = await sails.helpers.rbtcToUsd(balanceToEther);
sails.log("RbtcToUSD:", rbtcToUsd);
} catch (e){
throw 'No se pudo obtener la cotización del RBTC';
}
// Ahora convierto a Pesos
try{
var usdToArs = await sails.helpers.usdToArs(rbtcToUsd);
sails.log("USDToARS:", usdToArs);
} catch (e){
throw 'No se pudo obtener la cotización del USD';
}
sails.log("-------------------------------------------------------");
return res.json(usdToArs);
}); });
} },
send: async function(req, res){
var _from = req.body.from;
var _to = req.body.to;
var _ether = req.body.value;
var private_key = Buffer.from(
req.body.private_key.substr(2),
'hex',
);
// Tengo que convertir el dinero que viene en ARS a USD
try{
var arsToUsd = await sails.helpers.arsToUsd(_ether);
sails.log("ArsToUSD:", arsToUsd);
} catch (e) {
throw 'No se pudo obtener la cotización del USD';
}
// Tengo que convertir el dinero USD a ETH
try{
var usdToRbtc = await sails.helpers.usdToRbtc(arsToUsd);
sails.log("USDToRBTC:", usdToRbtc);
} catch (e){
throw 'No se pudo obtener la cotización RBTC';
}
web3.eth.getTransactionCount(_from, (err, txCount) => {
sails.log("Nonce", txCount);
// Construir la transaccion
const txObject = {
nonce: web3.utils.toHex(txCount),
to: _to,
gasLimit: web3.utils.toHex(21000),
gasPrice: web3.utils.toHex(web3.utils.toWei('1000', 'gwei')),
value: web3.utils.toHex(web3.utils.toWei(usdToRbtc.toString().substring(0, 16), "ether")),
}
// Firmar la transaccion
const tx = new Tx(txObject);
tx.sign(private_key);
const serializeTransaction = tx.serialize();
const raw = '0x' + serializeTransaction.toString('hex');
// Transmitir la transacción
web3.eth.sendSignedTransaction(raw, (err, tx_hash) => {
if(err){
return res.json({
status: 'error',
error: err.toString()
});
}
return res.json({
status: 'ok',
tx_hash : tx_hash
});
});
});
},
}; };
const axios = require('axios');
module.exports = {
friendlyName: 'Ars to usd',
description: '',
inputs: {
ars : {
type : 'number',
required : true
},
},
exits: {
success: {
description: 'All done.',
},
},
fn: async function (inputs) {
var openexchange = await axios({
method : 'GET',
url : `https://openexchangerates.org/api/latest.json?app_id=${sails.config.custom.openExchangeRatesAppId}&symbols=ARS`,
})
.then((result) => {
return result.data.rates.ARS;
})
.catch(err => {
console.log(err);
});
if(openexchange){
sails.log("Tasa de conversión USD/ARS:", openexchange);
var arsToUsd = inputs.ars / openexchange;
} else {
openexchange = 67.4556; // Camperiño
sails.log("********Tasa de conversión USD/ARS:", openexchange);
var arsToUsd = inputs.ars / openexchange;
}
return arsToUsd;
}
};
const axios = require('axios');
const querystring = require('querystring'); // Luego modificar envíos por POST
const util = require('util');
module.exports = {
friendlyName: 'Enviar whatsapp',
description: '',
inputs: {
texto: {
type: 'string',
require : true
},
numero: {
type: 'string',
require: true
}
},
exits: {
success: {
description: 'All done.',
},
},
fn: async function (inputs) {
var data = querystring.stringify({
texto : inputs.texto,
telefono : inputs.numero
});
const response = await axios.get('http://190.105.227.247/~umbot/api-whatsapp/?'+data)
.then((response) => {
sails.log(response);
return response;
})
.catch((err) => {
return {
status : 201,
statusText : String(err.message),
}
});
// Respuesta
if(response.status == 200 && response.statusText == 'OK'){
sails.log.info(
'Send whatsapp complete: \n'+
util.inspect(inputs,{depth:null})
);
return {
status : 'ok',
};
} else {
sails.log.info(
'Send whatsapp incomplete: \n'+
util.inspect(inputs,{depth:null})
);
return {
status : 'fail'
};
}
}
};
const axios = require('axios');
module.exports = {
friendlyName: 'Eth to usd',
description: '',
inputs: {
eth : {
type : 'number',
required : true
}
},
exits: {
success: {
description: 'All done.',
},
},
fn: async function (inputs) {
// TODO:
//- Almacenar el valor obtenido en la BD
//- Calcular el tiempo de la última actualización
//- Si es más de una hs, actualizar, si no leer y devolver el valor de la BD
var exchangerate = await axios({
method : 'GET',
url : 'https://rest.coinapi.io/v1/exchangerate/ETH/USD',
headers: {
'X-CoinAPI-Key' : sails.config.custom.xCoinApiKey,
},
})
.then((result) => {
return result.data.rate;
})
.catch(err => {
console.log(err.response.data);
});
if(exchangerate){
sails.log("Tasa de conversion ETH/USD:", exchangerate);
var etherToUsd = inputs.eth * exchangerate;
} else {
exchangerate = 190.8182377954368; // Camperiño
sails.log("***** Tasa de conversion ETH/USD:", exchangerate);
var etherToUsd = inputs.eth * exchangerate;
}
return etherToUsd;
}
};
const axios = require('axios');
module.exports = {
friendlyName: 'Rbtc to usd',
description: '',
inputs: {
rbtc : {
type : 'number',
required : true
}
},
exits: {
success: {
description: 'All done.',
},
},
fn: async function (inputs) {
var exchangerate = await axios({
method : 'GET',
url : 'https://rest.coinapi.io/v1/exchangerate/RBTC/USD',
headers: {
'X-CoinAPI-Key' : sails.config.custom.xCoinApiKey,
},
})
.then((result) => {
return result.data.rate;
})
.catch(err => {
console.log(err.response.data);
});
if(exchangerate){
sails.log("Tasa de conversion RBTC/USD:", exchangerate);
var rbtcToUsd = inputs.rbtc * exchangerate;
} else {
exchangerate = 8869.059502279988; // Camperiño
sails.log("***** Tasa de conversion RBTC/USD:", exchangerate);
var rbtcToUsd = inputs.rbtc * exchangerate;
}
return rbtcToUsd;
}
};
const axios = require('axios');
module.exports = {
friendlyName: 'Usd to ars',
description: '',
inputs: {
usd : {
type : 'number',
required : true
},
},
exits: {
success: {
description: 'All done.',
},
},
fn: async function (inputs) {
var openexchange = await axios({
method : 'GET',
url : `https://openexchangerates.org/api/latest.json?app_id=${sails.config.custom.openExchangeRatesAppId}&symbols=ARS`,
})
.then((result) => {
return result.data.rates.ARS;
})
.catch(err => {
console.log(err);
});
if(openexchange){
sails.log("Tasa de conversión USD/ARS:", openexchange);
var usdToArs = inputs.usd * openexchange;
} else {
openexchange = 67.4556; // Camperiño
sails.log("******** Tasa de conversión USD/ARS:", openexchange);
var usdToArs = inputs.usd * openexchange;
}
return usdToArs;
}
};
const axios = require('axios');
module.exports = {
friendlyName: 'Usd to eth',
description: '',
inputs: {
usd : {
type : 'number',
required : true,
}
},
exits: {
success: {
description: 'All done.',
},
},
fn: async function (inputs) {
var exchangerate = await axios({
method : 'GET',
url : 'https://rest.coinapi.io/v1/exchangerate/ETH/USD',
headers: {
'X-CoinAPI-Key' : sails.config.custom.xCoinApiKey,
},
})
.then((result) => {
return result.data.rate;
})
.catch(err => {
console.log(err.response.data);
});
if(exchangerate){
sails.log("Tasa de conversion ETH/USD:", exchangerate);
var usdToEth = inputs.usd / exchangerate;
} else {
exchangerate = 190.8182377954368; // Camperiño
sails.log("***** Tasa de conversion ETH/USD:", exchangerate);
var usdToEth = inputs.usd / exchangerate;
}
return usdToEth;
}
};
const axios = require('axios');
module.exports = {
friendlyName: 'Usd to rbtc',
description: '',
inputs: {
usd : {
type : 'number',
required : true
}
},
exits: {
success: {
description: 'All done.',
},
},
fn: async function (inputs) {
var exchangerate = await axios({
method : 'GET',
url : 'https://rest.coinapi.io/v1/exchangerate/RBTC/USD',
headers: {
'X-CoinAPI-Key' : sails.config.custom.xCoinApiKey,
},
})
.then((result) => {
return result.data.rate;
})
.catch(err => {
console.log(err.response.data);
});
if(exchangerate){
sails.log("Tasa de conversion RBTC/USD:", exchangerate);
var usdToRbtc = inputs.usd / exchangerate;
} else {
exchangerate = 8869.059502279988; // Camperiño
sails.log("***** Tasa de conversion RBTC/USD:", exchangerate);
var usdToRbtc = inputs.usd / exchangerate;
}
return usdToRbtc;
}
};
/**
* Celo.js
*
* @description :: A model definition represents a database table/collection.
* @docs :: https://sailsjs.com/docs/concepts/models-and-orm/models
*/
module.exports = {
attributes: {
// ╔═╗╦═╗╦╔╦╗╦╔╦╗╦╦ ╦╔═╗╔═╗
// ╠═╝╠╦╝║║║║║ ║ ║╚╗╔╝║╣ ╚═╗
// ╩ ╩╚═╩╩ ╩╩ ╩ ╩ ╚╝ ╚═╝╚═╝
// ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗
// ║╣ ║║║╠╩╗║╣ ║║╚═╗
// ╚═╝╩ ╩╚═╝╚═╝═╩╝╚═╝
// ╔═╗╔═╗╔═╗╔═╗╔═╗╦╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
// ╠═╣╚═╗╚═╗║ ║║ ║╠═╣ ║ ║║ ║║║║╚═╗
// ╩ ╩╚═╝╚═╝╚═╝╚═╝╩╩ ╩ ╩ ╩╚═╝╝╚╝╚═╝
},
};
...@@ -49,6 +49,13 @@ module.exports.custom = { ...@@ -49,6 +49,13 @@ module.exports.custom = {
contractABIRsk: [{"constant":true,"inputs":[{"name":"ots","type":"string"}],"name":"getHash","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"ots","type":"string"}],"name":"getBlockNumber","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"ots","type":"string"},{"name":"file_hash","type":"string"}],"name":"verify","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"selfDestroy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"ots","type":"string"},{"name":"file_hash","type":"string"}],"name":"stamp","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"hash","type":"string"},{"indexed":true,"name":"ots","type":"string"}],"name":"Stamped","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"}],"name":"Deploy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"}],"name":"SelfDestroy","type":"event"}], contractABIRsk: [{"constant":true,"inputs":[{"name":"ots","type":"string"}],"name":"getHash","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"ots","type":"string"}],"name":"getBlockNumber","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"ots","type":"string"},{"name":"file_hash","type":"string"}],"name":"verify","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"selfDestroy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"ots","type":"string"},{"name":"file_hash","type":"string"}],"name":"stamp","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"hash","type":"string"},{"indexed":true,"name":"ots","type":"string"}],"name":"Stamped","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"}],"name":"Deploy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"}],"name":"SelfDestroy","type":"event"}],
contractAddressRsk : '0xbdc32baf7ae3b23A87fA87D98364846AE506fdc4', contractAddressRsk : '0xbdc32baf7ae3b23A87fA87D98364846AE506fdc4',
privateKeyRsk: 'D305B054E4E6965D92C79F3166D6BEFC07AD9B92CDC48B00FFA7937548974E6D', privateKeyRsk: 'D305B054E4E6965D92C79F3166D6BEFC07AD9B92CDC48B00FFA7937548974E6D',
// Datos Exchanges
xCoinApiKey: 'ED4DE42A-9F8D-4631-9ABD-DDC8E159B1F4',
openExchangeRatesAppId: '37ec0cc1dccd4564bd4f750ee6364c29',
// Datos para Cello
urlRpcCelo : 'https://alfajores-forno.celo-testnet.org',
}; };
...@@ -20,28 +20,55 @@ module.exports.routes = { ...@@ -20,28 +20,55 @@ module.exports.routes = {
***************************************************************************/ ***************************************************************************/
'/': { view: 'pages/homepage' }, '/': { view: 'pages/homepage' },
'GET /blockchain/verify/:ots/:file_hash' : 'BlockchainController.verify', //////////////////////////////////////
'GET /account/create' : 'AccountController.create', /////////// GET ////////////////////
'GET /account/get_balance/:account' : 'AccountController.getBalance', //////////////////////////////////////
// Metodos de ROPSTEN
'GET /ropsten/verify/:ots/:file_hash' : 'BlockchainController.verify',
'GET /ropsten/create_account' : 'BlockchainController.createAccount',
'GET /ropsten/get_balance/:account' : 'BlockchainController.getBalance',
// Metodos de RINKEBY
'GET /rinkeby/verify/:ots/:file_hash' : 'RinkebyController.verify', 'GET /rinkeby/verify/:ots/:file_hash' : 'RinkebyController.verify',
'GET /rinkeby/createAccount' : 'RinkebyController.createAccount', 'GET /rinkeby/create_account' : 'RinkebyController.createAccount',
'GET /rinkeby/get_balance/:account' : 'RinkebyController.getBalance', 'GET /rinkeby/get_balance/:account' : 'RinkebyController.getBalance',
// Metodos de BFA
'GET /bfa/verify/:ots/:file_hash' : 'BfaController.verify', 'GET /bfa/verify/:ots/:file_hash' : 'BfaController.verify',
'GET /bfa/createAccount' : 'BfaController.createAccount', 'GET /bfa/create_account' : 'BfaController.createAccount',
'GET /bfa/get_balance/:account' : 'BfaController.getBalance', 'GET /bfa/get_balance/:account' : 'BfaController.getBalance',
// Metodos de RSK
'GET /rsk/verify/:ots/:file_hash' : 'RskController.verify', 'GET /rsk/verify/:ots/:file_hash' : 'RskController.verify',
'GET /rsk/createAccount' : 'RskController.createAccount', 'GET /rsk/create_account' : 'RskController.createAccount',
'GET /rsk/get_balance/:account' : 'RskController.getBalance', 'GET /rsk/get_balance/:account' : 'RskController.getBalance',
// Metodos de Celo
//'GET /rsk/verify/:ots/:file_hash' : 'RskController.verify',
'GET /celo/create_account' : 'CeloController.createAccount',
'GET /celo/get_balance/:account' : 'CeloController.getBalance',
// METODOS VARIOS
'GET /accounts/get_payments' : 'AccountController.getPayments',
//////////////////////////////////////
/////////// POST ////////////////////
//////////////////////////////////////
'POST /ropsten/stamp' : 'BlockchainController.stamp',
'POST /ropsten/send' : 'BlockchainController.send',
'POST /transaction/send' : 'TransactionController.send',
'POST /blockchain/stamp' : 'BlockchainController.stamp',
'POST /rinkeby/stamp' : 'RinkebyController.stamp', 'POST /rinkeby/stamp' : 'RinkebyController.stamp',
'POST /bfa/stamp' : 'BfaController.stamp', 'POST /rinkeby/send' : 'RinkebyController.send',
'POST /rsk/stamp' : 'RskController.stamp', 'POST /rsk/stamp' : 'RskController.stamp',
'POST /rsk/send' : 'RskController.send',
'POST /bfa/stamp' : 'BfaController.stamp',
'POST /bfa/send' : 'BfaController.send',
'POST /celo/send' : 'CeloController.send',
/*************************************************************************** /***************************************************************************
......
source diff could not be displayed: it is too large. Options to address this: view the blob.
...@@ -5,18 +5,22 @@ ...@@ -5,18 +5,22 @@
"description": "a Sails application", "description": "a Sails application",
"keywords": [], "keywords": [],
"dependencies": { "dependencies": {
"@celo/contractkit": "^0.4.0",
"@sailshq/connect-redis": "^3.2.1", "@sailshq/connect-redis": "^3.2.1",
"@sailshq/lodash": "^3.10.3", "@sailshq/lodash": "^3.10.3",
"@sailshq/socket.io-redis": "^5.2.0", "@sailshq/socket.io-redis": "^5.2.0",
"axios": "^0.19.2",
"ethereumjs-tx": "^1.3.7", "ethereumjs-tx": "^1.3.7",
"grunt": "1.0.4", "grunt": "1.0.4",
"js-sha256": "^0.9.0", "js-sha256": "^0.9.0",
"nodejs-base64-encode": "^1.1.0", "nodejs-base64-encode": "^1.1.0",
"nodemon": "^2.0.3", "nodemon": "^2.0.3",
"querystring": "^0.2.0",
"sails": "^1.2.3", "sails": "^1.2.3",
"sails-hook-grunt": "^4.0.0", "sails-hook-grunt": "^4.0.0",
"sails-hook-orm": "^2.1.1", "sails-hook-orm": "^2.1.1",
"sails-hook-sockets": "^2.0.0", "sails-hook-sockets": "^2.0.0",
"util": "^0.12.3",
"web3": "^1.2.6" "web3": "^1.2.6"
}, },
"devDependencies": { "devDependencies": {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment