tera/Source/dapp/names.js
progr76@gmail.com 3029d69c0e 0.884
2019-02-10 22:53:54 +03:00

41 lines
1.1 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 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;