Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/sync with v1.1.0 #54

Open
wants to merge 7 commits into
base: dev-cere
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixing errors with networks & index.html
  • Loading branch information
Raid5594 committed Feb 15, 2024
commit d429787bb3b0d45487a965ded283259a8d68331b
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -81,4 +81,4 @@
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -5,11 +5,11 @@
"license": "GPL-3.0-only",
"private": false,
"scripts": {
"build": "tsc && vite build --base '/'",
"build": "tsc && vite build --base './'",
"build:pages": "tsc && vite build --base '/polkadot-staking-dashboard/'",
"clear": "rm -rf node_modules build tsconfig.tsbuildinfo",
"deploy:pages": "yarn build:pages && gh-pages -d build",
"dev": "vite",
"dev": "vite --base './'",
"lint": "eslint . --fix && npx prettier --write . && npx prettier --write ./.scripts && node ./.scripts/localeOrderKeys.cjs",
"locale:order": "node ./.scripts/localeOrderKeys.cjs",
"locale:validate": "node ./.scripts/localeValidate.cjs",
95 changes: 0 additions & 95 deletions public/index.html

This file was deleted.

2 changes: 2 additions & 0 deletions src/Providers.tsx
Original file line number Diff line number Diff line change
@@ -53,6 +53,8 @@ import { CereStatsProvider } from './contexts/CereStats';

// Embed providers from hook.
export const Providers = () => {
const networkAllData = useNetwork();
console.warn(networkAllData);
const {
network,
networkData: { ss58 },
2 changes: 1 addition & 1 deletion src/config/ledger.ts
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ import PolkadotSVG from 'img/appIcons/polkadot.svg?react';

export const LedgerApps: LedgerApp[] = [
{
network: 'Cere Mainnet',
network: 'cereMainnet',
appName: 'Polkadot',
Icon: PolkadotSVG,
},
8 changes: 4 additions & 4 deletions src/config/networks.ts
Original file line number Diff line number Diff line change
@@ -5,10 +5,10 @@ import CereLogoSvg from 'img/cere_logo.svg?react';
import type { NetworkName, Networks } from 'types';
import BigNumber from 'bignumber.js';

const CereMainnet: NetworkName = 'Cere Mainnet';
const CereTestnet: NetworkName = 'Cere Testnet';
const CereDevnet: NetworkName = 'Cere Devnet';
const CereQanet: NetworkName = 'Cere Qanet';
const CereMainnet: NetworkName = 'cereMainnet';
const CereTestnet: NetworkName = 'cereTestnet';
const CereDevnet: NetworkName = 'cereDevnet';
const CereQanet: NetworkName = 'cereQanet';

const cereMainnet = {
name: CereMainnet,
2 changes: 1 addition & 1 deletion src/consts.ts
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ import type { Plugin } from 'types';
export const AppVersion = '1.0.8';
export const DappName = 'Cere Staking Dashboard';
export const CereUrl = 'https://cere.network';
export const DefaultNetwork = 'Cere Mainnet';
export const DefaultNetwork = 'cereMainnet';
export const ManualSigners = ['ledger', 'vault'];
/*
* Data Structure Helpers
11 changes: 9 additions & 2 deletions src/contexts/Network/index.tsx
Original file line number Diff line number Diff line change
@@ -10,6 +10,8 @@ import type { NetworkState } from 'contexts/Api/types';
import type { NetworkContextInterface } from './types';
import { defaultNetworkContext } from './defaults';

console.log('Default network context');
console.log(defaultNetworkContext);
export const NetworkProvider = ({
children,
}: {
@@ -43,9 +45,12 @@ export const NetworkProvider = ({

// handle network switching
const switchNetwork = (name: NetworkName) => {
console.warn(`Switching network to name: ${name}`);
console.warn(NetworkList);

setNetwork({
name,
meta: NetworkList[name],
meta: NetworkList.cereMainnet,
});

// update url `n` if needed.
@@ -54,9 +59,11 @@ export const NetworkProvider = ({

// Store the initial active network.
const initialNetwork = getInitialNetwork();
console.warn('Initial network');
console.warn(NetworkList);
const [network, setNetwork] = useState<NetworkState>({
name: initialNetwork,
meta: NetworkList[initialNetwork],
meta: NetworkList.cereMainnet,
});

return (
4 changes: 2 additions & 2 deletions src/modals/Connect/Ledger.tsx
Original file line number Diff line number Diff line change
@@ -44,11 +44,11 @@ export const Ledger = (): React.ReactElement => {
</div>
<div className="row margin">
<ButtonText
text={network === 'Cere Mainnet' ? 'BETA' : 'EXPERIMENTAL'}
text={network === 'cereMainnet' ? 'BETA' : 'EXPERIMENTAL'}
disabled
marginRight
iconLeft={
network === 'Cere Mainnet' ? undefined : faExclamationTriangle
network === 'cereMainnet' ? undefined : faExclamationTriangle
}
style={{ opacity: 0.5 }}
/>
8 changes: 4 additions & 4 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -13,10 +13,10 @@ declare global {
}

export type NetworkName =
| 'Cere Mainnet'
| 'Cere Testnet'
| 'Cere Devnet'
| 'Cere Qanet';
| 'cereMainnet'
| 'cereTestnet'
| 'cereDevnet'
| 'cereQanet';

export type Networks = Record<string, Network>;