Skip to content

Commit

Permalink
Merge branch 'pre-stage' of https://github.com/ssvlabs/ssv-web into h…
Browse files Browse the repository at this point in the history
…otfix/address-check
  • Loading branch information
sumbat-ssvlabs committed Jun 25, 2024
2 parents 9a25e09 + db4dd0b commit c95038c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
18 changes: 12 additions & 6 deletions src/app/common/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,19 @@ export const config = {
ADDRESS: tokenAddress,
ABI: ABI_VERSION.tokenContract
},
SSV_NETWORK_SETTER: {
ADDRESS: setterContractAddress,
ABI: ABI_VERSION.setterContract[`${networkId}_${apiVersion}`]
get SSV_NETWORK_SETTER() {
const { networkId, apiVersion } = getStoredNetwork();
return {
ADDRESS: setterContractAddress,
ABI: ABI_VERSION.setterContract[`${networkId}_${apiVersion}`]
};
},
SSV_NETWORK_GETTER: {
ADDRESS: getterContractAddress,
ABI: ABI_VERSION.getterContract[`${networkId}_${apiVersion}`]
get SSV_NETWORK_GETTER() {
const { networkId, apiVersion } = getStoredNetwork();
return {
ADDRESS: getterContractAddress,
ABI: ABI_VERSION.getterContract[`${networkId}_${apiVersion}`]
};
},
SSV_DISTRIBUTION: {
// ADDRESS: contract,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const PermissionSettingsDashboard = () => {
/>
<PermissionSettingsItem
title="Operator Status"
description={'Switch between public and private modes for operator access control'}
description={'Switch between public and private modes for operator access control.'}
route={config.routes.SSV.MY_ACCOUNT.OPERATOR.ACCESS_SETTINGS.STATUS}
addon={<OperatorStatusBadge isPrivate={selectedOperator.is_private} />}
/>
Expand All @@ -52,7 +52,7 @@ const PermissionSettingsDashboard = () => {
<PermissionSettingsItem
className="pb-8"
title="External Contract"
description="Manage whitelisted addresses through an external contract"
description="Manage whitelisted addresses through an external contract."
addon={<ActiveBadge isActive={hasWhitelistingContract} />}
route={config.routes.SSV.MY_ACCOUNT.OPERATOR.ACCESS_SETTINGS.EXTERNAL_CONTRACT}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const OperatorStatus = () => {
<span className="font-bold">Public mode</span> - Any validator can register with the operator.
</li>
<li>
<span className="font-bold">Private mode</span> Only authorized addresses can register.
<span className="font-bold">Private mode</span> - Only whitelisted addresses can register.
</li>
</ul>
<p className="font-medium text-sm pt-3">
Expand All @@ -43,7 +43,7 @@ const OperatorStatus = () => {
</div>
{isFeeZero && operator.is_private && (
<Alert variant="error">
<AlertDescription>Switching the operator to public when the fee is set to 0 is not possible. </AlertDescription>
<AlertDescription>You cannot switch your operator to public mode when you have a set fee of 0.</AlertDescription>
</Alert>
)}
<Button
Expand Down
10 changes: 9 additions & 1 deletion src/services/operator.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { IPagination } from '~app/model/pagination.model';
import { GetOperatorValidatorsResponse } from '~app/model/validator.model';
import { getStoredNetwork } from '~root/providers/networkInfo.provider';
import { IHttpResponse, getRequest, postRequest, putRequest } from '~root/services/httpApi.service';
import { getOperatorBalance } from '~root/services/operatorContract.service.ts';

type OperatorsListQuery = {
page?: number;
Expand Down Expand Up @@ -34,7 +35,14 @@ const getOperatorsByOwnerAddress = async ({
}): Promise<{ operators: IOperator[]; pagination: IPagination }> => {
const url = `${getStoredNetwork().api}/operators/owned_by/${accountAddress}?page=${page}&perPage=${perPage}&withFee=true&ts=${new Date().getTime()}&ordering=id:asc`;
const res = await getRequest(url, false);
return res ?? { operators: [], pagination: DEFAULT_PAGINATION };
const operators = await Promise.all(
res.operators.map(async (operator: any) => {
const { id } = operator;
const balance = await getOperatorBalance({ id });
return { ...operator, balance };
})
);
return { operators: operators || [], pagination: DEFAULT_PAGINATION };
};

type OperatorSearchResponse = {
Expand Down

0 comments on commit c95038c

Please sign in to comment.