// InvokeList retrieve a list of registered top-level organizations
InvokeList retrieve a list of registered top-level organizations
// InvokeList retrieve a list of registered top - level organizations
func (org *Organization) InvokeList() (*[]ContractOrganization, error) {
	var orgs []ContractOrganization
	client := Utils().getNodeClient()
	instance, err := directory.NewDirectory(common.HexToAddress(Utils().getDirectoryAddress()), client)
	if err != nil {
		return &orgs, err
	}
	var rootNode [32]byte
	rootBytes, _ := hexutil.Decode(kaleido.RootNodeHash)
	copy(rootNode[:], rootBytes)
	count, err := instance.NodeChildrenCount(&bind.CallOpts{}, rootNode)
	if err != nil {
		return &orgs, err
	}
	countInt := count.Int64()
	var index int64
	fmt.Println("**********************************************************")
	fmt.Println("Number of orgs  =", count)
	for index = 0; index < countInt; index++ {
		var org ContractOrganization
		nodeID, _, err := instance.NodeChild(&bind.CallOpts{}, rootNode, uint8(index))
		if err != nil {
			return &orgs, err
		}
		owner, label, parent, _, _, _, _, err := instance.NodeDetails(&bind.CallOpts{}, nodeID)
		if err != nil {
			return &orgs, err
		}
		org.ID = "0x" + hex.EncodeToString(nodeID[:32])
		org.Name = label
		org.Owner = owner.String()
		org.ParentID = "0x" + hex.EncodeToString(parent[:32])
		orgs = append(orgs, org)
	}
	return &orgs, nil
}
func ( org * Organization ) InvokeList ( ) ( * [ ] ContractOrganization , error ) { var orgs [ ] ContractOrganization client := Utils ( ) . getNodeClient ( ) instance , err := directory . NewDirectory ( common . HexToAddress ( Utils ( ) . getDirectoryAddress ( ) ) , client ) if err != nil { return & orgs , err } var rootNode [ 32 ] byte rootBytes , _ := hexutil . Decode ( kaleido . RootNodeHash ) copy ( rootNode [ : ] , rootBytes ) count , err := instance . NodeChildrenCount ( & bind . CallOpts { } , rootNode ) if err != nil { return & orgs , err } countInt := count . Int64 ( ) var index int64 fmt . Println ( " " ) fmt . Println ( " " , count ) for index = 0 ; index < countInt ; index ++ { var org ContractOrganization nodeID , _ , err := instance . NodeChild ( & bind . CallOpts { } , rootNode , uint8 ( index ) ) if err != nil { return & orgs , err } owner , label , parent , _ , _ , _ , _ , err := instance . NodeDetails ( & bind . CallOpts { } , nodeID ) if err != nil { return & orgs , err } org . ID = " " + hex . EncodeToString ( nodeID [ : 32 ] ) org . Name = label org . Owner = owner . String ( ) org . ParentID = " " + hex . EncodeToString ( parent [ : 32 ] ) orgs = append ( orgs , org ) } return & orgs , nil }
InvokeList retrieve a list of registered top-level organizations
InvokeList retrieve a list of registered top - level organizations