aboutsummaryrefslogtreecommitdiffstats
path: root/ethpub
diff options
context:
space:
mode:
authorMaran <maran.hidskes@gmail.com>2014-05-03 02:00:58 +0800
committerMaran <maran.hidskes@gmail.com>2014-05-03 02:00:58 +0800
commit4f20e8f649a19168718a7f0fe7619e3bdb626aa8 (patch)
tree418210e21d26fcb7c9af0eb4c63b30a8c0af7d88 /ethpub
parent69d83b1da55a2149a402e7fa66721fd98f580801 (diff)
downloadgo-tangerine-4f20e8f649a19168718a7f0fe7619e3bdb626aa8.tar
go-tangerine-4f20e8f649a19168718a7f0fe7619e3bdb626aa8.tar.gz
go-tangerine-4f20e8f649a19168718a7f0fe7619e3bdb626aa8.tar.bz2
go-tangerine-4f20e8f649a19168718a7f0fe7619e3bdb626aa8.tar.lz
go-tangerine-4f20e8f649a19168718a7f0fe7619e3bdb626aa8.tar.xz
go-tangerine-4f20e8f649a19168718a7f0fe7619e3bdb626aa8.tar.zst
go-tangerine-4f20e8f649a19168718a7f0fe7619e3bdb626aa8.zip
Implemented first few methods via public api
Diffstat (limited to 'ethpub')
-rw-r--r--ethpub/pub.go2
-rw-r--r--ethpub/types.go12
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 {