pwall-org/pwall

Fix throw error when Array.from() frunction called...

Closed this issue · 2 comments

file /js/web2-eth-accounts.js
Start string 45264:

var randomBytes = cryptoLib.getRandomValues(new Uint8Array(size));
//console.log(randomBytes); //[130, 247, 4, 241, 77, 175, 138, 55, ...]
/*
//there was been an error in old browsers:
//when browser trying to call Array.from() function
//there is a throw exception: Uncaught TypeError: undefined is not a function
	var returnValue = '0x' + Array.from(randomBytes).map(function (arr) {
	return arr.toString(16);
}).join('');
	//console.log(returnValue); //may be 0xHEXSTRING, but not working and give me a throw error
*/

//so I used this code
var returnValue = '0x';
for(var i=0;i<=randomBytes.length-1;i++){
	returnValue += randomBytes[i].toString(16);
}
//console.log(returnValue);//0x + hex string working normally, and no any errors.
//... continue script...

Also, I have more errors, when I trying to generate

ripple addresses:

Uncaught SyntaxError: Use of const in strict mode. ripple-0.19.0.js:80
Uncaught ReferenceError: ripple is not defined index.html:149

And stellar addresses:

Uncaught ReferenceError: Map is not defined stellar-base.js:13038
Uncaught TypeError: Cannot read property 'Keypair' of undefined index.html:112

Hi,
You should contact the Ethereum team for those errors.
If I were to edit the official files, it would serve no purpose.

Thanks anyway.