mirror of https://github.com/embarklabs/embark.git
move web3 utils to utils module
This commit is contained in:
parent
c3652da371
commit
28ef2ed067
|
@ -0,0 +1,10 @@
|
|||
|
||||
class Blockchain {
|
||||
constructor(optiosn) {
|
||||
this.plugins = options.plugins;
|
||||
this.logger = options.logger;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Blockchain;
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
let async = require('async');
|
||||
//require("../utils/debug_util.js")(__filename, async);
|
||||
let utils = require('../utils/utils.js');
|
||||
|
||||
let RunCode = require('../core/runCode.js');
|
||||
|
||||
|
@ -86,7 +87,7 @@ class Deploy {
|
|||
|
||||
if (contract.address !== undefined) {
|
||||
try {
|
||||
this.web3.utils.toChecksumAddress(contract.address);
|
||||
utils.toChecksumAddress(contract.address);
|
||||
} catch(e) {
|
||||
self.logger.error(__("error deploying %s", contract.className));
|
||||
self.logger.error(e.message);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
let fs = require('../core/fs.js');
|
||||
let utils = require('../utils/utils.js');
|
||||
|
||||
class DeployTracker {
|
||||
constructor(options, cb) {
|
||||
|
@ -37,14 +38,14 @@ class DeployTracker {
|
|||
}
|
||||
|
||||
trackContract(contractName, code, args, address) {
|
||||
this.currentChain.contracts[this.web3.utils.sha3(code + contractName + args.join(','))] = {
|
||||
this.currentChain.contracts[utils.sha3(code + contractName + args.join(','))] = {
|
||||
name: contractName,
|
||||
address: address
|
||||
};
|
||||
}
|
||||
|
||||
getContract(contractName, code, args) {
|
||||
let contract = this.currentChain.contracts[this.web3.utils.sha3(code + contractName + args.join(','))];
|
||||
let contract = this.currentChain.contracts[utils.sha3(code + contractName + args.join(','))];
|
||||
if (contract && contract.address === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ let https = require('follow-redirects').https;
|
|||
let shelljs = require('shelljs');
|
||||
var tar = require('tar');
|
||||
var propose = require('propose');
|
||||
var Web3 = require('web3');
|
||||
const constants = require('../constants');
|
||||
|
||||
//let fs = require('../core/fs.js');
|
||||
|
@ -173,6 +174,14 @@ function getExternalContractUrl(file) {
|
|||
};
|
||||
}
|
||||
|
||||
function toChecksumAddress(address) {
|
||||
return Web3.utils.toChecksumAddress(address);
|
||||
}
|
||||
|
||||
function sha3(arg) {
|
||||
return Web3.utils.sha3(arg);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
joinPath: joinPath,
|
||||
filesMatchingPattern: filesMatchingPattern,
|
||||
|
@ -190,5 +199,7 @@ module.exports = {
|
|||
extractTar: extractTar,
|
||||
proposeAlternative: proposeAlternative,
|
||||
pwd: pwd,
|
||||
getExternalContractUrl
|
||||
getExternalContractUrl,
|
||||
toChecksumAddress: toChecksumAddress,
|
||||
sha3: sha3
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue