ether-camp / ethereum-harmony

DEPRECATED! Ethereum Independent Peer
GNU General Public License v3.0
253 stars 89 forks source link

toJsonHex with an empty byte array produces "0x" which does not work in the remix IDE #103

Closed tbocek closed 6 years ago

tbocek commented 6 years ago

{"jsonrpc":"2.0","id":63,"result":{"hash":"0x4f2a5...","nonce":"0x00", "blockHash":"0x57698...","blockNumber":"0x2","transactionIndex":"0x0", "from":"0x5c5a...","to":"0x","gas":"0x012118","gasPrice":"0x0ba43b7400", "value":"0x","input":"0x608060405260..."}}

The problem with "to":"0x" and "value":"0x" is that the remix IDE cannot convert those numbers and throws the following exception: "Error: new BigNumber() not a base 16 number"

This fix checks if the byte array or the resulting string is empty and if it is the case it returns 0x0. This fixes the issue with the remix IDE

tbocek commented 6 years ago

This breaks other thing, according to https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethgettransactionreceipt, value must be a BigNumber, I'll create a new pull request with only this fix