tera/Source/dapp/dapp.js
progr76@gmail.com 5affe69fe0 0.886
2019-02-16 20:08:41 +03:00

75 lines
1.3 KiB
JavaScript

/*
* @project: TERA
* @version: Development (beta)
* @license: MIT (not for evil)
* @copyright: Yuriy Ivanov 2017-2019 [progr76@gmail.com]
* Web: https://terafoundation.org
* Twitter: https://twitter.com/terafoundation
* Telegram: https://web.telegram.org/#/im?p=@terafoundation
*/
"use strict";
const fs = require('fs');
class DApp
{
constructor()
{
}
Name()
{
return "";
}
SendMessage(Body, ToAddr)
{
SERVER.SendMessage(Body, ToAddr)
}
AddTransaction(Tr)
{
SERVER.AddTransaction(Tr)
}
GetScriptTransaction(Body)
{
return "";
}
GetVerifyTransaction(Block, BlockNum, TrNum, Body)
{
return 1;
}
ClearDataBase()
{
}
OnWriteBlockStart(Block)
{
}
OnWriteBlockFinish(Block)
{
}
OnDeleteBlock(Block)
{
}
OnWriteTransaction(Block, Body, BlockNum, TrNum)
{
}
OnMessage(Msg)
{
}
};
module.exports = DApp;
function ReqDir(Path)
{
if(fs.existsSync(Path))
{
var arr = fs.readdirSync(Path);
for(var i = 0; i < arr.length; i++)
{
var name = arr[i];
ToLog("Reg: " + name);
var name2 = Path + "/" + arr[i];
require(name2);
}
}
};
global.DApps = {};
global.DAppByType = {};