/* * @project: TERA * @version: Development (beta) * @license: MIT (not for evil) * @copyright: Yuriy Ivanov (Vtools) 2017-2019 [progr76@gmail.com] * Web: https://terafoundation.org * Twitter: https://twitter.com/terafoundation * Telegram: https://t.me/terafoundation */ "use strict"; const NAMES_TYPE_TRANSACTION = 10; class NameApp extends require("./dapp") { KeyValueMap; CurrentNameArr; constructor() { super() this.KeyValueMap = {} this.CurrentNameArr = "" global.NAMES = this } OnWriteTransaction(Block, Body, BlockNum, TrNum) { return; if (Body[0] === NAMES_TYPE_TRANSACTION) { var StrKey = global.GetHexFromAddres(Body.slice(1, 33)); if (!this.KeyValueMap[StrKey]) { this.KeyValueMap[StrKey] = Body.slice(33) if (global.CompareArr(Body.slice(33), this.Server.addrArr) === 0) this.CurrentNameArr = Body.slice(1, 33) } } } }; module.exports = NameApp; var Names = new NameApp; global.DApps["Names"] = Names; global.DAppByType[NAMES_TYPE_TRANSACTION] = Names;