@dirvine
Thank you, I decided to take the reactions of the community with pleasure and humor because it serves no purpose on my part to be hostile, because the most important is to answer the thenic questions, I know that in no time I will Start the development, and I will have 8-12 hours of work a day, but my humor is not meant insulting but sympathetic.
“من عاشر قوما 40 يوما صار منهم” This saying says, when one lives with a people for 40 days, one becomes one of theirs, so better to put me at ease, as it will do soon 40 days.
@happybeign
It is not that I do not want to give everything, I am content to explain the essential points, so that the community understands and advances with me.
At the same time, I could have given bits of code every time but I preferred to give ideas and work with the community, I want the community to develop the project in its head, at the same time that I develop.
And at the same time it’s true that I have to keep one can code closed, and not all reveal until startup at least. To preserve competitiveness, but also, for example, cards, there are currently only very few who have real partners who accept their cards. The others are mainly scams and scam copies. I do not want NVO to suffer the same thing.
Once NVO is launched we will open the code so that others can use it and compete with NVO, and it is in NVO’s interest for exchange users to become more familiar with DEX.
This is a good way to compete with Poloniex in the future.
I know that giving a few pieces of code would attract more investors, its may impress some, but the goal is not to impress, but to make it clear.
This small piece of code, costs $ 150m:
function BancorToken(string _name, string _symbol, uint8 _numDecimalUnits, address _formula, address _events) {
if (bytes(_name).length == 0 || bytes(_symbol).length < 1 || bytes(_symbol).length > 6 || _formula == 0x0) // validate input
throw;
name = _name;
symbol = _symbol;
numDecimalUnits = _numDecimalUnits;
formula = _formula;
events = _events;
if (events == 0x0)
return;
BancorEvents eventsContract = BancorEvents(events);
eventsContract.newToken();
}
Here is a small part of the code, in the state of draft that is being matured for the next wallet:
// Get the basic Informations
var Wallets = {};
Wallets.Bitcoin = JSON.parse(localStorage.getItem('btcWallet'));
Wallets.Ethereum = JSON.parse(localStorage.getItem('ethWallet'));
Wallets.Ripple = JSON.parse(localStorage.getItem('xrpWallet'));
var userInfo = JSON.parse(localStorage.getItem('userInfo'));
var Dialogs = require('dialogs');
var dialogs = Dialogs(opts={})
const{clipboard} = require('electron');
//const {RippleAPI} = require('ripple-lib');
//const api = new RippleAPI({
// server: 'wss://s1.ripple.com' // Public rippled server
//server: 'wss://54.213.214.68:51233 ' // Public rippled testnet server in maintenance
//});
setEvent();
leftPanelPrice('Bitcoin');
getTxs();
logTXS('Bitcoin');
$("#currenciesList li").click(function(){
$("#currenciesList li.current").toggleClass('current');
$(this).toggleClass('current');
data = $("#currenciesList li.current").find('span.name').html();
if (data == 'Bitcoin'){
$("#Address").attr('placeholder',"Bitcoin Address");
$("#Amount").attr('placeholder',"0.123456789");
$("#Ticker").html("BTC");
}else if(data == 'Ethereum'){
$("#Address").attr('placeholder',"Ethereum Address");
$("#Amount").attr('placeholder',"0.123456789");
$("#Ticker").html("ETH");
}else if(data == "Ripple"){
$("#Address").attr('placeholder',"Ripple Address");
$("#Amount").attr('placeholder',"0.1234");
$("#Ticker").html("XRP");
}
setEvent();
});
$("#deposit").click(function(){
data = $("#currenciesList li.current").find('span.name').html();
qrimage(data);
if (data == "Bitcoin"){$("#depositAddress").html(Wallets.Bitcoin.Address);}
else if(data == "Ethereum"){$("#depositAddress").html('0x'+Wallets.Ethereum.Address[0]);}
else if(data == "Ripple"){$("#depositAddress").html(Wallets.Ripple.Address);}
});
$("#PrivKey").click(function(){
data = $("#currenciesList li.current").find('span.name').html();
if (data == "Bitcoin"){dialogs.alert('Please BackUp this key '+ Wallets.Bitcoin.PrivKey);}
else if(data == "Ethereum"){dialogs.alert('Please BackUp this Seed : '+ Wallets.Ethereum.seed);}
else if(data == "Ripple"){dialogs.alert('Please BackUp this Secret : '+ Wallets.Ripple.Secret);}
});
$("#Send").click(function(){
data = $("#currenciesList li.current").find('span.name').html();
address = $("#Address").val();
value = $("#Amount").val();
if (data == "Bitcoin"){
//console.log("bitcoin");
sendBitcoin(address, value);
$("#Address").val("");
$("#Amount").val("");
}
else if(data == "Ethereum"){
console.log("Ethereum");
sendEthereum(address, value);
$("#Address").val("");
$("#Amount").val("");
}
else if(data == "Ripple"){
console.log("Ripple");
sendRipple(address, value);
$("#Address").val("");
$("#Amount").val("");
}else{console.log("undefined error");}
});
$("#copyBtn").click(function(){
clipboard.writeText($("#depositAddress").html());
});
// Check transactions
function getTxs(){
// Bitcoin
if (Wallets.Bitcoin.Address) {
$.ajax({
//url: 'https://blockchain.info/rawaddr/Enter a Bitcoin Address', // For Test
url:'https://blockchain.info/rawaddr/'+ Wallets.Bitcoin.Address,
success: function(data) {
Wallets.Bitcoin.TXS = data.txs;
localStorage.setItem('btcWallet', JSON.stringify(Wallets.Bitcoin));
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
if (XMLHttpRequest.status == 0) {
dialogs.alert('Check Your Network.');
} else if (XMLHttpRequest.status == 404) {
dialogs.alert('Requested URL not found.');
} else if (XMLHttpRequest.status == 500) {
dialogs.alert('Internel Server Error.');
} else {
dialogs.alert('Unknow Error.\n' + XMLHttpRequest.responseText);
}
}
});
}else {dialogs.alert('Error at Bitcoin TXs check, please contact support.');}
// Ripple
if (Wallets.Ripple.Address){
//$.get('https://data.ripple.com/v2/accounts/rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn/transactions?type=Payment', function(data){Wallets.Ripple.TXS = data;}); // For Test
$.get('https://data.ripple.com/v2/accounts/'+ Wallets.Ripple.Address +'/transactions?type=Payment', function(data){Wallets.Ripple.TXS = data;});
}else {dialogs.alert('Error at Ripple TXs check, please contact support.');}
// Ethereum
if (Wallets.Ethereum.Address) {
/*$.get('http://api.etherscan.io/api?module=account&action=txlist&address=0xa15E770eB92D585Ce6ef5B0cC00b19cc0Def694b&startblock=0&endblock=99999999&sort=desc', function(data){
Wallets.Ethereum.TXS = data.result;
}); // For test*/
$.get('http://api.etherscan.io/api?module=account&action=txlist&address=0x'+ Wallets.Ethereum.Address +'&startblock=0&endblock=99999999&sort=asc', function(data){
Wallets.Ethereum.TXS = data;
});
}else {dialogs.alert('Error at Ethereum TXs check, please contact support.');}
}
function logTXS(coin){
if($(".table-data").children().length != 0){$(".table-data").html('');}
if($(".table-data").children().length == 0){
if(coin == "Bitcoin"){
leftPanelPrice(coin);
if (Wallets.Bitcoin.TXS.length == 0){
$(".table-data").append('<div style="text-align: center;color:white;"><p>No Transaction history.</p></div>');
}
else if(Wallets.Bitcoin.TXS.length > 0){
for(i = 0; i < Wallets.Bitcoin.TXS.length; i++){
txs = Wallets.Bitcoin.TXS[i];
cTX = {fees: 0};
txIn = {value:0}; txOut = {fees:0, value:0};
address = Wallets.Bitcoin.Address;
//address = "Enter a Bitcoin Address"; // For Test
if (txs.out.length > 0){
for(v = 0; v < txs.out.length; v++){
txout = txs.out[v];
if(txout.addr == address){
txOut.value = (txout.value/100000000);
cTX.type = "Received";
}
}
}else if(txs.out.length == 0){
if(txout.addr == address){
txOut.value = (txout.value/100000000);
cTX.type = "Received";
}
}
if (txs.inputs.length > 0){
for(v = 0; v < txs.inputs.length; v++){
txin = txs.inputs[v];
if(txin.prev_out.addr == address){
txIn.value = (txin.prev_out.value/100000000);
cTX.type = "Sent";
}
}
}else if(txs.inputs.length == 0){
txIn.value = (txin.prev_out.value/100000000);
if(txin.prev_out.addr == address){
cTX.type = "Sent";
}
}
cTX.fees = (txIn.value - txOut.value);
if (cTX.type == "Sent"){
cTX.value = (txin.prev_out.value - cTX.fees)/100000000;
}
if(cTX.type == "Received"){
cTX.value = (txout.value - cTX.fees)/100000000;
}
//console.log(txin.prev_out.value, txout.value, cTX.fees.toFixed(8));
date = new Date(txs.time *1000);
cTX.date = date.toLocaleString();
//Base
$(".table-data").append("<div id='tx"+i+"' class='row-append'></div>");
//First row and Open
$("#tx"+i).append('<div id="1Row'+i+'" class="row-tr row-td clearfix first-row"></div>');
$("#tx"+i).append('<div id="2Row'+i+'" class ="row-tr row-td open-wrapper"></div>');
//Open
open = $("#2Row"+i);
open.append('<div id="openBox'+i+'" class="open-boxs"></div>');
//OpenBox
openBox = $('#openBox'+i);
openBox.append('<div id="fEl'+i+'" class="el-row"></div>');
openBox.append('<div id="sEl'+i+'" class="el-row"></div>');
//First El
fEl = $('#fEl'+i);
fEl.append('<div id="fElfCol'+i+'" class="el-col el-col-8"></div>');
fEl.append('<div id="fElsCol'+i+'" class="el-col el-col-8"></div>');
fEl.append('<div id="fEltCol'+i+'" class="el-col el-col-8"></div>');
//First El First Col
fElfCol = $("#fElfCol"+i);
fElfCol.append('<div id="fElfColGrid'+i+'" class="grid-content"></div>');
//First El First Col Grid
fElfColGrid = $("#fElfColGrid"+i);
fElfColGrid.append('<span id="fElfColGridfSpan'+i+'" class="title-label">Date</span>');
fElfColGrid.append('<span id="fElfColGridsSpan'+i+'" class="color-white value">'+ cTX.date +'</span>');
//First El Second Col
fElsCol = $("#fElsCol"+i);
fElsCol.append('<div id="fElsColGrid'+i+'" class="grid-content"></div>');
//First El Second Col Grid
fElsColGrid = $("#fElsColGrid"+i);
fElsColGrid.append('<span class="title-label">TXID</span>');
fElsColGrid.append('<span href="https://www.blockchain.info/tx/'+ txs.hash +'"class="txid" style="color:#0062ff;">'+ txs.hash.slice(0,10) +'...</span>');
//First El Third Col
fEltCol = $("#fEltCol"+i);
fEltCol.append('<div id="fEltColGrid'+i+'" class="grid-content"></div>');
//First El Third Col Grid
fEltColGrid = $("#fEltColGrid"+i);
fEltColGrid.append('<span class="title-label">Fees</span>');
if(cTX.type == "Sent"){
fEltColGrid.append('<span class="color-white value">'+ cTX.fees.toFixed(8) +' BTC</span>');
}
if(cTX.type == "Received"){
fEltColGrid.append('<span class="color-white value"> --- BTC</span>');
}
// Second El
sEl = $('#sEl'+i);
sEl.append('<div id="sElfCol'+i+'" class="el-col el-col-8"></div>');
// Second El Firs Col
sElfCol = $("#sElfCol"+i);
sElfCol.append('<div id="sElfColGrid'+i+'" class="grid-content"></div>');
//Second El First Col Grid
sElfColGrid = $("#sElfColGrid"+i);
if(cTX.type == "Sent"){
sElfColGrid.append('<span class="title-label">To</span>');
sElfColGrid.append('<span href="https://www.blockchain.info/tx/'+ txout.addr +'" class="color-white value" style="color:#0062ff;">'+ txout.addr +'</span>');
}
if(cTX.type == "Received"){
sElfColGrid.append('<span class="title-label">From</span>');
sElfColGrid.append('<span href="https://www.blockchain.info/tx/'+ txin.prev_out.addr +'" class="color-white value" style="color:#0062ff;">'+ txin.prev_out.addr +'</span>');
}
//
// Step
//
// First Row
firstRow = $("#1Row"+i);
firstRow.append('<div id="1td'+i+'" class="col-td width67"></div>');
firstRow.append('<div id="2td'+i+'" class="col-td width33 text-right"></div>');
// TD 1
td1 = $("#1td"+i);
td1.append('<div id="td1spacing'+i+'" class="spacing"></div>');
// TD 1 Spacing
td1Spacing = $("#td1spacing"+i);
if(cTX.type == "Received"){
td1Spacing.append('<span id="1tdDate'+i+'" class="date"></span>');
td1SpacingDate = $("#1tdDate"+i);
td1SpacingDate.append(toWD(date)+'<span class="number">'+ date.getDate() +'</span>');
td1Spacing.append('<img id="1tdimg'+i+'" src="i/coins.svg" alt="img" class="img-title"></img>');
td1Spacing.append('<span id="1tdtitles'+i+'" class="titles">'+ cTX.type +'</span>');
}
if(cTX.type == "Sent"){
td1Spacing.append('<span id="1tdDate'+i+'" class="date"></span>');
td1SpacingDate = $("#1tdDate"+i);
td1SpacingDate.append(toWD(date)+'<span class="number">'+ date.getDate() +'</span>');
td1Spacing.append('<img id="1tdimg'+i+'" src="i/send.svg" alt="img" class="img-title"></img>');
td1Spacing.append('<span id="1tdtitles'+i+'" class="titles">'+ cTX.type +'</span>');
}
// TD 2
td2 = $("#2td"+i);
td2.append('<div id="td2spacing'+i+'" class="spacing"></div>');
// TD 2 Spacing
td2Spacing = $("#td2spacing"+i);
if(cTX.type == "Received"){
td2Spacing.append('<span class="add-number" style="color:green;">+'+ txOut.value.toFixed(8) +' BTC</span>');
}else if(cTX.type == "Sent"){
td2Spacing.append('<span class="add-number" style="color:red;">-'+ txIn.value.toFixed(8) +' BTC</span>');
}
}
}
}else if(coin == "Ethereum"){
leftPanelPrice(coin);
if (Wallets.Ethereum.TXS.result.length == 0){
$(".table-data").append('<div style="text-align: center;color:white;"><p>No Transaction history.</p></div>');
}
else if(!(Wallets.Ethereum.TXS.result) && !(Wallets.Ethereum.TXS)){
$(".table-data").append('<div style="text-align: center;color:white;"><p>No Transaction history.</p></div>');
}
else if(Wallets.Ethereum.TXS.length > 0){
for(i = 0; i < 10; i++){
txs = Wallets.Ethereum.TXS[i];
address = Wallets.Ethereum.Address;
//address = '0xa15E770eB92D585Ce6ef5B0cC00b19cc0Def694b'; // For Test
address = address.toLowerCase();
cTX = {Fees:0, Type:'', Value:0};
cTX.Fees = (txs.gasPrice / 10e+17) * (txs.gasUsed);
if(txs.from === address){
cTX.Type = 'Sent';
}else if(txs.to === address){
cTX.Type = 'Received';
}
cTX.Value = txs.value / 10e+17;localStorage.setItem('btcWallet', JSON.stringify(Wallets.Bitcoin));
localStorage.setItem('xrpWallet', JSON.stringify(Wallets.Ripple));
localStorage.setItem('ethWallet', JSON.stringify(Wallets.Ethereum));
cTX.Date = new Date(txs.timeStamp * 1000);
//Base
$(".table-data").append("<div id='tx"+i+"' class='row-append'></div>");
//First row and Open
$("#tx"+i).append('<div id="1Row'+i+'" class="row-tr row-td clearfix first-row"></div>');
$("#tx"+i).append('<div id="2Row'+i+'" class ="row-tr row-td open-wrapper"></div>');
//Open
open = $("#2Row"+i);
open.append('<div id="openBox'+i+'" class="open-boxs"></div>');
//OpenBox
openBox = $('#openBox'+i);
openBox.append('<div id="fEl'+i+'" class="el-row"></div>');
openBox.append('<div id="sEl'+i+'" class="el-row"></div>');
//First El
fEl = $('#fEl'+i);
fEl.append('<div id="fElfCol'+i+'" class="el-col el-col-8"></div>');
fEl.append('<div id="fElsCol'+i+'" class="el-col el-col-8"></div>');
fEl.append('<div id="fEltCol'+i+'" class="el-col el-col-8"></div>');
//First El First Col
fElfCol = $("#fElfCol"+i);
fElfCol.append('<div id="fElfColGrid'+i+'" class="grid-content"></div>');
//First El First Col Grid
fElfColGrid = $("#fElfColGrid"+i);
fElfColGrid.append('<span id="fElfColGridfSpan'+i+'" class="title-label">Date</span>');
fElfColGrid.append('<span id="fElfColGridsSpan'+i+'" class="color-white value">'+ cTX.Date.toLocaleDateString() +'</span>');
//First El Second Col
fElsCol = $("#fElsCol"+i);
fElsCol.append('<div id="fElsColGrid'+i+'" class="grid-content"></div>');
//First El Second Col Grid
fElsColGrid = $("#fElsColGrid"+i);
fElsColGrid.append('<span class="title-label">TXID</span>');
fElsColGrid.append('<span href="https://etherscan.io/tx/'+ txs.hash +'"class="txid" style="color:#0062ff;">'+ txs.hash.slice(0,10) +'...</span>');
//First El Third Col
fEltCol = $("#fEltCol"+i);
fEltCol.append('<div id="fEltColGrid'+i+'" class="grid-content"></div>');
//First El Third Col Grid
fEltColGrid = $("#fEltColGrid"+i);
fEltColGrid.append('<span class="title-label">Fees</span>');
if(cTX.Type == "Sent"){
fEltColGrid.append('<span class="color-white value">'+ cTX.Fees.toString() +' ETH</span>');
}
if(cTX.Type == "Received"){
fEltColGrid.append('<span class="color-white value"> --- ETH</span>');
}
// Second El
sEl = $('#sEl'+i);
sEl.append('<div id="sElfCol'+i+'" class="el-col el-col-8"></div>');
// Second El Firs Col
sElfCol = $("#sElfCol"+i);
sElfCol.append('<div id="sElfColGrid'+i+'" class="grid-content"></div>');
//Second El First Col Grid
sElfColGrid = $("#sElfColGrid"+i);
if(cTX.Type == "Sent"){
sElfColGrid.append('<span class="title-label">To</span>');
sElfColGrid.append('<span href="https://etherscan.io/address/'+ txs.to +'" class="color-white value" style="color:#0062ff;">'+ txs.to +'</span>');
}
if(cTX.Type == "Received"){
sElfColGrid.append('<span class="title-label">From</span>');
sElfColGrid.append('<span href="https://etherscan.io/address/'+ txs.from +'" class="color-white value" style="color:#0062ff;">'+ txs.from +'</span>');
}
//
// Step
//
// First Row
firstRow = $("#1Row"+i);
firstRow.append('<div id="1td'+i+'" class="col-td width67"></div>');
firstRow.append('<div id="2td'+i+'" class="col-td width33 text-right"></div>');
// TD 1
td1 = $("#1td"+i);
td1.append('<div id="td1spacing'+i+'" class="spacing"></div>');
// TD 1 Spacing
td1Spacing = $("#td1spacing"+i);
if(cTX.Type == "Received"){
td1Spacing.append('<span id="1tdDate'+i+'" class="date"></span>');
td1SpacingDate = $("#1tdDate"+i);
td1SpacingDate.append(toWD(cTX.Date)+'<span class="number">'+ cTX.Date.getDate() +'</span>');
td1Spacing.append('<img id="1tdimg'+i+'" src="i/coins.svg" alt="img" class="img-title"></img>');
td1Spacing.append('<span id="1tdtitles'+i+'" class="titles">'+ cTX.Type +'</span>');
}
if(cTX.Type == "Sent"){
td1Spacing.append('<span id="1tdDate'+i+'" class="date"></span>');
td1SpacingDate = $("#1tdDate"+i);
td1SpacingDate.append(toWD(cTX.Date)+'<span class="number">'+ cTX.Date.getDate() +'</span>');
td1Spacing.append('<img id="1tdimg'+i+'" src="i/send.svg" alt="img" class="img-title"></img>');
td1Spacing.append('<span id="1tdtitles'+i+'" class="titles">'+ cTX.Type +'</span>');
}
// TD 2
td2 = $("#2td"+i);
td2.append('<div id="td2spacing'+i+'" class="spacing"></div>');
// TD 2 Spacing
td2Spacing = $("#td2spacing"+i);
if(cTX.Type == "Received"){
td2Spacing.append('<span class="add-number" style="color:green;">+'+ cTX.Value.toFixed(8) +' ETH</span>');
}else if(cTX.Type == "Sent"){
td2Spacing.append('<span class="add-number" style="color:red;">-'+ cTX.Value.toFixed(8) +' ETH</span>');
}
}
}
}else if (coin == 'Ripple'){
leftPanelPrice(coin);
if (Wallets.Ripple.TXS.transactions.length == 0){
$(".table-data").append('<div style="text-align: center;color:white;"><p>No Transaction history.</p></div>');
}
else if(Wallets.Ripple.TXS.transactions.length > 0){
for(i = 0; i < Wallets.Ripple.TXS.transactions.length; i++){
txs = Wallets.Ripple.TXS.transactions[i];
if (txs.tx.TransactionType === "Payment" && typeof(txs.tx.Amount) === "string"){
cTX = txs.tx;
address = Wallets.Ripple.Address;
//address = "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"; // For Test
date = new Date(txs.date);
//Base
$(".table-data").append("<div id='tx"+i+"' class='row-append'></div>");
//First row and Open
$("#tx"+i).append('<div id="1Row'+i+'" class="row-tr row-td clearfix first-row"></div>');
$("#tx"+i).append('<div id="2Row'+i+'" class ="row-tr row-td open-wrapper"></div>');
//Open
open = $("#2Row"+i);
open.append('<div id="openBox'+i+'" class="open-boxs"></div>');
//OpenBox
openBox = $('#openBox'+i);
openBox.append('<div id="fEl'+i+'" class="el-row"></div>');
openBox.append('<div id="sEl'+i+'" class="el-row"></div>');
//First El
fEl = $('#fEl'+i);
fEl.append('<div id="fElfCol'+i+'" class="el-col el-col-8"></div>');
fEl.append('<div id="fElsCol'+i+'" class="el-col el-col-8"></div>');
fEl.append('<div id="fEltCol'+i+'" class="el-col el-col-8"></div>');
//First El First Col
fElfCol = $("#fElfCol"+i);
fElfCol.append('<div id="fElfColGrid'+i+'" class="grid-content"></div>');
//First El First Col Grid
fElfColGrid = $("#fElfColGrid"+i);
fElfColGrid.append('<span id="fElfColGridfSpan'+i+'" class="title-label">Date</span>');
fElfColGrid.append('<span id="fElfColGridsSpan'+i+'" class="color-white value">'+ date.toLocaleString() +'</span>');
//First El Second Col
fElsCol = $("#fElsCol"+i);
fElsCol.append('<div id="fElsColGrid'+i+'" class="grid-content"></div>');
//First El Second Col Grid
fElsColGrid = $("#fElsColGrid"+i);
fElsColGrid.append('<span class="title-label">TXID</span>');
fElsColGrid.append('<span href="https://charts.ripple.com/#/transactions/'+ txs.hash +'"class="txid" style="color:#0062ff;">'+ txs.hash.slice(0,10) +'...</span>');
//First El Third Col
fEltCol = $("#fEltCol"+i);
fEltCol.append('<div id="fEltColGrid'+i+'" class="grid-content"></div>');
//First El Third Col Grid
fEltColGrid = $("#fEltColGrid"+i);
fEltColGrid.append('<span class="title-label">Fees</span>');
if(cTX.Account == address){
fEltColGrid.append('<span class="color-white value">'+ cTX.Fee * 1000000 +' XRP</span>');
}
if(cTX.Destination == address){
fEltColGrid.append('<span class="color-white value"> --- XRP</span>');
}
// Second El
sEl = $('#sEl'+i);
sEl.append('<div id="sElfCol'+i+'" class="el-col el-col-8"></div>');
// Second El Firs Col
sElfCol = $("#sElfCol"+i);
sElfCol.append('<div id="sElfColGrid'+i+'" class="grid-content"></div>');
//Second El First Col Grid
sElfColGrid = $("#sElfColGrid"+i);
if(cTX.Account == address){
sElfColGrid.append('<span class="title-label">To</span>');
sElfColGrid.append('<span class="color-white value" style="color:#0062ff;">'+ cTX.Destination +'</span>');
}
if(cTX.Destination == address){
sElfColGrid.append('<span class="title-label">From</span>');
sElfColGrid.append('<span class="color-white value" style="color:#0062ff;">'+ cTX.Account +'</span>');
}
//
// Step
//
// First Row
firstRow = $("#1Row"+i);
firstRow.append('<div id="1td'+i+'" class="col-td width67"></div>');
firstRow.append('<div id="2td'+i+'" class="col-td width33 text-right"></div>');
// TD 1
td1 = $("#1td"+i);
td1.append('<div id="td1spacing'+i+'" class="spacing"></div>');
// TD 1 Spacing
td1Spacing = $("#td1spacing"+i);
if(cTX.Destination == address){
td1Spacing.append('<span id="1tdDate'+i+'" class="date"></span>');
td1SpacingDate = $("#1tdDate"+i);
td1SpacingDate.append(toWD(date)+'<span class="number">'+ date.getDate() +'</span>');
td1Spacing.append('<img id="1tdimg'+i+'" src="i/coins.svg" alt="img" class="img-title"></img>');
td1Spacing.append('<span id="1tdtitles'+i+'" class="titles">Received</span>');
}
if(cTX.Account == address){
td1Spacing.append('<span id="1tdDate'+i+'" class="date"></span>');
td1SpacingDate = $("#1tdDate"+i);
td1SpacingDate.append(toWD(date)+'<span class="number">'+ date.getDate() +'</span>');
td1Spacing.append('<img id="1tdimg'+i+'" src="i/send.svg" alt="img" class="img-title"></img>');
td1Spacing.append('<span id="1tdtitles'+i+'" class="titles">Sent</span>');
}
// TD 2
td2 = $("#2td"+i);
td2.append('<div id="td2spacing'+i+'" class="spacing"></div>');
// TD 2 Spacing
td2Spacing = $("#td2spacing"+i);
if(cTX.Destination == address){
td2Spacing.append('<span class="add-number" style="color:green;">+'+ cTX.Amount +' XRP</span>');
}
if(cTX.Account == address){
td2Spacing.append('<span class="add-number" style="color:red;">-'+ cTX.Amount +' XRP</span>');
}
}
}
}
}
$('.row-append .first-row').click(function(){
$(this).parent().toggleClass('open');
});
}
var shell = require('electron').shell;
//$("#tx0").toggleClass('open');
$('.txid').click(function(event){
event.preventDefault();
targ = event.target.attributes[0];
shell.openExternal(targ.value);
});
}
function toWD(date){
var weekday = new Array(7);
weekday[0] = "Sunday";
weekday[1] = "Monday";
weekday[2] = "Tuesday";
weekday[3] = "Wednesday";
weekday[4] = "Thursday";
weekday[5] = "Friday";
weekday[6] = "Saturday";
return weekday[date.getDay()];
}
/*--------------------------- Right Bar Management --------------------*/
var cList = $("#currenciesList");
/*--------------------------- Price Widget Management --------------------*/
function leftPanelPrice(coin){
var priceWidget = $("#priceWidget");
if(priceWidget.children().length != 0){priceWidget.html('');}
if(priceWidget.children().length == 0){
if(coin == 'Bitcoin'){
priceWidget.append('<a href="#" class="btn-right-menu"></a>');
priceWidget.append('<img src="i/orange-b.png" alt="img" class="title-img">');
priceWidget.append('<div id="PWtext" class="txt-area"></div>');
pwText = $("#PWtext");
pwText.append('<div class="name">Bitcoin</div>');
pwText.append('<div class="last-txt">'+ (Wallets.Bitcoin.Balance/100000000) +' BTC<span>($'+ Wallets.Bitcoin.Value.toFixed(4) +' USD)</span></div>');
}else if (coin == 'Ethereum'){
priceWidget.append('<a href="#" class="btn-right-menu"></a>');
priceWidget.append('<img src="i/ether.png" alt="img" class="title-img">');
priceWidget.append('<div id="PWtext" class="txt-area"></div>');
pwText = $("#PWtext");
pwText.append('<div class="name">Ethereum</div>');
pwText.append('<div class="last-txt">'+ Wallets.Ethereum.Balance +' ETH<span>($'+ Wallets.Ethereum.Value.toFixed(4) +' USD)</span></div>');
}else if (coin == 'Ripple'){
priceWidget.append('<a href="#" class="btn-right-menu"></a>');
priceWidget.append('<img src="i/ripple.png" alt="img" class="title-img">');
priceWidget.append('<div id="PWtext" class="txt-area"></div>');
pwText = $("#PWtext");
pwText.append('<div class="name">Ripple</div>');
pwText.append('<div class="last-txt">'+ Wallets.Ripple.Balance +' XRP<span>($'+ Wallets.Ripple.Value.toFixed(4) +' USD)</span></div>');
if (Wallets.Ripple.Balance === 0){
dialogs.alert(' To activate the account you must send 25 XRP to this address : '+ Wallets.Ripple.Address);
}
}
}
}
/*------------------- Bitcoin Send -------------------*/
function sendBitcoin(address, value){
value*=100000000;
bitcoin = require('bitcoinjs-lib');
blockexplorer = require('blockchain.info/blockexplorer');
push = require('blockchain.info/pushtx');
tx = new bitcoin.TransactionBuilder();
key = bitcoin.ECPair.fromWIF(Wallets.Bitcoin.PrivKey);
$.get('https://api.blockcypher.com/v1/btc/main/addrs/'+Wallets.Bitcoin.Address+'?unspentOnly=true',function(data){
if(!(data.txrefs)){
return dialogs.alert('Unable to create transaction. No coins available.');
}else if(data.txrefs.length === 1){
unspent = data.txrefs[0];
if(unspentValue >= value){
tx.addInput(unspent.tx_hash, unspent.tx_output_n);
fee = 150000; change = unspent.value - fee - value;
tx.addOutput(Wallets.Bitcoin.Address, change);
tx.addOutput(address, value);
tx.sign(0, key);
push.pushtx(tx.build().toHex());
}else{
dialogs.alert("Insufficient Balance");
}
}else if(data.txrefs.length > 1){
unspentSum = 0;
for (i = 0; i < data.txrefs.length; i++){
unspent = data.txrefs[i];
unspentSum += unspent.value;
}
if(unspentSum < value){
dialogs.alert('Insufficient Balance');
}else if(unspentSum >= value){
for (i = 0; i < data.txrefs.length; i++){
unspent = data.txrefs[i];
tx.addInput(unspent.tx_hash, unspent.tx_output_n);
}
fee = 150000;
change = unspentSum - fee - value;
tx.addOutput(Wallets.Bitcoin.Address, change);
tx.addOutput(address, value);
tx.sign(0, key);
push.pushtx(tx.build().toHex());
}
}
});
}
/*-------------------Send Ethereum -----------------*/
function sendEthereum(address, value){
lightwallet = require('eth-lightwallet');
txutils = lightwallet.txutils;
signing = lightwallet.signing;
encryption = lightwallet.encryption;
Web3 = require('web3');
web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/yrvzdiAodip86zWYujgS'));
keyStore = lightwallet.keystore;
userInfo = JSON.parse(localStorage.getItem('userInfo'));
gasPrice = (web3.eth.gasPrice).toString(10);
sendTo = address;
from = '0x'+ Wallets.Ethereum.Address[0];
value = (web3.toWei(value));
nonce = (web3.eth.getTransactionCount(from)) + 1
txOptions = {
gasPrice: 10000000000000,
gasLimit: 3000000,
value: value,
nonce: nonce,
data: undefined,
to: sendTo
};
keyStore.createVault({
password: userInfo.id,
seedPhrase: Wallets.Ethereum.seed
}, function (err, ks) {
ks.keyFromPassword(userInfo.id, function (err, pwDerivedKey) {
if (err) throw err;
ks.generateNewAddress(pwDerivedKey, 1);
addr = ks.getAddresses();
valueTx = txutils.valueTx(txOptions)
signedValueTx = signing.signTx(ks, pwDerivedKey, valueTx, "0x"+Wallets.Ethereum.Address[0]);
web3.eth.sendRawTransaction(signedValueTx.toString('hex'), function(err, hash) {
if (err){dialogs.alert(err);}
else{dialogs.alert(hash);}
});
});
});
}
I reached the post size limit, so i had to cut it.
In the current state, there is nothing impressive here, but in no time, it will change.
People make money blissfully, I prefer to make the community evolve.
See you in some hours, after i get some sleep.