1
0
forked from circlecloud/tera

fix: error global replace

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2019-07-12 22:46:26 +08:00
parent 92a1edb789
commit 1225f4b2f5
27 changed files with 504 additions and 723 deletions

View File

@@ -9,6 +9,7 @@
*/
let WebApi2: any = {};
import * as crypto from 'crypto';
import { TYPE_TRANSACTION } from '../constant/account';
WebApi2.GenerateKeys = function(Params) {
var KeyPair = crypto.createECDH('secp256k1');
var PrivKey = global.sha3(crypto.randomBytes(32));
@@ -21,7 +22,7 @@ WebApi2.CreateAccount = function(Params, response) {
var KeyPair = crypto.createECDH('secp256k1');
KeyPair.setPrivateKey(Buffer.from(global.GetArrFromHex(Params.PrivKey)));
var PubKey = KeyPair.getPublicKey('' as any, 'compressed');
var TR: any = { Type: global.TYPE_TRANSACTION_CREATE, Currency: Params.Currency, PubKey: PubKey, Name: Params.Name, Smart: Params.Smart, };
var TR: any = { Type: TYPE_TRANSACTION.TYPE_TRANSACTION_CREATE, Currency: Params.Currency, PubKey: PubKey, Name: Params.Name, Smart: Params.Smart, };
var Body = global.BufLib.GetBufferFromObject(TR, global.FORMAT_CREATE, 1000, {}, 1);
Body = Body.slice(0, Body.len + 12);
SendTransaction(Body, TR as any, Params.Wait, function(result, text) {
@@ -270,7 +271,7 @@ function CreateTxID(body, BlockNum, Nonce) {
function GetBlockNumTr(arr) {
var BlockNum = DELTA_FOR_TIME_TX + global.GetCurrentBlockNumByTime();
if (arr[0] === global.TYPE_TRANSACTION_CREATE) {
if (arr[0] === TYPE_TRANSACTION.TYPE_TRANSACTION_CREATE) {
var BlockNum2 = Math.floor(BlockNum / 10) * 10;
if (BlockNum2 < BlockNum)
BlockNum2 = BlockNum2 + 10;