diff options
Diffstat (limited to 'ethpub')
-rw-r--r-- | ethpub/pub.go | 2 | ||||
-rw-r--r-- | ethpub/types.go | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/ethpub/pub.go b/ethpub/pub.go index c6f177124..3c579001e 100644 --- a/ethpub/pub.go +++ b/ethpub/pub.go @@ -87,7 +87,7 @@ func (lib *PEthereum) createTx(key, recipient, valueStr, gasStr, gasPriceStr, in tx = ethchain.NewContractCreationTx(value, gas, gasPrice, mainScript, initScript) } else { // Just in case it was submitted as a 0x prefixed string - if initStr[0:2] == "0x" { + if len(initStr) > 0 && initStr[0:2] == "0x" { initStr = initStr[2:len(initStr)] } tx = ethchain.NewTransactionMessage(hash, value, gas, gasPrice, ethutil.FromHex(initStr)) diff --git a/ethpub/types.go b/ethpub/types.go index bf06ce2f6..4d9f9ad85 100644 --- a/ethpub/types.go +++ b/ethpub/types.go @@ -8,8 +8,8 @@ import ( // Block interface exposed to QML type PBlock struct { - Number int - Hash string + Number int `json:"number"` + Hash string `json:"hash"` } // Creates a new QML Block from a chain block @@ -44,10 +44,10 @@ func NewPKey(key *ethchain.KeyPair) *PKey { } type PReceipt struct { - CreatedContract bool - Address string - Hash string - Sender string + CreatedContract bool `json:"createdContract"` + Address string `json:"address"` + Hash string `json:"hash"` + Sender string `json:"sender"` } func NewPReciept(contractCreation bool, creationAddress, hash, address []byte) *PReceipt { |