diff --git a/public/image/assethub-kusama-button-mobile.png b/public/image/assethub-kusama-button-mobile.png new file mode 100644 index 0000000..4f3697f Binary files /dev/null and b/public/image/assethub-kusama-button-mobile.png differ diff --git a/public/image/assethub-paseo-button-mobile.png b/public/image/assethub-paseo-button-mobile.png new file mode 100644 index 0000000..a988e14 Binary files /dev/null and b/public/image/assethub-paseo-button-mobile.png differ diff --git a/public/image/assethub-polkadot-button-mobile.png b/public/image/assethub-polkadot-button-mobile.png new file mode 100644 index 0000000..4d65a43 Binary files /dev/null and b/public/image/assethub-polkadot-button-mobile.png differ diff --git a/public/image/paseo-button-mobile.png b/public/image/paseo-button-mobile.png new file mode 100644 index 0000000..6ebd6fa Binary files /dev/null and b/public/image/paseo-button-mobile.png differ diff --git a/public/image/polkadot-button-mobile.png b/public/image/polkadot-button-mobile.png index 1b9a21d..701e3bb 100644 Binary files a/public/image/polkadot-button-mobile.png and b/public/image/polkadot-button-mobile.png differ diff --git a/src/components/ThemeSwitch.tsx b/src/components/ThemeSwitch.tsx index 97778c9..b34874c 100644 --- a/src/components/ThemeSwitch.tsx +++ b/src/components/ThemeSwitch.tsx @@ -7,7 +7,7 @@ import { updateStorage } from '../utils/helper/storage'; export const toggleTheme = (theme: THEME, network: Network) => { let networkName = network; if (Object.keys(chains).indexOf(networkName) < 0) { - networkName = 'polkadot'; + networkName = 'assethub-polkadot'; } if (document && document.documentElement) { document.documentElement.setAttribute('data-theme', theme); diff --git a/src/components/modals/SelectNetworkModal.tsx b/src/components/modals/SelectNetworkModal.tsx index 25843e7..c4c284e 100644 --- a/src/components/modals/SelectNetworkModal.tsx +++ b/src/components/modals/SelectNetworkModal.tsx @@ -26,13 +26,31 @@ export const SelectNetworkModal = (props: SelectNetworkModalProps) => { return getThemeColor(network); }, [network]); - const networks = useMemo( - () => - _.values(chains).sort((chain1) => { - return chain1?.name === 'polkadot' ? -1 : chain1?.name === 'kusama' ? -1 : 0; - }), - [] - ); + const networks = useMemo(() => { + const priorityOrder = ['assethub-polkadot', 'assethub-kusama', 'assethub-paseo']; + + // eslint-disable-next-line complexity + const compareNetworks = (a: NetConfigV2 | undefined, b: NetConfigV2 | undefined): number => { + const aIndex = priorityOrder.indexOf(a?.name || ''); + const bIndex = priorityOrder.indexOf(b?.name || ''); + + if (aIndex !== -1 && bIndex !== -1) { + return aIndex - bIndex; + } + + if (aIndex !== -1) { + return -1; + } + + if (bIndex !== -1) { + return 1; + } + + return (a?.name || '').localeCompare(b?.name || ''); + }; + + return _.values(chains).sort(compareNetworks); + }, []); const [customNetworks, setCustomNetworks] = useState([]); diff --git a/src/config/chains/assethub_kusama.json b/src/config/chains/assethub_kusama.json new file mode 100644 index 0000000..9ca9476 --- /dev/null +++ b/src/config/chains/assethub_kusama.json @@ -0,0 +1,12 @@ +{ + "name": "assethub-kusama", + "displayName": "Assethub Kusama", + "rpc": "wss://asset-hub-kusama-rpc.n.dwellir.com", + "api": { + "subql": "", + "subscan": "https://assethub-kusama.webapi.subscan.io" + }, + "logo": "/image/assethub-kusama-button-mobile.png", + "explorerHostName": "assethub-kusama", + "themeColor": "#000000" +} diff --git a/src/config/chains/assethub_paseo.json b/src/config/chains/assethub_paseo.json new file mode 100644 index 0000000..08b0692 --- /dev/null +++ b/src/config/chains/assethub_paseo.json @@ -0,0 +1,12 @@ +{ + "name": "assethub-paseo", + "displayName": "Assethub Paseo", + "rpc": "wss://asset-hub-paseo-rpc.n.dwellir.com", + "api": { + "subql": "", + "subscan": "https://assethub-paseo.webapi.subscan.io" + }, + "logo": "/image/assethub-paseo-button-mobile.png", + "explorerHostName": "assethub-paseo", + "themeColor": "#38393F" +} diff --git a/src/config/chains/assethub_polkadot.json b/src/config/chains/assethub_polkadot.json new file mode 100644 index 0000000..7575e71 --- /dev/null +++ b/src/config/chains/assethub_polkadot.json @@ -0,0 +1,12 @@ +{ + "name": "assethub-polkadot", + "displayName": "Assethub Polkadot", + "rpc": "wss://asset-hub-polkadot-rpc.n.dwellir.com", + "api": { + "subql": "", + "subscan": "https://assethub-polkadot.webapi.subscan.io" + }, + "logo": "/image/assethub-polkadot-button-mobile.png", + "explorerHostName": "assethub-polkadot", + "themeColor": "#E90979" +} diff --git a/src/config/chains/kusama.json b/src/config/chains/kusama.json deleted file mode 100644 index e5bd445..0000000 --- a/src/config/chains/kusama.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "kusama", - "displayName": "Kusama", - "rpc": "wss://kusama-rpc.dwellir.com", - "api": { - "subql": "https://api.subquery.network/sq/itering/multisig-kusama", - "subscan": "https://kusama.webapi.subscan.io" - }, - "logo": "/image/kusama-button-mobile.png", - "explorerHostName": "kusama", - "themeColor": "#000000" -} diff --git a/src/config/chains/polkadot.json b/src/config/chains/polkadot.json deleted file mode 100644 index aa6f483..0000000 --- a/src/config/chains/polkadot.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "polkadot", - "displayName": "Polkadot", - "rpc": "wss://rpc.polkadot.io", - "api": { - "subql": "https://api.subquery.network/sq/itering/multisig-polkadot", - "subscan": "https://polkadot.webapi.subscan.io" - }, - "logo": "/image/polkadot-button-mobile.png", - "explorerHostName": "polkadot", - "themeColor": "#e6007a" -} diff --git a/src/config/constant.ts b/src/config/constant.ts index c109361..878c98b 100644 --- a/src/config/constant.ts +++ b/src/config/constant.ts @@ -1,4 +1,4 @@ /* eslint-disable no-magic-numbers */ export const LONG_DURATION = 10 * 1000; -export const DONATE_ADDRESS = '14RYaXRSqb9rPqMaAVp1UZW2czQ6dMNGMbvukwfifi6m8ZgZ'; +export const DONATE_ADDRESS = '14rcFm5sH9aek5NJ6vzHuTwo29MKCB4GVEEPj5aXmP4cLce6'; diff --git a/src/config/theme.ts b/src/config/theme.ts index 890d2ac..9987893 100644 --- a/src/config/theme.ts +++ b/src/config/theme.ts @@ -32,7 +32,7 @@ export enum THEME { export function getThemeColor(network: string) { let networkTheme = chains[network]; if (!networkTheme) { - networkTheme = chains['polkadot']; + networkTheme = chains['assethub-polkadot']; } return networkTheme?.themeColor; diff --git a/src/model/network.ts b/src/model/network.ts index ff93862..bbcc363 100644 --- a/src/model/network.ts +++ b/src/model/network.ts @@ -1,6 +1,6 @@ import { Config } from './common'; -export type Network = 'polkadot' | 'kusama'; +export type Network = 'assethub-polkadot' | 'assethub-kusama'; export type Token = 'native'; diff --git a/src/providers/api-provider.tsx b/src/providers/api-provider.tsx index 9972ec1..e9d49b2 100644 --- a/src/providers/api-provider.tsx +++ b/src/providers/api-provider.tsx @@ -36,7 +36,7 @@ const cacheNetwork = (network: Network, rpc: string): void => { }; const initialState: StoreState = { - network: getInitialSetting('network', 'polkadot'), + network: getInitialSetting('network', 'assethub-polkadot'), rpc: getInitialSetting('rpc', ''), accounts: null, networkStatus: 'pending', @@ -135,7 +135,7 @@ export const ApiProvider = ({ children }: React.PropsWithChildren) => { } let selectedNetwork: NetConfigV2 | undefined = undefined; - let networkName: Network = 'polkadot'; + let networkName: Network = 'assethub-polkadot'; Object.keys(chains).forEach((key) => { if (chains[key]?.rpc === state.rpc) { selectedNetwork = chains[key]; @@ -146,12 +146,12 @@ export const ApiProvider = ({ children }: React.PropsWithChildren) => { if (!selectedNetwork) { if (storage.customNetwork && storage.customNetwork.rpc === state.rpc) { selectedNetwork = storage.customNetwork; - networkName = 'polkadot'; + networkName = 'assethub-polkadot'; } } if (!selectedNetwork) { - if (chains['polkadot']) { - changeUrlHash(chains['polkadot'].rpc); + if (chains['assethub-polkadot']) { + changeUrlHash(chains['assethub-polkadot'].rpc); } return; }