// New returns a new anchor writer.
New returns a new anchor writer.
// New returns a new anchor writer .
func New(namespace string, apServiceIRI, casURL *url.URL, anchorAttachmentMediaType vocab.MediaType,
	providers *Providers, anchorPublisher anchorPublisher, pubSub pubSub,
	maxWitnessDelay time.Duration, signWithLocalWitness bool,
	resourceResolver *resourceresolver.Resolver,
	metrics metricsProvider) (*Writer, error) {
	w := &Writer{
		Providers:                 providers,
		anchorPublisher:           anchorPublisher,
		namespace:                 namespace,
		apServiceIRI:              apServiceIRI,
		casIRI:                    casURL,
		maxWitnessDelay:           maxWitnessDelay,
		signWithLocalWitness:      signWithLocalWitness,
		resourceResolver:          resourceResolver,
		metrics:                   metrics,
		anchorAttachmentMediaType: anchorAttachmentMediaType,
	}
	s, err := vcpubsub.NewSubscriber(pubSub, w.handle)
	if err != nil {
		return nil, fmt.Errorf("new subscriber: %w", err)
	}
	s.Start()
	return w, nil
}
func New ( namespace string , apServiceIRI , casURL * url . URL , anchorAttachmentMediaType vocab . MediaType , providers * Providers , anchorPublisher anchorPublisher , pubSub pubSub , maxWitnessDelay time . Duration , signWithLocalWitness bool , resourceResolver * resourceresolver . Resolver , metrics metricsProvider ) ( * Writer , error ) { w := & Writer { Providers : providers , anchorPublisher : anchorPublisher , namespace : namespace , apServiceIRI : apServiceIRI , casIRI : casURL , maxWitnessDelay : maxWitnessDelay , signWithLocalWitness : signWithLocalWitness , resourceResolver : resourceResolver , metrics : metrics , anchorAttachmentMediaType : anchorAttachmentMediaType , } s , err := vcpubsub . NewSubscriber ( pubSub , w . handle ) if err != nil { return nil , fmt . Errorf ( " " , err ) } s . Start ( ) return w , nil }
New returns a new anchor writer.
New returns a new anchor writer .