infra/op-txproxy/txproxy.go
Hamdi Allam dff24e9fca
op-txproxy: external validating proxy for conditional transactions (#42)
* txpool svc

* change mod github path

* tag-tool

* codeowners
2024-09-30 13:43:34 -07:00

33 lines
759 B
Go

package op_txproxy
import (
"context"
"fmt"
"github.com/ethereum-optimism/optimism/op-service/metrics"
"github.com/ethereum/go-ethereum/log"
gethrpc "github.com/ethereum/go-ethereum/rpc"
)
var (
MetricsNameSpace = "op_txproxy"
)
type TxProxy struct {
conditionalTxService *ConditionalTxService
}
func NewTxProxy(ctx context.Context, log log.Logger, m metrics.Factory, cfg *CLIConfig) (*TxProxy, error) {
conditionalTxService, err := NewConditionalTxService(ctx, log, m, cfg)
if err != nil {
return nil, fmt.Errorf("failed to create conditional tx service: %w", err)
}
return &TxProxy{conditionalTxService}, nil
}
func (txp *TxProxy) GetAPIs() []gethrpc.API {
return []gethrpc.API{{Namespace: "eth", Service: txp.conditionalTxService}}
}