// postOfferActivity creates and posts offer activity (requests witnessing of anchor credential).
postOfferActivity creates and posts offer activity (requests witnessing of anchor credential).
// postOfferActivity creates and posts offer activity ( requests witnessing of anchor credential ) .
func (c *Inspector) postOfferActivity(anchorEvent *vocab.AnchorEventType, witnessesIRI []*url.URL) error {
	logger.Debugf("sending anchor event[%s] to additional witnesses: %s", anchorEvent.Index(), witnessesIRI)
	startTime := time.Now()
	endTime := startTime.Add(c.maxWitnessDelay)
	offer := vocab.NewOfferActivity(
		vocab.NewObjectProperty(
			vocab.WithAnchorEvent(anchorEvent),
		),
		vocab.WithTo(witnessesIRI...),
		vocab.WithStartTime(&startTime),
		vocab.WithEndTime(&endTime),
		vocab.WithTarget(vocab.NewObjectProperty(vocab.WithIRI(vocab.AnchorWitnessTargetIRI))),
	)
	postID, err := c.Outbox().Post(offer)
	if err != nil {
		return fmt.Errorf("failed to post additional offer for anchor event[%s]: %w", anchorEvent.Index(), err)
	}
	logger.Infof("created additional pre-announce activity for anchor event[%s], post id[%s], to%s",
		anchorEvent.Index(), postID, witnessesIRI)
	return nil
}
func ( c * Inspector ) postOfferActivity ( anchorEvent * vocab . AnchorEventType , witnessesIRI [ ] * url . URL ) error { logger . Debugf ( " " , anchorEvent . Index ( ) , witnessesIRI ) startTime := time . Now ( ) endTime := startTime . Add ( c . maxWitnessDelay ) offer := vocab . NewOfferActivity ( vocab . NewObjectProperty ( vocab . WithAnchorEvent ( anchorEvent ) , ) , vocab . WithTo ( witnessesIRI ... ) , vocab . WithStartTime ( & startTime ) , vocab . WithEndTime ( & endTime ) , vocab . WithTarget ( vocab . NewObjectProperty ( vocab . WithIRI ( vocab . AnchorWitnessTargetIRI ) ) ) , ) postID , err := c . Outbox ( ) . Post ( offer ) if err != nil { return fmt . Errorf ( " " , anchorEvent . Index ( ) , err ) } logger . Infof ( " " , anchorEvent . Index ( ) , postID , witnessesIRI ) return nil }
postOfferActivity creates and posts offer activity (requests witnessing of anchor credential).
postOfferActivity creates and posts offer activity ( requests witnessing of anchor credential ) .