renorm
This commit is contained in:
parent
81bde913e9
commit
76d83e575c
|
@ -1,9 +0,0 @@
|
|||
const { store } = require("./index");
|
||||
|
||||
exports.deleteObjs = (paths) => new Promise((resolve, reject) => {
|
||||
var ops = [];
|
||||
for (i = 0; i < paths.length; i++) {
|
||||
ops.push({ type: 'del', path: paths[i] });
|
||||
}
|
||||
store.batch(ops, [resolve, reject, paths.length]);
|
||||
})
|
|
@ -44,3 +44,13 @@ function getPathSome(path, arg) {
|
|||
});
|
||||
}
|
||||
exports.getPathSome = getPathSome;
|
||||
|
||||
exports.deleteObjs = (paths) => new Promise((resolve, reject) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
var ops = [];
|
||||
for (i = 0; i < paths.length; i++) {
|
||||
ops.push({ type: 'del', path: paths[i] });
|
||||
}
|
||||
store.batch(ops, [resolve, reject, paths.length]);
|
||||
})
|
||||
})
|
4
index.js
4
index.js
|
@ -122,8 +122,8 @@ var recents = []
|
|||
//HIVE API CODE
|
||||
|
||||
//Start Program Options
|
||||
startWith('QmZQSh3za4wG1skPtC7HaehKHLdP8Ya9VbQni1YHDaL3GU', true) //for testing and replaying 58859101
|
||||
//dynStart(config.leader)
|
||||
//startWith('QmZQSh3za4wG1skPtC7HaehKHLdP8Ya9VbQni1YHDaL3GU', true) //for testing and replaying 58859101
|
||||
dynStart(config.leader)
|
||||
|
||||
// API defs
|
||||
api.use(API.https_redirect);
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
const config = require('./../config')
|
||||
const { ipfsVerify } = require('./../rtrades')
|
||||
const { store, unshiftOp } = require('./../index')
|
||||
//const { deleteObjs } = require('./../deleteObjs')
|
||||
const { store } = require('./../index')
|
||||
const { chronAssign } = require('./../lil_ops')
|
||||
const { getPathObj } = require('../getPathObj')
|
||||
var request = require('request');
|
||||
const { contentToDiscord } = require('./../discord')
|
||||
const { insertNewPost } = require('./../edb');
|
||||
|
||||
|
|
|
@ -439,7 +439,7 @@ exports.transfer = (json, pc) => {
|
|||
let msg = `@${json.from} bought ${parseFloat(parseInt(next.amount)/1000).toFixed(3)} ${config.TOKEN} with ${parseFloat(parseInt(next[order.pair])/1000).toFixed(3)} ${order.pair.toUpperCase()} from ${next.from} (${item})`
|
||||
ops.push({type: 'put', path: ['feed', `${json.block_num}:${json.transaction_id}.${i}`], data: msg})
|
||||
if(Object.keys(his).length)ops.push({type: 'put', path: ['dex', order.pair, 'his'], data: his})
|
||||
ops.push({type: 'put', path: ['msa', `${item}:${json.transaction_id}:${json.block_num}`], data: stringify(transfer)}) //send HIVE out via MS
|
||||
ops.push({type: 'put', path: ['msa', `${item}:${json.transaction_id}:${i}`], data: stringify(transfer)}) //send HIVE out via MS
|
||||
ops.push({type: 'del', path: ['dex', order.pair, 'sellOrders', `${price.toFixed(6)}:${item}`]}) //remove the order
|
||||
ops.push({type: 'del', path: ['contracts', next.from , item]}) //remove the contract
|
||||
ops.push({type: 'del', path: ['chrono', next.expire_path]}) //remove the chrono
|
||||
|
@ -475,7 +475,7 @@ exports.transfer = (json, pc) => {
|
|||
ops.push({type: 'put', path: ['feed', `${json.block_num}:${json.transaction_id}.${i}`], data: msg})
|
||||
ops.push({type: 'put', path: ['balances', json.from], data: bal})
|
||||
ops.push({type: 'put', path: ['dex', order.pair, 'his'], data: his})
|
||||
ops.push({type: 'put', path: ['msa', `${item}:${json.transaction_id}:${json.block_num}`], data: stringify(transfer)}) //send HIVE out via MS
|
||||
ops.push({type: 'put', path: ['msa', `${item}:${json.transaction_id}:${i}`], data: stringify(transfer)}) //send HIVE out via MS
|
||||
//ops.push({type: 'put', path: ['dex', order.pair, 'sellOrders', `${price.toFixed(6)}:${item}`], data: next}) //update the order
|
||||
ops.push({type: 'put', path: ['contracts', next.from , item], data: next}) //update the contract
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
const config = require('./../config')
|
||||
const { store } = require('./../index')
|
||||
const { deleteObjs } = require('./../deleteObjs')
|
||||
const { chronAssign } = require('./../lil_ops')
|
||||
const { getPathObj } = require('../getPathObj')
|
||||
const { postToDiscord, contentToDiscord } = require('./../discord')
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
const config = require('./../config')
|
||||
const { store } = require('./../index')
|
||||
const { getPathObj } = require('./../getPathObj')
|
||||
const { deleteObjs } = require('./../deleteObjs')
|
||||
const { getPathObj, deleteObjs } = require('./../getPathObj')
|
||||
const { isEmpty } = require('./../lil_ops')
|
||||
const { postToDiscord } = require('./../discord')
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
const config = require('./../config')
|
||||
const { store } = require("./../index");
|
||||
const hive = require('@hiveio/hive-js');
|
||||
const { getPathObj } = require("./../getPathObj");
|
||||
const { getPathObj, deleteObjs } = require("./../getPathObj");
|
||||
const { postToDiscord } = require('./../discord')
|
||||
const { deleteObjs } = require('./../deleteObjs')
|
||||
const { chronAssign } = require('./../lil_ops')
|
||||
const { verify_broadcast } = require('./../tally')
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
const config = require('./../config')
|
||||
const { store } = require("./../index");
|
||||
const { getPathObj, getPathNum } = require('./../getPathObj')
|
||||
const { deleteObjs } = require('./../deleteObjs');
|
||||
const { getPathObj, getPathNum, deleteObjs } = require('./../getPathObj')
|
||||
const { updatePostVotes } = require('./../edb');
|
||||
|
||||
exports.vote = (json, pc) => {
|
||||
|
|
23
processor.js
23
processor.js
|
@ -83,11 +83,6 @@ module.exports = function(client, steem, currentBlockNumber = 1, blockComputeSpe
|
|||
}
|
||||
getBlock(blockNum)
|
||||
.then((result) => {
|
||||
block_header[`${blockNum % 20}`] = {
|
||||
timestamp: result.timestamp,
|
||||
block_id: result.block_id,
|
||||
block_number: blockNum
|
||||
}
|
||||
processBlock(result, blockNum, vops)
|
||||
.then(r => {
|
||||
currentBlockNumber++;
|
||||
|
@ -166,7 +161,11 @@ module.exports = function(client, steem, currentBlockNumber = 1, blockComputeSpe
|
|||
if(Vops.length){
|
||||
transactional(Vops, 0, v[2], v[3], v[4])
|
||||
} else {
|
||||
onNewBlock(num, v, v[4].witness_signature, block_header[`${num % 20}`])
|
||||
onNewBlock(num, v, v[4].witness_signature, {
|
||||
timestamp: block.timestamp,
|
||||
block_id: block.block_id,
|
||||
block_number: num
|
||||
})
|
||||
.then(r => {
|
||||
pc[0](pc[2])
|
||||
})
|
||||
|
@ -175,7 +174,11 @@ module.exports = function(client, steem, currentBlockNumber = 1, blockComputeSpe
|
|||
})
|
||||
.catch(e=>{console.log(e);cycleapi()})
|
||||
} else {
|
||||
onNewBlock(num, v, v[4].witness_signature, block_header[`${num % 20}`])
|
||||
onNewBlock(num, v, v[4].witness_signature, {
|
||||
timestamp: block.timestamp,
|
||||
block_id: block.block_id,
|
||||
block_number: num
|
||||
})
|
||||
.then(r => {
|
||||
pc[0](pc[2])
|
||||
})
|
||||
|
@ -188,7 +191,11 @@ module.exports = function(client, steem, currentBlockNumber = 1, blockComputeSpe
|
|||
pc[1](e)
|
||||
})
|
||||
} else {
|
||||
onNewBlock(num, pc, block.witness_signature, block_header[`${num % 20}`])
|
||||
onNewBlock(num, pc, block.witness_signature, {
|
||||
timestamp: block.timestamp,
|
||||
block_id: block.block_id,
|
||||
block_number: num
|
||||
})
|
||||
.then(r => {
|
||||
r[0]()
|
||||
})
|
||||
|
|
3
tally.js
3
tally.js
|
@ -1,6 +1,5 @@
|
|||
const config = require('./config');
|
||||
const { getPathObj, getPathNum } = require("./getPathObj");
|
||||
const { deleteObjs } = require('./deleteObjs')
|
||||
const { getPathObj, getPathNum, deleteObjs } = require("./getPathObj");
|
||||
const { store, exit, hiveClient, plasma } = require("./index");
|
||||
const { updatePost } = require('./edb');
|
||||
const {
|
||||
|
|
Loading…
Reference in New Issue