diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml
index 938370e..668ede1 100644
--- a/.github/workflows/build_and_test.yml
+++ b/.github/workflows/build_and_test.yml
@@ -49,6 +49,7 @@ jobs:
VITE_SENTRY_DSN_PROJECT_URI: ${{ secrets.SENTRY_DSN_PROJECT_URI }}
VITE_SENTRY_DSN_PROJECT_ID: ${{ secrets.SENTRY_DSN_PROJECT_ID }}
VITE_GITHUB_HASH: ${{ github.sha }}
+ VITE_IO_PROCESS_ID: ${{ secrets.IO_PROCESS_ID }}
# ao infra settings
VITE_AO_CU_URL: ${{ vars.VITE_AO_CU_URL }}
- name: Add CNAME Record
diff --git a/src/components/Header.tsx b/src/components/Header.tsx
index 142f564..c3d94d7 100644
--- a/src/components/Header.tsx
+++ b/src/components/Header.tsx
@@ -34,7 +34,7 @@ const Header = () => {
{gatewaysLoading ? (
) : gateways ? (
- Object.keys(gateways).length
+ Object.values(gateways).filter((g) => g.status === "joined").length
) : (
NBSP
)}
diff --git a/src/hooks/useRewardsInfo.ts b/src/hooks/useRewardsInfo.ts
index ff5528f..3bdefdb 100644
--- a/src/hooks/useRewardsInfo.ts
+++ b/src/hooks/useRewardsInfo.ts
@@ -7,17 +7,22 @@ import {
import useGateways from './useGateways';
import useProtocolBalance from './useProtocolBalance';
-const useRewardsInfo = (
- gateway: AoGateway | undefined,
- userStake: number
-) => {
+const useRewardsInfo = (gateway: AoGateway | undefined, userStake: number) => {
const { data: gateways } = useGateways();
const { data: protocolBalance } = useProtocolBalance();
let res: UserRewards | undefined = undefined;
- if (gateways && gateway && protocolBalance && protocolBalance > 0 && !isNaN(userStake)) {
- const numGateways = gateways ? Object.keys(gateways).length : 0;
+ if (
+ gateways &&
+ gateway &&
+ protocolBalance &&
+ protocolBalance > 0 &&
+ !isNaN(userStake)
+ ) {
+ const numGateways = gateways
+ ? Object.values(gateways).filter((g) => g.status == 'joined').length
+ : 0;
const gatewayRewards = calculateGatewayRewards(
new mIOToken(protocolBalance).toIO(),
numGateways,
@@ -27,7 +32,7 @@ const useRewardsInfo = (
const userRewards = calculateUserRewards(
gatewayRewards,
new IOToken(Math.abs(userStake)),
- userStake < 0
+ userStake < 0,
);
res = userRewards;
}
diff --git a/src/pages/Gateway/PropertyDisplayPanel.tsx b/src/pages/Gateway/PropertyDisplayPanel.tsx
index b51b565..db973a1 100644
--- a/src/pages/Gateway/PropertyDisplayPanel.tsx
+++ b/src/pages/Gateway/PropertyDisplayPanel.tsx
@@ -13,16 +13,14 @@ const DisplayRow = ({
rightComponent,
}: {
label: string;
- value: string | number | boolean | undefined;
+ value: React.ReactNode | string | number | boolean | undefined;
type?: string;
rightComponent?: React.ReactNode;
}) => {
return (
<>
{value === undefined ? (
@@ -79,17 +77,23 @@ const PropertyDisplayPanel = ({
? `${gateway.settings.protocol}://${gateway.settings.fqdn}:${gateway.settings.port}`
: undefined;
+ const gatewayLeaving = gateway?.status == 'leaving';
+
const conditionalRows = gateway?.settings.allowDelegatedStaking
? [
{
label: 'Reward Share Ratio:',
- value: `${gateway?.settings.delegateRewardShareRatio}%`,
+ value: gatewayLeaving
+ ? 'N/A'
+ : `${gateway?.settings.delegateRewardShareRatio}%`,
},
{
label: `Minimum Delegated Stake (${ticker}):`,
- value: new mIOToken(gateway?.settings.minDelegatedStake || 0)
- .toIO()
- .valueOf(),
+ value: gatewayLeaving
+ ? 'N/A'
+ : new mIOToken(gateway?.settings.minDelegatedStake || 0)
+ .toIO()
+ .valueOf(),
},
]
: [];
@@ -109,21 +113,37 @@ const PropertyDisplayPanel = ({
type: 'tx',
},
{
- label: `Gateway Stake (${ticker}):`,
- value: gateway?.operatorStake
- ? new mIOToken(gateway?.operatorStake).toIO().valueOf()
- : undefined,
+ label: `Gateway Stake abc (${ticker}):`,
+ value:
+ gateway?.operatorStake != undefined
+ ? new mIOToken(gateway?.operatorStake).toIO().valueOf()
+ : undefined,
+ },
+ {
+ label: 'Status:',
+ value:
+ gateway?.status == 'leaving' ? (
+
leaving
+ ) : (
+ gateway?.status
+ ),
},
- { label: 'Status:', value: gateway?.status },
{ label: 'Note:', value: gateway?.settings.note },
{
label: `Total Delegated Stake (${ticker}):`,
- value: new mIOToken(gateway?.totalDelegatedStake || 0).toIO().valueOf(),
+ value: gatewayLeaving
+ ? 'N/A'
+ : gateway?.totalDelegatedStake == undefined
+ ? undefined
+ : new mIOToken(gateway.totalDelegatedStake).toIO().valueOf(),
+ },
+ {
+ label: 'Reward Auto Stake:',
+ value: gatewayLeaving ? 'N/A' : gateway?.settings.autoStake,
},
- { label: 'Reward Auto Stake:', value: gateway?.settings.autoStake },
{
label: 'Delegated Staking:',
- value: gateway?.settings.allowDelegatedStaking,
+ value: gatewayLeaving ? 'N/A' : gateway?.settings.allowDelegatedStaking,
rightComponent: gateway?.settings.allowDelegatedStaking ? (
- }
- >
-