the remaining, currently supportable, eth_* endpoints

This commit is contained in:
Ian Norden
2020-10-28 08:54:06 -05:00
parent 3af06ada1d
commit b5d57b6afc
3 changed files with 424 additions and 80 deletions
+11
View File
@@ -23,6 +23,7 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rlp"
"github.com/vulcanize/ipld-eth-indexer/pkg/ipfs"
)
@@ -127,6 +128,16 @@ func NewRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber
return result
}
// newRPCRawTransactionFromBlockIndex returns the bytes of a transaction given a block and a transaction index.
func newRPCRawTransactionFromBlockIndex(b *types.Block, index uint64) hexutil.Bytes {
txs := b.Transactions()
if index >= uint64(len(txs)) {
return nil
}
blob, _ := rlp.EncodeToBytes(txs[index])
return blob
}
// newRPCTransactionFromBlockIndex returns a transaction that will serialize to the RPC representation.
func newRPCTransactionFromBlockIndex(b *types.Block, index uint64) *RPCTransaction {
txs := b.Transactions()