tera/Source/dapp/names.js

41 lines
1.1 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 NAMES_TYPE_TRANSACTION = 10;
class CApp extends require("./dapp")
{
constructor()
{
super()
this.KeyValueMap = {}
this.CurrentNameArr = ""
global.NAMES = this
}
OnWriteTransaction(Block, Body, BlockNum, TrNum)
{
return ;
if(Body[0] === NAMES_TYPE_TRANSACTION)
{
var StrKey = GetHexFromAddres(Body.slice(1, 33));
if(!this.KeyValueMap[StrKey])
{
this.KeyValueMap[StrKey] = Body.slice(33)
if(CompareArr(Body.slice(33), this.Server.addrArr) === 0)
this.CurrentNameArr = Body.slice(1, 33)
}
}
}
};
module.exports = CApp;
var App = new CApp;
DApps["Names"] = App;
DAppByType[NAMES_TYPE_TRANSACTION] = App;