feat: expose ethapi.NewRPCTransaction and ethapi.NewRPCPendingTransaction (#260)

This commit is contained in:
Stephen Buttolph 2026-01-28 11:08:29 -05:00 committed by GitHub
parent b4a7f35411
commit e673c70970
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 48 additions and 1 deletions

View file

@ -0,0 +1,30 @@
// Copyright 2026 the libevm authors.
//
// The libevm additions to go-ethereum are free software: you can redistribute
// them and/or modify them under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// The libevm additions are distributed in the hope that they will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
// General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see
// <http://www.gnu.org/licenses/>.
package ethapi
import (
"math/big"
"github.com/ava-labs/libevm/common"
"github.com/ava-labs/libevm/core/types"
"github.com/ava-labs/libevm/params"
)
// NewRPCTransaction exports the [newRPCTransaction] function.
func NewRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber uint64, blockTime uint64, index uint64, baseFee *big.Int, config *params.ChainConfig) *RPCTransaction {
return newRPCTransaction(tx, blockHash, blockNumber, blockTime, index, baseFee, config)
}

View file

@ -17,7 +17,14 @@
// Package ethapi exposes the internal ethapi package.
package ethapi
import "github.com/ava-labs/libevm/internal/ethapi"
import (
"math/big"
"github.com/ava-labs/libevm/common"
"github.com/ava-labs/libevm/core/types"
"github.com/ava-labs/libevm/internal/ethapi"
"github.com/ava-labs/libevm/params"
)
// Type aliases required by constructors.
type (
@ -69,3 +76,13 @@ func NewTxPoolAPI(b Backend) *TxPoolAPI {
func NewDebugAPI(b Backend) *DebugAPI {
return ethapi.NewDebugAPI(b)
}
// NewRPCPendingTransaction is identical to [ethapi.NewRPCPendingTransaction].
func NewRPCPendingTransaction(tx *types.Transaction, current *types.Header, config *params.ChainConfig) *RPCTransaction {
return ethapi.NewRPCPendingTransaction(tx, current, config)
}
// NewRPCTransaction is identical to [ethapi.NewRPCTransaction].
func NewRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber uint64, blockTime uint64, index uint64, baseFee *big.Int, config *params.ChainConfig) *RPCTransaction {
return ethapi.NewRPCTransaction(tx, blockHash, blockNumber, blockTime, index, baseFee, config)
}