-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #843 from 0xPolygonID/develop
Release 3.0.1
- Loading branch information
Showing
17 changed files
with
384 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,39 @@ | ||
package api | ||
|
||
import "context" | ||
import ( | ||
"context" | ||
) | ||
|
||
// GetSupportedNetworks is the controller to get supported networks | ||
func (s *Server) GetSupportedNetworks(ctx context.Context, request GetSupportedNetworksRequestObject) (GetSupportedNetworksResponseObject, error) { | ||
func (s *Server) GetSupportedNetworks(ctx context.Context, _ GetSupportedNetworksRequestObject) (GetSupportedNetworksResponseObject, error) { | ||
supportedNetworks := s.networkResolver.GetSupportedNetworks() | ||
|
||
var supportedNetworksResponse []SupportedNetworks | ||
for _, sn := range supportedNetworks { | ||
supportedNetworksResponse = append(supportedNetworksResponse, SupportedNetworks{ | ||
Blockchain: sn.Blockchain, | ||
Networks: sn.Networks, | ||
Networks: s.supportedNetworksData(ctx, sn.Blockchain, sn.Networks), | ||
}) | ||
} | ||
return GetSupportedNetworks200JSONResponse(supportedNetworksResponse), nil | ||
} | ||
|
||
func (s *Server) supportedNetworksData(ctx context.Context, blockchain string, networks []string) []NetworkData { | ||
var nd []NetworkData | ||
for _, network := range networks { | ||
rhsSettings, err := s.networkResolver.GetRhsSettings(ctx, blockchain+":"+network) | ||
if err != nil { | ||
continue | ||
} | ||
types := s.networkResolver.SupportedCredentialStatusTypes(rhsSettings.Mode) | ||
credentialStatusTypes := make([]string, 0, len(types)) | ||
for _, t := range types { | ||
credentialStatusTypes = append(credentialStatusTypes, string(t)) | ||
} | ||
nd = append(nd, NetworkData{ | ||
Name: network, | ||
CredentialStatus: credentialStatusTypes, | ||
}) | ||
} | ||
return nd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.