// GetDidAnchors returns all anchors that are referencing did suffix starting from hl.
GetDidAnchors returns all anchors that are referencing did suffix starting from hl.
// GetDidAnchors returns all anchors that are referencing did suffix starting from hl .
func (g *Graph) GetDidAnchors(hl, suffix string) ([]Anchor, error) {
	var refs []Anchor
	logger.Debugf("getting did anchors for hl[%s], suffix[%s]", hl, suffix)
	cur := hl
	ok := true
	for ok {
		anchorEvent, err := g.Read(cur)
		if err != nil {
			return nil, fmt.Errorf("failed to read anchor event[%s] for did[%s]: %w", cur, suffix, err)
		}
		refs = append(refs, Anchor{
			CID:  cur,
			Info: anchorEvent,
		})
		payload, err := anchorevent.GetPayloadFromAnchorEvent(anchorEvent)
		if err != nil {
			return nil, err
		}
		previousAnchors := payload.PreviousAnchors
		cur, ok = contains(suffix, previousAnchors)
		if ok && cur == "" { 
			break
		}
	}
	return reverseOrder(refs), nil
}
func ( g * Graph ) GetDidAnchors ( hl , suffix string ) ( [ ] Anchor , error ) { var refs [ ] Anchor logger . Debugf ( " " , hl , suffix ) cur := hl ok := true for ok { anchorEvent , err := g . Read ( cur ) if err != nil { return nil , fmt . Errorf ( " " , cur , suffix , err ) } refs = append ( refs , Anchor { CID : cur , Info : anchorEvent , } ) payload , err := anchorevent . GetPayloadFromAnchorEvent ( anchorEvent ) if err != nil { return nil , err } previousAnchors := payload . PreviousAnchors cur , ok = contains ( suffix , previousAnchors ) if ok && cur == " " { break } } return reverseOrder ( refs ) , nil }
GetDidAnchors returns all anchors that are referencing did suffix starting from hl.
GetDidAnchors returns all anchors that are referencing did suffix starting from hl .
// create