forked from circlecloud/tera
feat: format code move type def
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
parent
f8fcab7929
commit
92a1edb789
2
.gitignore
vendored
2
.gitignore
vendored
@ -38,4 +38,4 @@ screenshot
|
||||
.eslintcache
|
||||
|
||||
build
|
||||
DATA
|
||||
DATA*
|
||||
|
@ -100,7 +100,7 @@ export default class CConsensus extends CBlock {
|
||||
Context.TrDataLen = 0
|
||||
Context.Info = "Create at:" + global.GetStrOnlyTimeUTC()
|
||||
var Transfer;
|
||||
//var TransferM2;
|
||||
var TransferM2;
|
||||
var LocalLevel = 0;
|
||||
var Levels = this.LevelNodes;
|
||||
for (let L = 0; L < Levels.length; L++) {
|
||||
@ -1282,13 +1282,11 @@ export default class CConsensus extends CBlock {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.OwnBlockCount = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Block.HasErr = 1
|
||||
if (!PrevBlock.bSave)
|
||||
global.AddInfoBlock(Block, "Prev block not saved")
|
||||
|
@ -984,3 +984,57 @@ if (global.TEST_NETWORK || global.LOCAL_RUN) {
|
||||
global.DEVELOP_PUB_KEY_ARR = [global.DEVELOP_PUB_KEY0];
|
||||
global.DEVELOP_PUB_KEY = DEVELOP_PUB_KEY_ARR[0];
|
||||
}
|
||||
declare global {
|
||||
namespace NodeJS {
|
||||
interface Global {
|
||||
//#region dapp.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
|
||||
}
|
||||
}
|
||||
}
|
@ -58,8 +58,7 @@ function DoCommand(response, Type, Path, params, remoteAddress) {
|
||||
try {
|
||||
var Str = JSON.stringify(Ret);
|
||||
response.end(Str);
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
global.ToLog("ERR PATH:" + Path);
|
||||
global.ToLog(e);
|
||||
response.end();
|
||||
@ -202,20 +201,19 @@ function SendBlockFile(response, BlockNum, TrNum) {
|
||||
if (Block && Block.arrContent) {
|
||||
SendToResponceFile(response, Block, TrNum);
|
||||
return;
|
||||
}
|
||||
else
|
||||
} else {
|
||||
if (!Block || !Block.TrDataPos) {
|
||||
global.LoadBlockFromNetwork({ BlockNum: BlockNum }, function(Err, Block) {
|
||||
if (Err) {
|
||||
SendToResponce404(response);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
SendToResponceFile(response, Block, TrNum);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
SendToResponce404(response);
|
||||
};
|
||||
|
||||
@ -230,8 +228,7 @@ function SendToResponceFile(response, Block, TrNum) {
|
||||
else
|
||||
response.writeHead(200, { 'Content-Type': TR.ContentType });
|
||||
response.end(TR.Data);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
SendToResponce404(response);
|
||||
}
|
||||
};
|
||||
@ -250,20 +247,19 @@ HTTPCaller.DappBlockFile = function(Params, response) {
|
||||
if (Block && Block.arrContent) {
|
||||
SendToResponceDappFile(response, Block, Params.TrNum);
|
||||
return null;
|
||||
}
|
||||
else
|
||||
} else {
|
||||
if (!Block || !Block.TrDataPos) {
|
||||
global.LoadBlockFromNetwork(Params, function(Err, Block) {
|
||||
if (Err) {
|
||||
SendToResponceResult0(response);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
SendToResponceDappFile(response, Block, Params.TrNum);
|
||||
}
|
||||
});
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return { result: 0 };
|
||||
};
|
||||
|
||||
@ -275,8 +271,7 @@ function SendToResponceDappFile(response, Block, TrNum) {
|
||||
if (Type === global.TYPE_TRANSACTION_FILE) {
|
||||
var TR = global.DApps.File.GetObjectTransaction(Body);
|
||||
Result = { result: 1, Type: Type, ContentType: TR.ContentType, Name: TR.Name, Body: TR.Data.toString('utf8') };
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
var App = global.DAppByType[Type];
|
||||
if (App) {
|
||||
Body = JSON.parse(App.GetScriptTransaction(Body));
|
||||
@ -306,8 +301,7 @@ HTTPCaller.DappStaticCall = function(Params, response) {
|
||||
var RetValue;
|
||||
try {
|
||||
RetValue = global.RunSmartMethod(glBlock0, Account.Value.Smart, Account, 0, 0, undefined, Params.MethodName, Params.Params, 1);
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
return { result: 0, RetValue: "" + e };
|
||||
}
|
||||
var Str = JSON.stringify({ result: 1, RetValue: RetValue });
|
||||
|
96
src/global.d.ts
vendored
96
src/global.d.ts
vendored
@ -279,54 +279,54 @@ declare global {
|
||||
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 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;
|
||||
|
Loading…
Reference in New Issue
Block a user