Signal user if the networks are not supported

This commit is contained in:
Andrea Maria Piana 2024-02-12 17:23:58 +00:00
parent 5e905518aa
commit 598e3217ba
2 changed files with 15 additions and 11 deletions

View File

@ -12,6 +12,7 @@ type CheckPermissionsResponse struct {
Satisfied bool `json:"satisfied"`
Permissions map[string]*PermissionTokenCriteriaResult `json:"permissions"`
ValidCombinations []*AccountChainIDsCombination `json:"validCombinations"`
NetworksNotSupported bool `json:"networksNotSupported"`
}
type CheckPermissionToJoinResponse = CheckPermissionsResponse
@ -98,12 +99,14 @@ func (c *CheckPermissionsResponse) MarshalJSON() ([]byte, error) {
ValidCombinations []*AccountChainIDsCombination `json:"validCombinations"`
Roles []*HighestRoleResponse `json:"roles"`
HighestRole *HighestRoleResponse `json:"highestRole"`
NetworksNotSupported bool `json:"networksNotSupported"`
}
c.calculateSatisfied()
item := &CheckPermissionsTypeAlias{
Satisfied: c.Satisfied,
Permissions: c.Permissions,
ValidCombinations: c.ValidCombinations,
NetworksNotSupported: c.NetworksNotSupported,
}
rolesAndHighestRole := calculateRolesAndHighestRole(c.Permissions)

View File

@ -236,6 +236,7 @@ func (p *DefaultPermissionChecker) CheckPermissions(permissions []*CommunityToke
// if there are no chain IDs that match token criteria chain IDs
// we aren't able to check balances on selected networks
if len(erc20ChainIDsMap) > 0 && len(chainIDsForERC20) == 0 {
response.NetworksNotSupported = true
return response, nil
}