|
|
|
@ -80,7 +80,7 @@ func (h *Header) EncodeRLP() ([]byte, error) { |
|
|
|
|
return rlp.EncodeToBytes(h.header) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// NewHeaderFromJSON parses a header from an JSON data dump.
|
|
|
|
|
// NewHeaderFromJSON parses a header from a JSON data dump.
|
|
|
|
|
func NewHeaderFromJSON(data string) (*Header, error) { |
|
|
|
|
h := &Header{ |
|
|
|
|
header: new(types.Header), |
|
|
|
@ -91,7 +91,7 @@ func NewHeaderFromJSON(data string) (*Header, error) { |
|
|
|
|
return h, nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// EncodeJSON encodes a header into an JSON data dump.
|
|
|
|
|
// EncodeJSON encodes a header into a JSON data dump.
|
|
|
|
|
func (h *Header) EncodeJSON() (string, error) { |
|
|
|
|
data, err := json.Marshal(h.header) |
|
|
|
|
return string(data), err |
|
|
|
@ -151,7 +151,7 @@ func (b *Block) EncodeRLP() ([]byte, error) { |
|
|
|
|
return rlp.EncodeToBytes(b.block) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// NewBlockFromJSON parses a block from an JSON data dump.
|
|
|
|
|
// NewBlockFromJSON parses a block from a JSON data dump.
|
|
|
|
|
func NewBlockFromJSON(data string) (*Block, error) { |
|
|
|
|
b := &Block{ |
|
|
|
|
block: new(types.Block), |
|
|
|
@ -162,7 +162,7 @@ func NewBlockFromJSON(data string) (*Block, error) { |
|
|
|
|
return b, nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// EncodeJSON encodes a block into an JSON data dump.
|
|
|
|
|
// EncodeJSON encodes a block into a JSON data dump.
|
|
|
|
|
func (b *Block) EncodeJSON() (string, error) { |
|
|
|
|
data, err := json.Marshal(b.block) |
|
|
|
|
return string(data), err |
|
|
|
@ -220,7 +220,7 @@ func (tx *Transaction) EncodeRLP() ([]byte, error) { |
|
|
|
|
return rlp.EncodeToBytes(tx.tx) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// NewTransactionFromJSON parses a transaction from an JSON data dump.
|
|
|
|
|
// NewTransactionFromJSON parses a transaction from a JSON data dump.
|
|
|
|
|
func NewTransactionFromJSON(data string) (*Transaction, error) { |
|
|
|
|
tx := &Transaction{ |
|
|
|
|
tx: new(types.Transaction), |
|
|
|
@ -231,7 +231,7 @@ func NewTransactionFromJSON(data string) (*Transaction, error) { |
|
|
|
|
return tx, nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// EncodeJSON encodes a transaction into an JSON data dump.
|
|
|
|
|
// EncodeJSON encodes a transaction into a JSON data dump.
|
|
|
|
|
func (tx *Transaction) EncodeJSON() (string, error) { |
|
|
|
|
data, err := json.Marshal(tx.tx) |
|
|
|
|
return string(data), err |
|
|
|
@ -312,7 +312,7 @@ func (r *Receipt) EncodeRLP() ([]byte, error) { |
|
|
|
|
return rlp.EncodeToBytes(r.receipt) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// NewReceiptFromJSON parses a transaction receipt from an JSON data dump.
|
|
|
|
|
// NewReceiptFromJSON parses a transaction receipt from a JSON data dump.
|
|
|
|
|
func NewReceiptFromJSON(data string) (*Receipt, error) { |
|
|
|
|
r := &Receipt{ |
|
|
|
|
receipt: new(types.Receipt), |
|
|
|
@ -323,7 +323,7 @@ func NewReceiptFromJSON(data string) (*Receipt, error) { |
|
|
|
|
return r, nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// EncodeJSON encodes a transaction receipt into an JSON data dump.
|
|
|
|
|
// EncodeJSON encodes a transaction receipt into a JSON data dump.
|
|
|
|
|
func (r *Receipt) EncodeJSON() (string, error) { |
|
|
|
|
data, err := rlp.EncodeToBytes(r.receipt) |
|
|
|
|
return string(data), err |
|
|
|
|