tera/src/global.d.ts

722 lines
23 KiB
TypeScript
Raw Normal View History

export { };
import CSmartContract from './core/transaction-validator'
import CConsensus from './core/block-exchange'
import CTransport from './core/server'
declare global {
var nw: any;
interface TeraError {
code: string;
stack: any;
}
interface Window {
RUN_CLIENT: number;
RUN_SERVER: number;
}
namespace NodeJS {
interface Global {
//#region run-node.ts
DATA_PATH: string;
CODE_PATH: string;
HTTP_PORT_NUMBER: number;
LOCAL_RUN: number;
//#endregion
//#region main-process.ts
PROCESS_NAME: string;
POWPROCESS: number;
DEBUGPROCESS: any;
START_SERVER: number;
SetCalcPOW: Function;
RunStopPOWProcess: Function;
NEW_SERVER_PRIVATE_KEY: number;
//#endregion
//#region constant.ts
UPDATE_CODE_VERSION_NUM: number;
MIN_CODE_VERSION_NUM: number;
MINING_VERSION_NUM: number;
InitParamsArg: Function;
CONST_NAME_ARR: string[];
MAX_LENGTH_SENDER_MAP: number;
DELTA_START_SENDER_MAP: number;
NODES_DELTA_CALC_HOUR: number;
USE_HARD_API_V2: number;
USE_TICKET: number;
USE_CHECK_SENDING: number;
USE_LEVEL_WAY: number;
TR_TICKET_HASH_LENGTH: number;
BLOCKNUM_TICKET_ALGO: number;
WATCHDOG_BADACCOUNT: number;
WATCHDOG_DEV: number;
RESYNC_CONDITION: {
OWN_BLOCKS: number;
K_POW: number;
};
REST_BLOCK_SCALE: number;
REST_START_COUNT: number;
LOAD_TO_BEGIN: number;
DEBUG_WALLET: number;
CHECK_GLOBAL_TIME: number;
AUTO_CORRECT_TIME: number;
DELTA_CURRENT_TIME: number;
NODES_NAME: string;
COMMON_KEY: string;
SERVER_PRIVATE_KEY_HEX: string;
USE_NET_FOR_SERVER_ADDRES: number;
NET_WORK_MODE: {
ip?: string;
port?: number | string;
UseDirectIP?: boolean | number;
NodeWhiteList?: string;
DoRestartNode?: number;
}
STAT_MODE: number;
MAX_STAT_PERIOD: number;
UPDATE_NUM_COMPLETE: number;
WALLET_NAME: string;
WALLET_DESCRIPTION: string;
USE_MINING: number;
POW_MAX_PERCENT: number;
POW_RUN_COUNT: number;
POWRunPeriod: number;
CheckPointDelta: number;
ALL_LOG_TO_CLIENT: number;
LOG_LEVEL: number;
LIMIT_SEND_TRAFIC: number;
COUNT_VIEW_ROWS: number;
MIN_VER_STAT: number;
STOPGETBLOCK: number;
RESTART_PERIOD_SEC: number;
HARD_PACKET_PERIOD120: number;
MINING_START_TIME: string;
MINING_PERIOD_TIME: string;
CHECK_RUN_MINING: number;
CHECK_STOP_CHILD_PROCESS: number;
COUNT_MINING_CPU: number;
SIZE_MINING_MEMORY: number;
HTTP_HOSTING_PORT: number;
HTTPS_HOSTING_DOMAIN: string;
HTTP_MAX_COUNT_ROWS: number;
HTTP_ADMIN_PASSORD: string;
MIN_POWER_POW_HANDSHAKE: number;
USE_HINT: number;
ALL_VIEW_ROWS: number;
COUNT_BLOCK_PROOF: number;
COUNT_NODE_PROOF: number;
MIN_POWER_POW_MSG: number;
MEM_POOL_MSG_COUNT: number;
MAX_LEVEL_SPECIALIZATION: number;
MIN_CONNECT_CHILD: number;
MAX_CONNECT_CHILD: number;
MAX_CONNECTIONS_COUNT: number;
TRUST_PROCESS_COUNT: number;
MAX_NODES_RETURN: number;
MAX_WAIT_PERIOD_FOR_STATUS: number;
MAX_GRAY_CONNECTIONS_TO_SERVER: number;
MAX_PACKET_LENGTH: number;
COUNT_BLOCKS_FOR_LOAD: number;
TR_LEN: number;
BLOCK_PROCESSING_LENGTH: number;
BLOCK_PROCESSING_LENGTH2: number;
CONSENSUS_PERIOD_TIME: number;
MAX_BLOCK_SIZE: number;
MAX_TRANSACTION_SIZE: number;
MIN_TRANSACTION_SIZE: number;
MAX_TRANSACTION_COUNT: number;
MAX_TRANSACTION_LIMIT: number;
MIN_POWER_POW_TR: number;
MIN_POWER_POW_BL: number;
GENERATE_BLOCK_ACCOUNT: number;
TOTAL_SUPPLY_TERA: number;
TRANSACTION_PROOF_COUNT: number;
MIN_POWER_POW_ACC_CREATE: number;
START_MINING: number;
REF_PERIOD_MINING: number;
DELTA_BLOCK_ACCOUNT_HASH: number;
PERIOD_ACCOUNT_HASH: number;
START_BLOCK_ACCOUNT_HASH: number;
START_BLOCK_ACCOUNT_HASH3: number;
NEW_ACCOUNT_INCREMENT: number;
NEW_BLOCK_REWARD1: number;
NEW_FORMULA_START: number;
NEW_FORMULA_KTERA: number;
NEW_FORMULA_TARGET1: number;
NEW_FORMULA_TARGET2: number;
BLOCK_COUNT_IN_MEMORY: number;
HISTORY_BLOCK_COUNT: number;
MAX_SIZE_LOG: number;
READ_ONLY_DB: number;
USE_CHECK_SAVE_DB: number;
START_NETWORK_DATE: number;
NETWORK: string;
DEF_MAJOR_VERSION: string;
SMART_BLOCKNUM_START: number;
PRICE_DAO: Function;
NEW_SIGN_TIME: number;
TEST_TRANSACTION_GENERATE: number;
TEST_NETWORK: boolean | number;
START_PORT_NUMBER: number | string;
GetNetworkName: Function;
DEF_VERSION: string;
DEF_CLIENT: string;
FIRST_TIME_BLOCK: number;
START_BLOCK_RUN: number;
START_IP: string;
LISTEN_IP: string;
HTTP_PORT_PASSWORD: string;
HTTP_IP_CONNECT: string;
USE_AUTO_UPDATE: number;
USE_PARAM_JS: number;
CREATE_ON_START: boolean | number;
DEBUG_MODE: number;
RUN_CLIENT: number;
RUN_SERVER: number;
CHILD_POW: boolean;
ADDRLIST_MODE: boolean;
NWMODE: number;
NOALIVE: number;
DEV_MODE: number;
//#endregion
//#region startlib.ts
GetDataPath: (str: string) => string;
GetCodePath: (str: string) => string;
GetNormalPathString: (str: string) => string;
CheckCreateDir: (l, o?, t?) => void;
CopyFiles: (l, o, t) => void;
ToLog: Function;
//#endregion
TO_ERROR_LOG: Function;
ToLogClient: Function;
glCurNumFindArr: number;
ArrReconnect: any[];
ArrConnect: any[];
//#region main-process.ts:51
SERVER: CSmartContract | CConsensus | CTransport | any;
NeedRestart: number;
WEB_PROCESS: TeraProcess;
CountAllNode: number;
//#endregion
//#region main-process.ts:100
GetCurrentTime: Function;
//#endregion
//#region
SpeedSignLib: number;
TestSignLib: Function;
//#endregion
//#region main-process.ts:118
TX_PROCESS: TeraProcess
//#endregion
//#region main-process.ts:141
AddTransactionFromWeb: Function;
STATIC_PROCESS: TeraProcess;
//#endregion
//#region main-process.ts:204
WALLET: any;
//#endregion
//#region main-process.ts:342
StopChildProcess: Function;
//#endregion
//#region main-process.ts:375
MiningPaused: number;
ArrMiningWrk: any[];
//#endregion
//#region library.ts:118
DelDir: Function;
SliceArr: Function;
random: Function;
AddrLevelArrFromBegin: Function;
AddrLevelArr: Function;
SaveToFile: Function;
LoadParams: Function;
SaveParams: Function;
StartTime: Function;
FinishTime: Function;
CompareItemBufFD: Function;
CompareArr33: Function;
CompareItemHashSimple: Function;
CompareItemHash: any;
CompareItemHash32: Function;
CompareItemHASH32: Function;
CompareItemHash33: Function;
CompareItemHashPow: Function;
CompareItemTimePow: any;
LOAD_CONST: Function;
SAVE_CONST: Function;
CheckGlobalTime: Function;
GetDeltaCurrentTime: Function;
GetStrTimeUTC: Function;
GetStrOnlyTimeUTC: Function;
GetSecFromStrTime: Function;
DateFromBlock: Function;
NormalizeName: Function;
CreateEval: Function;
GetCountMiningCPU: Function;
AddTrMap: string[];
GrayConnect: Function;
//#endregion
//#region library.ts:118
RBTree: any;
ntpClient: any;
Stun: any;
ZIP: any;
secp256k1: any;
BufLib: any;
GetCurrentBlockNumByTime: Function;
TimeStart: number;
//#endregion
//#region run-nw.ts
NWVERSION: string;
HTTP_SERVER_START_OK: boolean | number;
NO_HISTORY_MODE: boolean;
//#endregion
// //#region crypto-library.ts
// MAX_SUPER_VALUE_POW: number;
// GetHexFromAddres: Function;
// GetArr32FromHex: Function;
// GetAddresFromHex: Function;
// GetHexAddresFromPublicKey: Function;
// GetHexFromArr: Function;
// GetArrFromHex: Function;
// GetHexFromArrBlock: Function;
// GetPublicKeyFromAddres: Function;
// CheckDevelopSign: Function;
// CheckContextSecret: Function;
// GetSignHash: Function;
// GetVerifyHash: Function;
// GetKeyPair: Function;
// GetKeyPairTest: Function;
// GetHashWithValues: Function;
// CreateNoncePOWExtern: Function;
// CreateNoncePOWExternMinPower: Function;
// CreateNoncePOWInner: Function;
// CreateAddrPOW: Function;
// CalcMerkl3FromArray: Function;
// CalcMerkl0FromArray: Function;
// ClientHex: Function;
// CalcHash3FromArray: Function;
// CalcHashFromArray: Function;
// CalcMerklFromArray: Function;
// CalcTreeHashFromArrBody: Function;
// UpdateMerklTree: Function;
// GetMerkleProof: Function;
// CheckMerkleProof: Function;
// IsZeroArr: Function;
// GetHashWithNonce: Function;
// GetPowPower: Function;
// GetArrFromValue: Function;
// GetPowValue: Function;
// Mesh: Function;
// Encrypt: Function;
// Decrypt: Function;
// toUTF8Array: Function;
// Utf8ArrayToStr: Function;
// GetArrFromStr: Function;
// IsDeveloperAccount: Function;
// DEVELOP_PUB_KEY_ARR: Buffer[] | string[];
// DEVELOP_PUB_KEY: any;
// DEVELOP_PUB_KEY0: Buffer;
// ARR_PUB_KEY: any;
// //#endregion
//#region log-strict.ts
CheckSizeLogFile: Function;
//#endregion
//#region log.ts
ArrLogClient: any[];
ToLogWeb: Function;
SmallAddr: Function;
ToErrorTrace: Function;
ToLogTrace: Function;
ToInfo: Function;
ToError: Function;
ToLogClient0: Function;
PrepareStatEverySecond: Function;
HASH_RATE: number;
ADD_HASH_RATE: Function;
GET_STAT: Function;
ADD_TO_STAT_TIME: Function;
ADD_TO_STAT: Function;
GET_STATDIAGRAMS: Function;
GET_STATS: Function;
StartCommonStat: Function;
ClearCommonStat: Function;
ResizeArrAvg: Function;
ResizeArrMax: Function;
TO_DEBUG_LOG: Function;
GetStrOnlyTime: Function;
GetStrTime: Function;
//#endregion
//#region geo.ts
SetGeoLocation: Function;
//#endregion
//#region geo.ts
WebApi2: any;
HostingCaller: any;
//#endregion
//#region web-process.ts
LoadBlockFromNetwork: (Params, F?) => any;
GlobalRunID: number;
//#endregion
//#region base.ts
glStopNode: any;
GetCheckAccHash: Function;
ReadHashFromBufDB: Function;
STreeBuffer: any;
TestCreateTr: Function;
//#endregion
//#region html-server.ts
HTTPCaller: any;
DappTemplateFile: Function;
DappSmartCodeFile: Function;
DappClientCodeFile: Function;
SendBlockFile: Function;
SetCheckPointOnBlock: Function;
SendHTMLMap: any;
SendWebFile: Function;
GetFileHTMLWithParsing: Function;
GetFileHTMLFromMarkdown: Function;
GetFileSimple: Function;
SaveFileSimple: Function; SetSafeResponce: Function;
GetUserContext: Function;
EventNum: number;
EventMap: any;
AddDappEventToGlobalMap: Function;
//#endregion
//#region accounts.ts
HistoryDB: any;
TYPE_TRANSACTION_CREATE: number;
TYPE_TRANSACTION_ACC_HASH: number;
FORMAT_CREATE: string;
FORMAT_MONEY_TRANSFER: string;
FORMAT_MONEY_TRANSFER_BODY: string;
FORMAT_MONEY_TRANSFER2: string;
FORMAT_MONEY_TRANSFER_BODY2: string;
FORMAT_MONEY_TRANSFER3: string;
FORMAT_MONEY_TRANSFER_BODY3: string;
FORMAT_ACCOUNT_HASH: string;
FORMAT_ACCOUNT_HASH3: string;
//#endregion
// //#region block-db.ts
// BlockDB: any;
// BLOCK_HEADER_SIZE: number;
// BLOCK_HEADER_SIZE2: number;
// DB_VERSION: number;
// AddInfoChain: Function;
// AddInfoBlock: Function;
// GetNodeStrPort: Function;
// NO_CHECK_BLOCKNUM_ONSTART: number;
// //#endregion
//#region db.ts
//CheckStartOneProcess: Function;
//#endregion
//#region update.ts
UpdateMode: number;
//#endregion
//#region file.ts
TYPE_TRANSACTION_FILE: number;
FORMAT_FILE_CREATE: string;
//#endregion
// //#region dapp.ts
// DApps: {
// Accounts?: any,
// File?: any,
// Names?: any,
// Messager?: any,
// Smart?: any,
// };
// DAppByType: any;
// //#endregion
//#region names.ts
NAMES: any;
//#endregion
//#region smart.ts
TickCounter: number;
TYPE_TRANSACTION_SMART_RUN: number;
FORMAT_SMART_CREATE: string;
FORMAT_SMART_RUN
FORMAT_SMART_CHANGE
RunSmartMethod: Function;
DebugEvent: Function;
//#endregion
//#region transaction-validator.ts
CurTrItem: any;
//#endregion
//#region connect.ts
PERIOD_FOR_RECONNECT: number;
CHECK_DELTA_TIME: any;
CHECK_POINT: any;
CODE_VERSION: any;
NET_CONSTANT: any;
START_LOAD_CODE: any;
MIN_PERIOD_PING: number;
MAX_PING_FOR_CONNECT: number;
MAX_WAIT_PERIOD_FOR_HOT: number;
GetGrayServerConnections: Function;
SortNodeBlockProcessCount: Function;
//#endregion
//#region code.ts
RestartNode: Function;
UnpackCodeFile: Function;
//#endregion
//#region node.ts
SocketStatistic: Function;
GetSocketStatus: Function;
SetSocketStatus: Function;
NodeInfo: Function;
NodeName: Function;
SocketInfo: Function;
FindNodeByAddr: Function;
AddNodeInfo: Function;
socketInit: Function;
socketRead: Function;
socketWrite: Function;
CloseSocket: Function;
//#endregion
//#region terahashlib.js
GetHashFromSeqAddr: Function;
CalcHashBlockFromSeqAddr: Function;
GetHashFromNum2: Function;
GetHashFromNum3: Function;
GetHashFromArrNum2: Function;
XORArr: Function;
GetHash: Function;
ReadUint32FromArr: Function;
ReadUintFromArr: Function;
ReadUint16FromArr: Function;
WriteUintToArr: Function;
WriteUint32ToArr: Function;
WriteUint32ToArrOnPos: Function;
WriteUint16ToArrOnPos: Function;
WriteUintToArrOnPos: Function;
WriteArrToArr: Function;
WriteArrToArrOnPos: Function;
WriteArrToArrHOnPos: Function;
ConvertBufferToStr: Function;
CopyObjValue: Function;
CopyArr: Function;
ParseNum: Function;
CompareArr: (a: any[], b: any[]) => number;
CompareArrL: Function;
shaarr2: Function;
sha3arr2: Function;
arr2: Function;
GetBlockArrFromBuffer: Function;
shaarrblock2: Function;
//#endregion
//#region wallet-node.js
CleanChain: Function;
//#endregion
//#region lexer.js
LexerJS: any;
//#endregion
//#region coinlib.js
ADD: Function;
SUB: Function;
DIV: Function;
ISZERO: Function;
FLOAT_FROM_COIN: Function;
COIN_FROM_FLOAT: Function;
COIN_FROM_STRING: Function;
//#endregion
//#region block-exchange.ts
CAN_START: boolean;
StrWarn: string;
SUM_LIST_LENGTH: number;
CONSENSUS_TIK_TIME: number;
CONSENSUS_CHECK_TIME: number;
PERIOD_FOR_NEXT_SEND: number;
BLOCK_DELTA_ACTIVATE: number;
TIME_END_EXCHANGE: number;
TIME_START_POW: number;
TIME_START_SAVE: number;
TIME_START_LOAD: number;
TreeBlockBuf: any;
DoTxLog: boolean;
//#endregion
//#region block-loader.ts
HistoryBlockBuf: any
//#endregion
//#region block-loader-const.ts
PERIOD_GET_BLOCK: number;
COUNT_HISTORY_BLOCKS_FOR_LOAD: number;
COUNT_BLOCKS_FOR_CHECK_POW: number;
MAX_DELTA_COUNT_SUM_FOR_LOAD: number;
MAX_COUNT_CHAIN_LOAD: number;
PACKET_ALIVE_PERIOD: number;
PACKET_ALIVE_PERIOD_NEXT_NODE: number;
MAX_BLOCK_SEND: number;
COUNT_TASK_FOR_NODE: number;
FORMAT_BLOCK_TRANSFER: string;
WRK_BLOCK_TRANSFER: any;
MAX_ACCOUNTS_TRANSFER: number;
MAX_SMARTS_TRANSFER: number;
FORMAT_REST_TRANSFER: string;
FORMAT_SMART_TRANSFER: string;
//#endregion
//#region server.ts
BUF_TYPE: number;
STR_TYPE: number;
MAX_STR_BUF_DATA: number;
MAX_CONNECTION_ACTIVE: number;
STAT_PERIOD: number;
FORMAT_POW_TO_CLIENT: string;
FORMAT_POW_TO_SERVER: string;
INTERNET_IP_FROM_STUN: string;
ContextPackets: any;
//#endregion
//#region terahashmining.ts
CreateHashMinimal: Function;
CreatePOWVersionX: Function;
GetNonceHashArr: Function;
//#endregion
//#region pow-process.ts
BlockPump: any;
//#endregion
//#region tx-process.ts
SetStatMode: Function;
TreeFindTX
bShowDetail: number;
ClearDataBase: Function;
RewriteAllTransactions: Function;
ReWriteDAppTransactions: Function;
TXPrepareLoadRest: Function;
TXWriteAccArr: Function;
TXWriteSmartArr: Function;
TXWriteAccHash: Function;
EvalCode: Function;
//#endregion
//#region messager.ts
MESSAGER: any;
//#endregion
//#region update.ts
RunOnUpdate: Function;
CheckRewriteTr: Function;
//#endregion
//#region transfer-msg.ts
TrName: Function;
//#endregion
//#region rest_tables.ts
DoRest: Function;
GetRestArr: Function;
GetCurrentRestArr: Function;
GetCurrentRestNum: Function;
//#endregion
nw: any;
GlobalRunMap: any;
sha3: any;
SHA3BUF: any;
shaarr: any;
ELECTRON: any;
TestTestWaletMode: any;
}
interface Process {
RunRPC: Function;
}
}
interface TeraProcess {
Name: string;
idInterval: number | any;
idInterval1: number | any;
idInterval2: number | any;
LastAlive: number;
Worker: Worker;
Path: string;
OnMessage: Function;
PeriodAlive: number;
RunRPC?: Function;
}
interface Worker {
connected: boolean;
send: Function;
}
interface Number {
//#region library.ts:118
toStringZ: Function;
//#region
}
interface String {
right: Function;
}
interface HostingCaller {
GetCurrentInfo?: Function;
GetAccountList?: Function;
GetAccount?: Function;
GetBlockList?: Function;
GetTransactionList?: Function;
GetTransactionAll?: Function;
GetDappList?: Function;
GetNodeList?: Function;
GetAccountListByKey?: Function;
GetDappCategory?: Function;
SendTransactionHex?: Function;
DappSmartHTMLFile?: Function;
DappBlockFile?: Function;
DappInfo?: Function;
DappWalletList?: Function;
DappAccountList?: Function;
DappSmartList?: Function;
DappBlockList?: Function;
DappTransactionList?: Function;
DappStaticCall?: Function;
GetHistoryTransactions?: Function;
GetSupply?: Function;
GetTotalSupply?: Function;
}
interface Buffer {
Read,
Write,
len
}
}