func (s *Service) SignBeaconBlockProposal(ctx context.Context,
	account e2wtypes.Account,
	slot phase0.Slot,
	proposerIndex phase0.ValidatorIndex,
	parentRoot phase0.Root,
	stateRoot phase0.Root,
	bodyRoot phase0.Root,
) (
	phase0.BLSSignature,
	error,
) {
	domain, err := s.domainProvider.Domain(ctx,
		s.beaconProposerDomainType,
		phase0.Epoch(slot/s.slotsPerEpoch))
	if err != nil {
		return phase0.BLSSignature{}, errors.Wrap(err, "failed to obtain signature domain for beacon proposal")
	}
	var sig phase0.BLSSignature
	if protectingSigner, isProtectingSigner := account.(e2wtypes.AccountProtectingSigner); isProtectingSigner {
		signature, err := protectingSigner.SignBeaconProposal(ctx,
			uint64(slot),
			uint64(proposerIndex),
			parentRoot[:],
			stateRoot[:],
			bodyRoot[:],
			domain[:])
		if err != nil {
			return phase0.BLSSignature{}, errors.Wrap(err, "failed to sign beacon block proposal")
		}
		copy(sig[:], signature.Marshal())
	} else {
		header := &phase0.BeaconBlockHeader{
			Slot:          slot,
			ProposerIndex: proposerIndex,
			ParentRoot:    parentRoot,
			StateRoot:     stateRoot,
			BodyRoot:      bodyRoot,
		}
		root, err := header.HashTreeRoot()
		if err != nil {
			return phase0.BLSSignature{}, errors.Wrap(err, "failed to generate hash tree root")
		}
		sig, err = s.sign(ctx, account, root, domain)
		if err != nil {
			return phase0.BLSSignature{}, err
		}
	}
	return sig, nil
}
SignBeaconBlockProposal signs a beacon block proposal.
package standard
import (
	"context"
	"github.com/attestantio/go-eth2-client/spec/phase0"
	"github.com/pkg/errors"
	e2wtypes "github.com/wealdtech/go-eth2-wallet-types/v2"
)