tera/Source/dapp/dapp.js

75 lines
1.3 KiB
JavaScript
Raw Normal View History

2019-02-10 19:53:54 +00:00
/*
* @project: TERA
* @version: Development (beta)
* @license: MIT (not for evil)
2019-03-16 16:08:05 +00:00
* @copyright: Yuriy Ivanov (Vtools) 2017-2019 [progr76@gmail.com]
2019-02-10 19:53:54 +00:00
* 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 "";
}
2019-02-16 17:08:41 +00:00
GetVerifyTransaction(Block, BlockNum, TrNum, Body)
2019-02-10 19:53:54 +00:00
{
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 = {};