Skip to content

Commit

Permalink
Enable dApp staking v3 on Astar (#1182)
Browse files Browse the repository at this point in the history
  • Loading branch information
bobo-k2 authored Feb 13, 2024
1 parent ed150c3 commit 5c5dd02
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
20 changes: 1 addition & 19 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import {
createWebHistory,
} from 'vue-router';
import { StateInterface } from 'src/store';
import routes, { Path } from 'src/router/routes';
import { $api } from '../boot/api';
import routes from 'src/router/routes';
export { Path } from 'src/router/routes';
export { getHeaderName, buildTransferPageLink } from 'src/router/utils';

Expand Down Expand Up @@ -38,22 +37,5 @@ export default route<StateInterface>(function (/* { store, ssrContext } */) {
history: createHistory(process.env.MODE === 'ssr' ? void 0 : process.env.VUE_ROUTER_BASE),
});

// TODO - remove after the portal v3 is live.
Router.beforeEach((to, from, next) => {
// Prevent accessing to dApp staking pages if v3 is deployed to a node, but not supported by UI
const networksSupportV3 = ['development', 'shibuya-testnet', 'custom-node', 'shiden'];
const isStakingV3 = $api?.query.hasOwnProperty('dappStaking');
const dontNavigateToDappStaking =
to.path.includes('/dapp-staking') &&
!to.path.includes('/maintenance') &&
!networksSupportV3.includes(to.params?.network?.toString());

if (isStakingV3 && dontNavigateToDappStaking) {
next({ path: Path.DappStaking + Path.Maintenance });
} else {
next();
}
});

return Router;
});
8 changes: 1 addition & 7 deletions src/router/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import XvmTransfer from 'pages/XvmTransfer.vue';
import { endpointKey, getNetworkName } from 'src/config/chainEndpoints';
import { LOCAL_STORAGE } from 'src/config/localStorage';
import Store from 'src/pages/DappStaking.vue';
import StakingTop from 'components/dapp-staking/StakingTop.vue';
import Dashboard from 'src/pages/Dashboard.vue';
import RegisterDapp from 'src/pages/RegisterDapp.vue';
import StakeManage from 'src/pages/StakeManage.vue';
Expand Down Expand Up @@ -153,12 +152,7 @@ const routes: RouteRecordRaw[] = [
},
{
path: 'discover',
component:
networkParam === '/development' ||
networkParam === '/shibuya-testnet' ||
networkParam === '/shiden'
? DiscoverV3
: StakingTop,
component: DiscoverV3,
},
{
path: 'owner',
Expand Down

0 comments on commit 5c5dd02

Please sign in to comment.