Fix TxViewer when no to (contract deployment) (#4847)

* Added React Hot Reload to dapps + TokenDeplpoy fix

* Fixes to the LocalTx dapp

* Don't send the nonce for mined transactions

* Don't encode empty to values for options
This commit is contained in:
Nicolas Gotchac
2017-03-10 10:08:16 +01:00
committed by Gav Wood
parent 5e54c0fa91
commit be87151f1c
6 changed files with 93 additions and 31 deletions

View File

@@ -143,8 +143,15 @@ export function inOptions (options) {
if (options) {
Object.keys(options).forEach((key) => {
switch (key) {
case 'from':
case 'to':
// Don't encode the `to` option if it's empty
// (eg. contract deployments)
if (options[key]) {
options[key] = inAddress(options[key]);
}
break;
case 'from':
options[key] = inAddress(options[key]);
break;

View File

@@ -208,6 +208,13 @@ describe('api/format/input', () => {
});
});
it('does not encode an empty `to` value', () => {
const options = { to: '' };
const formatted = inOptions(options);
expect(formatted.to).to.equal('');
});
['gas', 'gasPrice', 'value', 'minBlock', 'nonce'].forEach((input) => {
it(`formats ${input} number as hexnumber`, () => {
const block = {};