Skip to content
Snippets Groups Projects
Commit 5b8fac4e authored by Robert Martin-Legene's avatar Robert Martin-Legene
Browse files

Now actually stripping 0x

parent 055bb214
No related branches found
No related tags found
No related merge requests found
......@@ -17,7 +17,7 @@ var estimate;
if ( myArgs.length < 2 || myArgs.length > 3 )
{
let myname = process.argv[1].replace(/^.*\//, '');;
let myname = process.argv[1].replace(/^.*\//, '');
console.error( "Wrong number of arguments.");
console.error( "Usage: " + myname + " <account> <proof> [<privatekeypassword>]");
process.exit( 1 );
......@@ -28,7 +28,9 @@ function findMatchingFile( needle, accountdir )
return new Promise(
function(resolve, reject)
{
needle = needle.toLowerCase();
// strip leading '0x' from the needle, if present
// also lowercase the name
needle = needle.replace(/^0x/, '').toLowerCase();
let haystack = fs.readdirSync( accountdir, 'utf8' );
haystack.forEach(
(filename) => {
......@@ -47,16 +49,13 @@ function findaccountfile( accountfile )
function( resolve, reject )
{
// find account file
let accountdir;
// is it actually just a file?
if ( accountfile.includes('/') )
{
resolve( accountfile );
return;
}
// strip leading '0x' from the account name, if present
if ( accountfile.startsWith( '0x' ) )
accountfile = accountfile.substring(2);
let accountdir;
// if not a file, then look (only) at the most specific directory we have been told about.
if ( process.env.KEYSTORE !== undefined )
accountdir = process.env.KEYSTORE;
......@@ -213,8 +212,8 @@ function prepareCall()
let method = contractInstance.methods.proveControl( proof );
// contractInstance.methods.hash(proof).call().then( console.log );
rawdata = method.encodeABI();
gasestimate( method ).
then( resolve );
gasestimate( method )
.then( resolve );
});
}
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment