Skip to content

Commit

Permalink
Can use SA system and transfer, log filter updated
Browse files Browse the repository at this point in the history
  • Loading branch information
humblefirm committed Oct 1, 2018
1 parent c18bcfc commit 1951d95
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 36,443 deletions.
48 changes: 20 additions & 28 deletions client/base58.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
/* based on https://github.com/jbenet/go-base58/blob/master/base58.go */

var contract = "1thefull2bot"
var account_tb = "usrbalance"
//var contract = "humblefirm42"
var symbol = "COF"
var fee = 10000; //1.0000코인
var feeRstTime = 8 * 3600; // 8시간

var data = [];

$(document).ready(function () {
Expand All @@ -18,23 +13,23 @@ async function filterActions(data, account) {
var i = 0;
var ret = [];
for (i = 0; i < data.length; i++) {
if (data[i].action_trace.act.data.key != account&&data[i].action_trace.act.data.from != account) continue;
if (data[i].action_trace.act.data.key != account && data[i].action_trace.act.data.from != account) continue;
ret.push({
txid: data[i].action_trace.trx_id,
time: data[i].block_time,
type: data[i].action_trace.act.name,
info: data[i].action_trace.act.data
});
}
return ret;
return ret;
}
async function getAllActions(contract, part = 100) {
var last = await eos.getActions(contract, -1, -1);
last = last.actions[0].account_action_seq;
if (last == undefined) return "Contract account undefined";
var i = 0;
if(data!=undefined&&data.length>0) i=data[data.length-1].account_action_seq;
console.log(i+""+last);
if (data != undefined && data.length > 0) i = data[data.length - 1].account_action_seq;
console.log(i + "" + last);
while (i < last) {
var offset = part;
if (i + part > last) offset = last - i;
Expand Down Expand Up @@ -116,23 +111,21 @@ async function transfer(wif, to, amount, memo) {
return ret;
}
async function sendmoney(from, to, amount, memo, sig) {
return eos.transaction({
actions: [{
account: contract,
name: 'transfer',
authorization: [{
actor: contract,
permission: 'pub'
}],
data: {
sender: from,
receiver: to,
amount: amount,
memo: memo,
sig: sig
}
}]
}).then();
data = {
sender: from,
receiver: to,
amount: amount,
memo: memo,
sig: sig
}
return httpGet(SAurl+"/transfer?data="+encodeURI(JSON.stringify(data)));
}
function httpGet(theUrl)
{
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
xmlHttp.send( null );
return xmlHttp.responseText;
}
async function getaccount(key) {
var ret;
Expand Down Expand Up @@ -168,7 +161,6 @@ function maketxdata(from, to, amount, memo, nonce, key) {

for (i = 0; i < 8; i++)
e.push(nonceD[i]);
console.log(a.concat(b).concat(c).concat(d).concat(e));
return eosjs_ecc.signHash(eosjs_ecc.sha256(a.concat(b).concat(c).concat(d).concat(e)), key);
}

Expand Down
14 changes: 10 additions & 4 deletions client/config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
var eos = Eos({
var contract = "humblefirm42" // NEED CHANGE
var SAurl = "http://127.0.0.1:9880"
/*var eos = Eos({
httpEndpoint: 'https://api1.eosasia.one',
chainId: 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906',
keyProvider: "privatekeyhere", // NEED CHANGE
debug: true
})
var contract = "1thefull2bot" // NEED CHANGE
})*/
var eos = Eos({
httpEndpoint: 'https://api-kylin.eosasia.one',
chainId: '5fff1dae8dc8e2fc4d5b23b2c7665c97f9e9d8edf2b6485a86ba311c25639191',
debug: true
})
var account_tb = "usrbalance"
var symbol = "WDF"
var symbol = "COF"
var fee = 10000; //1.0000코인
var feeRstTime = 8 * 3600; // 8시간

0 comments on commit 1951d95

Please sign in to comment.