mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-12 21:56:58 +00:00
refactor(@embark/utils): move hexToNumber into embark-utils package
This commit is contained in:
parent
b8708f4305
commit
20f1a13ae6
@ -12,6 +12,7 @@ import * as AddressUtils from './addressUtils';
|
||||
import {
|
||||
getWeiBalanceFromString,
|
||||
getHexBalanceFromString,
|
||||
hexToNumber,
|
||||
decodeParams,
|
||||
sha3,
|
||||
isHex,
|
||||
@ -200,6 +201,7 @@ const Utils = {
|
||||
checkIsAvailable,
|
||||
findNextPort,
|
||||
hashTo32ByteHexString,
|
||||
hexToNumber,
|
||||
isHex,
|
||||
last,
|
||||
soliditySha3,
|
||||
|
@ -55,3 +55,7 @@ export function soliditySha3(arg: any) {
|
||||
export function toChecksumAddress(address: any) {
|
||||
return web3.utils.toChecksumAddress(address);
|
||||
}
|
||||
|
||||
export function hexToNumber(hex: string) {
|
||||
return web3.utils.hexToNumber(hex);
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
const async = require('async');
|
||||
const utils = require('../../utils/utils.js');
|
||||
import { getAddressToContract, getTransactionParams } from 'embark-utils';
|
||||
import { getAddressToContract, getTransactionParams, hexToNumber } from 'embark-utils';
|
||||
|
||||
class ConsoleListener {
|
||||
constructor(embark, options) {
|
||||
@ -108,8 +107,8 @@ class ConsoleListener {
|
||||
}
|
||||
|
||||
let {transactionHash, blockNumber, gasUsed, status} = request;
|
||||
gasUsed = utils.hexToNumber(gasUsed);
|
||||
blockNumber = utils.hexToNumber(blockNumber);
|
||||
gasUsed = hexToNumber(gasUsed);
|
||||
blockNumber = hexToNumber(blockNumber);
|
||||
const log = Object.assign({}, request, {name, functionName, paramString, gasUsed, blockNumber});
|
||||
|
||||
this.events.emit('contracts:log', log);
|
||||
|
@ -261,11 +261,6 @@ function getExternalContractUrl(file,providerUrl) {
|
||||
};
|
||||
}
|
||||
|
||||
function hexToNumber(hex) {
|
||||
const Web3 = require('web3');
|
||||
return Web3.utils.hexToNumber(hex);
|
||||
}
|
||||
|
||||
function isValidDomain(v) {
|
||||
// from: https://github.com/miguelmota/is-valid-domain
|
||||
if (typeof v !== 'string') return false;
|
||||
@ -431,7 +426,6 @@ module.exports = {
|
||||
httpGetJson,
|
||||
httpsGetJson,
|
||||
getJson,
|
||||
hexToNumber,
|
||||
isValidDomain,
|
||||
pingEndpoint,
|
||||
cd,
|
||||
|
Loading…
x
Reference in New Issue
Block a user