prysm-pulse/shared/legacyutil/convert_transaction.go
Preston Van Loon 9ac88d11da sharding: Local networked P2P! (#222)
Former-commit-id: d22d05529bb0050b8a03053a28d876e3e458bbff [formerly 284a04699110aa285a42f5b0ad244ca9bd77d2df]
Former-commit-id: 83cd9c8a48fb5ce9c57ff8ef6c2b1741a4d05130
2018-07-17 13:39:04 -05:00

24 lines
626 B
Go

// This package exists to convert Ethererum 2.0 types to go-ethereum or
// Ethereum 1.0 types.
package legacyutil
import (
"math/big"
"github.com/ethereum/go-ethereum/common"
gethTypes "github.com/ethereum/go-ethereum/core/types"
pb "github.com/prysmaticlabs/geth-sharding/proto/sharding/v1"
)
// TransformTransaction of proto transaction to geth's transction.
func TransformTransaction(t *pb.Transaction) *gethTypes.Transaction {
return gethTypes.NewTransaction(
t.Nonce,
common.BytesToAddress(t.Recipient),
big.NewInt(0).SetUint64(t.Value),
t.GasLimit,
big.NewInt(0).SetUint64(t.GasPrice),
t.Input,
)
}