diff --git a/source/constants/index.ts b/source/constants/index.ts index c461206c2..596eb058c 100644 --- a/source/constants/index.ts +++ b/source/constants/index.ts @@ -1,4 +1,5 @@ import { AvalancheChainId, AvalancheChainValue, BSCChainId, BSCChainValue, EthChainId, EthChainValue, PolygonChainId, PolygonChainValue } from 'scripts/Background/controllers/EVMChainController/types'; +import { StargazerChain } from 'scripts/common'; import { isProd, isNative, @@ -41,6 +42,7 @@ export const DAG_NETWORK: { testnet: boolean; explorer: string; chainId: number; + hexChainId: string; logo: string; network: string; config: { @@ -58,6 +60,7 @@ export const DAG_NETWORK: { testnet: false, explorer: 'https://mainnet.dagexplorer.io', chainId: 1, + hexChainId: '0x1', logo: CONSTELLATION_LOGO, network: 'Constellation', config: { @@ -73,6 +76,7 @@ export const DAG_NETWORK: { testnet: true, explorer: 'https://testnet.dagexplorer.io', chainId: 3, + hexChainId: '0x3', logo: CONSTELLATION_LOGO, network: 'Constellation', config: { @@ -90,11 +94,13 @@ export const ETH_NETWORK: { label: string; explorer: string; chainId: number; + hexChainId: string; rpcEndpoint: string; explorerAPI: string; nativeToken: string; mainnet: string; network: string; + networkId: string; logo: string; }; } = { @@ -106,9 +112,11 @@ export const ETH_NETWORK: { explorer: 'https://etherscan.io/', explorerAPI: 'https://api.etherscan.io', chainId: 1, + hexChainId: '0x1', nativeToken: 'ETH', mainnet: 'mainnet', network: 'Ethereum', + networkId: StargazerChain.ETHEREUM, logo: ETHEREUM_LOGO, }, goerli: { @@ -119,9 +127,11 @@ export const ETH_NETWORK: { explorer: 'https://goerli.etherscan.io/', explorerAPI: 'https://api-goerli.etherscan.io', chainId: 5, + hexChainId: '0x5', nativeToken: 'ETH', mainnet: 'mainnet', network: 'Ethereum', + networkId: StargazerChain.ETHEREUM, logo: ETHEREUM_LOGO, }, }; @@ -133,11 +143,13 @@ export const AVALANCHE_NETWORK: { label: string; explorer: string; chainId: number; + hexChainId: string; rpcEndpoint: string; explorerAPI: string; nativeToken: string; mainnet: string; network: string; + networkId: string; logo: string; }; } = { @@ -149,9 +161,11 @@ export const AVALANCHE_NETWORK: { explorer: 'https://snowtrace.io/', explorerAPI: 'https://api.snowtrace.io', chainId: 43114, + hexChainId: '0xa86a', nativeToken: 'AVAX', mainnet: 'avalanche-mainnet', network: 'Avalanche', + networkId: StargazerChain.AVALANCHE, logo: AVALANCHE_LOGO, }, ['avalanche-testnet']: { @@ -162,9 +176,11 @@ export const AVALANCHE_NETWORK: { explorer: 'https://testnet.snowtrace.io/', explorerAPI: 'https://api-testnet.snowtrace.io', chainId: 43113, + hexChainId: '0xa869', nativeToken: 'AVAX', mainnet: 'avalanche-mainnet', network: 'Avalanche', + networkId: StargazerChain.AVALANCHE, logo: AVALANCHE_LOGO, }, }; @@ -176,11 +192,13 @@ export const BSC_NETWORK: { label: string; explorer: string; chainId: number; + hexChainId: string; rpcEndpoint: string; explorerAPI: string; nativeToken: string; mainnet: string; network: string; + networkId: string; logo: string; }; } = { @@ -192,9 +210,11 @@ export const BSC_NETWORK: { explorer: 'https://bscscan.com/', explorerAPI: 'https://api.bscscan.com', chainId: 56, + hexChainId: '0x38', nativeToken: 'BNB', mainnet: 'bsc', network: 'BSC', + networkId: StargazerChain.BSC, logo: BSC_LOGO, }, ['bsc-testnet']: { @@ -205,9 +225,11 @@ export const BSC_NETWORK: { explorer: 'https://testnet.bscscan.com/', explorerAPI: 'https://api-testnet.bscscan.com', chainId: 97, + hexChainId: '0x61', nativeToken: 'BNB', mainnet: 'bsc', network: 'BSC', + networkId: StargazerChain.BSC, logo: BSC_LOGO, }, }; @@ -219,11 +241,13 @@ export const POLYGON_NETWORK: { label: string; explorer: string; chainId: number; + hexChainId: string; rpcEndpoint: string; explorerAPI: string; nativeToken: string; mainnet: string; network: string; + networkId: string; logo: string; }; } = { @@ -235,9 +259,11 @@ export const POLYGON_NETWORK: { explorer: 'https://polygonscan.com/', explorerAPI: 'https://api.polygonscan.com', chainId: 137, + hexChainId: '0x89', nativeToken: 'MATIC', mainnet: 'matic', network: 'Polygon', + networkId: StargazerChain.POLYGON, logo: POLYGON_LOGO, }, maticmum: { @@ -248,9 +274,11 @@ export const POLYGON_NETWORK: { explorer: 'https://mumbai.polygonscan.com/', explorerAPI: 'https://api-testnet.polygonscan.com', chainId: 80001, + hexChainId: '0x13881', nativeToken: 'MATIC', mainnet: 'matic', network: 'Polygon', + networkId: StargazerChain.POLYGON, logo: POLYGON_LOGO, }, }; @@ -280,6 +308,8 @@ export const ALL_EVM_CHAINS = { ...POLYGON_NETWORK }; +export const SUPPORTED_HEX_CHAINS = ['0x1', '0x5', '0xa86a', '0xa869', '0x89', '0x13881', '0x38', '0x61']; + export const ASSET_PRICE_API = 'https://pro-api.coingecko.com/api/v3/simple/price'; export const TOKEN_INFO_API = 'https://pro-api.coingecko.com/api/v3/coins'; diff --git a/source/scenes/external/SignatureRequest/index.tsx b/source/scenes/external/SignatureRequest/index.tsx index e62c2bf42..c7cd5f01d 100644 --- a/source/scenes/external/SignatureRequest/index.tsx +++ b/source/scenes/external/SignatureRequest/index.tsx @@ -23,11 +23,8 @@ import styles from './index.module.scss'; import walletsSelectors from 'selectors/walletsSelectors' import { StargazerProvider, StargazerSignatureRequest } from 'scripts/Provider/StargazerProvider'; -import { StargazerChain } from 'scripts/common'; -import { EthereumProvider } from 'scripts/Provider/EthereumProvider'; -import { PolygonProvider } from 'scripts/Provider/PolygonProvider'; -import { BinanceSmartChainProvider } from 'scripts/Provider/BinanceSmartChainProvider'; -import { AvalancheProvider } from 'scripts/Provider/AvalancheProvider'; +import { ProtocolProvider } from 'scripts/common'; +import { EVMProvider } from 'scripts/Provider/EVMProvider'; ////////////////////// // Component @@ -43,18 +40,15 @@ const SignatureRequest = () => { const { data: stringData } = queryString.parse(location.search); - const { signatureRequestEncoded, asset, chain, chainLabel }: - { signatureRequestEncoded: string, asset: string, chain: string, chainLabel: string } = JSON.parse(stringData as string); + const { signatureRequestEncoded, asset, provider, chainLabel }: + { signatureRequestEncoded: string, asset: string, provider: string, chainLabel: string } = JSON.parse(stringData as string); // TODO-349: Check how signature should work here - const PROVIDERS: { [chain: string]: StargazerProvider | EthereumProvider | PolygonProvider | BinanceSmartChainProvider | AvalancheProvider } = { - [StargazerChain.CONSTELLATION]: controller.stargazerProvider, - [StargazerChain.ETHEREUM]: controller.ethereumProvider, - [StargazerChain.POLYGON]: controller.polygonProvider, - [StargazerChain.BSC]: controller.bscProvider, - [StargazerChain.AVALANCHE]: controller.avalancheProvider, + const PROVIDERS: { [provider: string]: StargazerProvider | EVMProvider } = { + [ProtocolProvider.CONSTELLATION]: controller.stargazerProvider, + [ProtocolProvider.ETHEREUM]: controller.ethereumProvider, } - const provider = PROVIDERS[chain]; - const account = provider.getAssetByType(asset === 'DAG' ? AssetType.Constellation : AssetType.Ethereum); + const providerInstance = PROVIDERS[provider]; + const account = providerInstance.getAssetByType(asset === 'DAG' ? AssetType.Constellation : AssetType.Ethereum); const signatureRequest = JSON.parse(window.atob(signatureRequestEncoded)) as StargazerSignatureRequest; @@ -75,7 +69,7 @@ const SignatureRequest = () => { const onPositiveButtonClick = async () => { const message = asset === 'DAG' ? signatureRequestEncoded : signatureRequest.content; - const signature = provider.signMessage(message); + const signature = providerInstance.signMessage(message); const background = await browser.runtime.getBackgroundPage(); diff --git a/source/scenes/home/Home/Home.container.tsx b/source/scenes/home/Home/Home.container.tsx index d1de51985..29d8a9bf2 100644 --- a/source/scenes/home/Home/Home.container.tsx +++ b/source/scenes/home/Home/Home.container.tsx @@ -53,7 +53,7 @@ const HomeContainer: FC = ({ navigation, route }) => { const [balanceObject] = useTotalBalance(); const { supportedAssets }: IProvidersState = useSelector((state: RootState) => state.providers); - const { activeWallet, wallets, currentNetwork }: IVaultState = useSelector((state: RootState) => state.vault); + const { activeWallet, wallets }: IVaultState = useSelector((state: RootState) => state.vault); const linkTo = useLinkTo(); const accountController = getAccountController(); const isDagOnlyWallet = (activeWallet?.assets?.length === 1 && activeWallet?.assets[0]?.type === AssetType.Constellation); @@ -98,7 +98,6 @@ const HomeContainer: FC = ({ navigation, route }) => { isDagOnlyWallet={isDagOnlyWallet} multiChainWallets={multiChainWallets} privateKeyWallets={privateKeyWallets} - currentNetwork={currentNetwork} /> ); diff --git a/source/scenes/home/Home/Home.native.tsx b/source/scenes/home/Home/Home.native.tsx index f522d6f55..c73c6c2fb 100644 --- a/source/scenes/home/Home/Home.native.tsx +++ b/source/scenes/home/Home/Home.native.tsx @@ -13,9 +13,7 @@ import BackgroundTimer from 'react-native-background-timer'; /////////////////////////// import WalletsModal from './WalletsModal'; -// import NetworksModal from './NetworksModal'; import Sheet from 'components/Sheet'; -// import NetworkPicker from 'components/NetworkPicker'; import ButtonV3, { BUTTON_TYPES_ENUM, BUTTON_SIZES_ENUM } from 'components/ButtonV3'; import TextV3 from 'components/TextV3'; import AssetsPanel from './AssetsPanel'; @@ -51,7 +49,6 @@ import { BUY_STRING, SWAP_STRING } from './constants'; -// import { ALL_MAINNET_CHAINS, ALL_TESTNETS_CHAINS, ALL_CHAINS } from 'constants/index'; const ACTIVITY_INDICATOR_SIZE = 'large'; const ACTIVITY_INDICATOR_COLOR = '#FFF'; @@ -71,13 +68,11 @@ const Home: FC = ({ isDagOnlyWallet, multiChainWallets, privateKeyWallets, - currentNetwork, onBuyPressed, onSwapPressed }) => { const [isWalletSelectorOpen, setIsWalletSelectorOpen] = useState(false); - // const [isNetworkSelectorOpen, setIsNetworkSelectorOpen] = useState(false); const accountController = getAccountController(); const walletController = getWalletController(); @@ -90,11 +85,6 @@ const Home: FC = ({ await walletController.notifyWalletChange(accounts); }; - // const handleSwitchActiveNetwork = async (chainId: string) => { - // setIsNetworkSelectorOpen(false); - // await walletController.switchActiveNetwork(chainId); - // } - const renderHeaderTitle = () => { const ArrowIcon = isWalletSelectorOpen ? ArrowUpIcon : ArrowDownIcon; return ( @@ -155,22 +145,11 @@ const Home: FC = ({ } }, [AppState.currentState]); - // const networkTitle = ALL_MAINNET_CHAINS?.find((chain) => chain.id === currentNetwork)?.network || ALL_TESTNETS_CHAINS?.find((chain) => chain.id === currentNetwork)?.label; - // const networkLogo = ALL_CHAINS.find((chain) => chain.id === currentNetwork)?.logo; - return ( {activeWallet ? ( <> - {/* - setIsNetworkSelectorOpen(true)} - isOpen={isNetworkSelectorOpen} - /> - */} {balanceObject.symbol} @@ -224,20 +203,6 @@ const Home: FC = ({ handleSwitchWallet={handleSwitchWallet} /> - {/* setIsNetworkSelectorOpen(false)} - height='65%' - title={{ - label: 'Switch network', - align: 'left', - }} - > - - */} ); }; diff --git a/source/scenes/home/Home/Home.scss b/source/scenes/home/Home/Home.scss index eb3c0d664..ce4a1f8d3 100644 --- a/source/scenes/home/Home/Home.scss +++ b/source/scenes/home/Home/Home.scss @@ -9,13 +9,6 @@ width: 100%; height: 520px; - .networkPickerContainer { - display: flex; - justify-content: center; - align-items: center; - margin-bottom: 24px; - } - .mask { transition: all 0.3s; display: flex; @@ -118,10 +111,10 @@ section.center { display: flex; width: 100%; - height: 160px; align-items: center; justify-content: center; flex-direction: column; + margin-top: 24px; .price { display: flex; diff --git a/source/scenes/home/Home/Home.tsx b/source/scenes/home/Home/Home.tsx index 5c06d41d3..9f140313c 100644 --- a/source/scenes/home/Home/Home.tsx +++ b/source/scenes/home/Home/Home.tsx @@ -18,9 +18,7 @@ import { getWalletController } from 'utils/controllersUtils'; /////////////////////////// import WalletsModal from './WalletsModal'; -import NetworksModal from './NetworksModal'; import Sheet from 'components/Sheet'; -import NetworkPicker from 'components/NetworkPicker'; import CircularProgress from '@material-ui/core/CircularProgress'; import ArrowUpIcon from 'assets/images/svg/arrow-rounded-up-white.svg'; import ArrowDownIcon from 'assets/images/svg/arrow-rounded-down-white.svg'; @@ -49,7 +47,6 @@ import { BUY_STRING, SWAP_STRING } from './constants'; -import { ALL_MAINNET_CHAINS, ALL_TESTNETS_CHAINS, ALL_CHAINS } from 'constants/index'; /////////////////////////// // Scene @@ -62,14 +59,12 @@ const Home: FC = ({ balanceObject, multiChainWallets, privateKeyWallets, - currentNetwork, onBuyPressed, onSwapPressed, isDagOnlyWallet, }) => { const [isWalletSelectorOpen, setIsWalletSelectorOpen] = useState(false); - const [isNetworkSelectorOpen, setIsNetworkSelectorOpen] = useState(false); const walletController = getWalletController(); @@ -90,11 +85,6 @@ const Home: FC = ({ await walletController.notifyWalletChange(accounts); }; - const handleSwitchActiveNetwork = async (chainId: string) => { - setIsNetworkSelectorOpen(false); - await walletController.switchActiveNetwork(chainId); - } - // Sets the header for the home screen. useLayoutEffect(() => { navigation.setOptions({ @@ -107,23 +97,12 @@ const Home: FC = ({ // Render /////////////////////////// - const networkTitle = ALL_MAINNET_CHAINS?.find((chain) => chain.id === currentNetwork)?.network || ALL_TESTNETS_CHAINS?.find((chain) => chain.id === currentNetwork)?.label; - const networkLogo = ALL_CHAINS.find((chain) => chain.id === currentNetwork)?.logo; - return (
{activeWallet ? ( <> { <> -
- setIsNetworkSelectorOpen(true)} - isOpen={isNetworkSelectorOpen} - /> -
@@ -189,19 +168,6 @@ const Home: FC = ({ handleSwitchWallet={handleSwitchWallet} /> - setIsNetworkSelectorOpen(false)} - > - -
); }; diff --git a/source/scenes/home/Home/styles.ts b/source/scenes/home/Home/styles.ts index 3dd4b9bc8..523d4d87d 100644 --- a/source/scenes/home/Home/styles.ts +++ b/source/scenes/home/Home/styles.ts @@ -16,12 +16,7 @@ const styles = StyleSheet.create({ marginTop: 24, // height: 193, // do not use percentages messes up scrollview alignItems: 'center', - }, - networkPickerContainer: { - justifyContent: 'center', - alignItems: 'center', - marginBottom: 24, - marginTop: 24, + marginTop: 24 }, fiatBalance: { maxWidth: '80%', diff --git a/source/scenes/home/Home/types.tsx b/source/scenes/home/Home/types.tsx index baaa0a4e8..282ae0adc 100644 --- a/source/scenes/home/Home/types.tsx +++ b/source/scenes/home/Home/types.tsx @@ -19,7 +19,6 @@ export interface IHome { isDagOnlyWallet: boolean; multiChainWallets: KeyringWalletState[]; privateKeyWallets: KeyringWalletState[]; - currentNetwork: string; onBuyPressed: () => void; onSwapPressed: () => void; } diff --git a/source/scripts/Background/controllers/DAppController.ts b/source/scripts/Background/controllers/DAppController.ts index 09f149259..e38075211 100644 --- a/source/scripts/Background/controllers/DAppController.ts +++ b/source/scripts/Background/controllers/DAppController.ts @@ -3,7 +3,7 @@ import filter from 'lodash/filter'; import { listNewDapp, unlistDapp } from 'state/dapp'; import { IDAppInfo } from 'state/dapp/types'; import store from 'state/store'; -import { AvailableEvents, StargazerChain } from 'scripts/common'; +import { AvailableEvents, ProtocolProvider } from 'scripts/common'; import { getDappRegistry } from 'utils/controllersUtils'; type ISigRequest = { @@ -80,13 +80,13 @@ class DAppController { getDappRegistry().sendOriginChainEvent( origin, - StargazerChain.CONSTELLATION, + ProtocolProvider.CONSTELLATION, AvailableEvents.accountsChanged, [dagAccounts] ); getDappRegistry().sendOriginChainEvent( origin, - StargazerChain.ETHEREUM, + ProtocolProvider.ETHEREUM, AvailableEvents.accountsChanged, [ethAccounts] ); diff --git a/source/scripts/Background/controllers/IWalletController.ts b/source/scripts/Background/controllers/IWalletController.ts index 6a11f09ed..b69fa1909 100644 --- a/source/scripts/Background/controllers/IWalletController.ts +++ b/source/scripts/Background/controllers/IWalletController.ts @@ -31,7 +31,6 @@ export interface IWalletController { ) => void; switchWallet: (walletId: string) => Promise; switchNetwork: (networkType: string, networkId: string) => void; - switchActiveNetwork: (chainId: string) => void; addNetwork: (network: string, data: any) => void; // generateSeedPhrase: (update?: boolean) => string; // getGeneratedSeedPhrase: () => string; diff --git a/source/scripts/Background/controllers/MasterController.ts b/source/scripts/Background/controllers/MasterController.ts index 4aad49300..34e922f70 100644 --- a/source/scripts/Background/controllers/MasterController.ts +++ b/source/scripts/Background/controllers/MasterController.ts @@ -1,24 +1,17 @@ import { browser, Windows } from 'webextension-polyfill-ts'; import { StargazerProvider } from 'scripts/Provider/StargazerProvider'; -import { EthereumProvider } from 'scripts/Provider/EthereumProvider'; -import { PolygonProvider } from 'scripts/Provider/PolygonProvider'; -import { BinanceSmartChainProvider } from 'scripts/Provider/BinanceSmartChainProvider'; -import { AvalancheProvider } from 'scripts/Provider/AvalancheProvider'; import WalletController from './WalletController'; import { IWalletController } from './IWalletController'; import ControllerUtils, { IControllerUtils } from './ControllerUtils'; import ContactsController, { IContactsController } from './ContactsController'; import MigrationController from './MigrationController'; - import { DAppController } from './DAppController'; import { DappRegistry } from '../dappRegistry'; +import { EVMProvider } from 'scripts/Provider/EVMProvider'; class MasterController { #stargazerProvider: StargazerProvider; - #ethereumProvider: EthereumProvider; - #polygonProvider: PolygonProvider; - #bscProvider: BinanceSmartChainProvider; - #avalancheProvider: AvalancheProvider; + #ethereumProvider: EVMProvider; #wallet: IWalletController; #dapp: DAppController; #dappRegistry: DappRegistry; @@ -27,10 +20,7 @@ class MasterController { constructor() { this.#stargazerProvider = new StargazerProvider(); - this.#ethereumProvider = new EthereumProvider(); - this.#polygonProvider = new PolygonProvider(); - this.#bscProvider = new BinanceSmartChainProvider(); - this.#avalancheProvider = new AvalancheProvider(); + this.#ethereumProvider = new EVMProvider(); this.#wallet = WalletController; this.#dapp = new DAppController(); this.#dappRegistry = new DappRegistry() @@ -48,18 +38,6 @@ class MasterController { get ethereumProvider() { return this.#ethereumProvider; } - - get polygonProvider() { - return this.#polygonProvider; - } - - get bscProvider() { - return this.#bscProvider; - } - - get avalancheProvider() { - return this.#avalancheProvider; - } get wallet() { return this.#wallet; diff --git a/source/scripts/Background/controllers/WalletController.ts b/source/scripts/Background/controllers/WalletController.ts index 970715a02..2541247a7 100644 --- a/source/scripts/Background/controllers/WalletController.ts +++ b/source/scripts/Background/controllers/WalletController.ts @@ -10,7 +10,7 @@ import { updateWallets, addBitfiWallet, addCustomNetwork, - changeCurrentNetwork + changeCurrentEVMNetwork } from 'state/vault'; import { ICustomNetworkObject, IVaultWalletsStoreState } from 'state/vault/types' import { AVALANCHE_NETWORK, BSC_NETWORK, DAG_NETWORK, ETH_NETWORK, POLYGON_NETWORK } from 'constants/index'; @@ -36,7 +36,7 @@ import { AccountItem } from 'scripts/types'; import { AvalancheChainId, BSCChainId, EthChainId, PolygonChainId } from './EVMChainController/types'; import filter from 'lodash/filter'; import { generateId } from './EVMChainController/utils'; -import { AvailableEvents, StargazerChain } from 'scripts/common'; +import { AvailableEvents, ProtocolProvider } from 'scripts/common'; import { isNative } from 'utils/envUtil'; import { setAutoLogin } from 'state/biometrics'; @@ -358,59 +358,68 @@ class WalletController implements IWalletController { }, false); if (!isNative) { + const { hexChainId } = DAG_NETWORK[chainId]; getDappRegistry().sendOriginChainEvent( '*', - StargazerChain.CONSTELLATION, + ProtocolProvider.CONSTELLATION, AvailableEvents.chainChanged, - [`0x${DAG_NETWORK[chainId].chainId.toString(16)}`] + [hexChainId] ); } } if (network === KeyringNetwork.Ethereum) { this.account.networkController.switchEthereumChain(chainId as EthChainId); + store.dispatch(changeCurrentEVMNetwork(chainId)); if (!isNative) { + const { hexChainId } = ETH_NETWORK[chainId]; getDappRegistry().sendOriginChainEvent( '*', - StargazerChain.ETHEREUM, + ProtocolProvider.ETHEREUM, AvailableEvents.chainChanged, - [`0x${ETH_NETWORK[chainId].chainId.toString(16)}`] + [hexChainId] ); } } // 349: New network should be added here. if (network === 'Avalanche') { this.account.networkController.switchAvalancheChain(chainId as AvalancheChainId); + store.dispatch(changeCurrentEVMNetwork(chainId)); if (!isNative) { + const { hexChainId } = AVALANCHE_NETWORK[chainId]; getDappRegistry().sendOriginChainEvent( '*', - StargazerChain.AVALANCHE, + ProtocolProvider.ETHEREUM, AvailableEvents.chainChanged, - [`0x${AVALANCHE_NETWORK[chainId].chainId.toString(16)}`] + [hexChainId] ); } } if (network === 'BSC') { this.account.networkController.switchBSCChain(chainId as BSCChainId); + store.dispatch(changeCurrentEVMNetwork(chainId)); if (!isNative) { + const { hexChainId } = BSC_NETWORK[chainId]; getDappRegistry().sendOriginChainEvent( '*', - StargazerChain.BSC, + ProtocolProvider.ETHEREUM, AvailableEvents.chainChanged, - [`0x${BSC_NETWORK[chainId].chainId.toString(16)}`] + [hexChainId] ); } } if (network === 'Polygon') { this.account.networkController.switchPolygonChain(chainId as PolygonChainId); + store.dispatch(changeCurrentEVMNetwork(chainId)); if (!isNative) { + const { hexChainId } = POLYGON_NETWORK[chainId]; getDappRegistry().sendOriginChainEvent( '*', - StargazerChain.POLYGON, + ProtocolProvider.ETHEREUM, AvailableEvents.chainChanged, - [`0x${POLYGON_NETWORK[chainId].chainId.toString(16)}`] + [hexChainId] ); } } @@ -429,10 +438,6 @@ class WalletController implements IWalletController { await this.account.assetsBalanceMonitor.start(); } - async switchActiveNetwork(chainId: string) { - store.dispatch(changeCurrentNetwork(chainId)); - } - async addNetwork(network: string, data: any) { if (network === 'constellation') { diff --git a/source/scripts/Background/dappRegistry/dappProvider.ts b/source/scripts/Background/dappRegistry/dappProvider.ts index 87cdc912e..ac87b81ff 100644 --- a/source/scripts/Background/dappRegistry/dappProvider.ts +++ b/source/scripts/Background/dappRegistry/dappProvider.ts @@ -2,7 +2,6 @@ import { browser, Runtime, Windows } from 'webextension-polyfill-ts'; import { v4 as uuidv4 } from 'uuid'; import { - StargazerChain, StargazerProxyEvent, StargazerProxyRequest, StargazerProxyResponse, @@ -11,6 +10,7 @@ import { StargazerEncodedProxyResponse, isCustomEvent, AvailableEvents, + ProtocolProvider, } from '../../common'; import { @@ -23,7 +23,7 @@ import { type ChainProviderData = { proxyId: string; providerId: string; - chain: StargazerChain; + chain: ProtocolProvider; title: string; }; @@ -333,7 +333,7 @@ class DappProvider { event: AvailableEvents, data: any[] = [], ...filters: (( - chain: StargazerChain, + chain: ProtocolProvider, listenerId: string, chainData: ChainProviderData ) => boolean)[] diff --git a/source/scripts/Background/dappRegistry/dappRegistry.ts b/source/scripts/Background/dappRegistry/dappRegistry.ts index d8c143035..e27bb65bd 100644 --- a/source/scripts/Background/dappRegistry/dappRegistry.ts +++ b/source/scripts/Background/dappRegistry/dappRegistry.ts @@ -1,5 +1,5 @@ import debugFn from 'debug'; -import { AvailableEvents, StargazerChain } from 'scripts/common'; +import { AvailableEvents, ProtocolProvider } from 'scripts/common'; import { browser, Runtime } from 'webextension-polyfill-ts'; import { DappProvider } from './dappProvider'; @@ -61,7 +61,7 @@ class DappRegistry { sendOriginChainEvent( origin: '*' | string, - chain: '*' | StargazerChain, + chain: '*' | ProtocolProvider, event: AvailableEvents, data: any[] = [] ) { diff --git a/source/scripts/Background/dappRegistry/requests/rpc.ts b/source/scripts/Background/dappRegistry/requests/rpc.ts index adb392435..d79807f84 100644 --- a/source/scripts/Background/dappRegistry/requests/rpc.ts +++ b/source/scripts/Background/dappRegistry/requests/rpc.ts @@ -1,7 +1,7 @@ import { - StargazerChain, AvailableChainMethods, AvailableChainMethod, + ProtocolProvider, } from '../../../common'; import type { DappProviderExternalImplementation } from '../dappProvider'; @@ -20,11 +20,8 @@ const handleRpcRequest: DappProviderExternalImplementation<'onRpcRequest', []> = } const CHAIN_PROVIDERS = { - [StargazerChain.CONSTELLATION]: window.controller.stargazerProvider, - [StargazerChain.ETHEREUM]: window.controller.ethereumProvider, - [StargazerChain.POLYGON]: window.controller.polygonProvider, - [StargazerChain.BSC]: window.controller.bscProvider, - [StargazerChain.AVALANCHE]: window.controller.avalancheProvider, + [ProtocolProvider.CONSTELLATION]: window.controller.stargazerProvider, + [ProtocolProvider.ETHEREUM]: window.controller.ethereumProvider, } const chain = dappProvider.getChainProviderDataByPort(port).chain; diff --git a/source/scripts/InjectedScript/stargazerChainProvider.ts b/source/scripts/InjectedScript/stargazerChainProvider.ts index 7308b9e08..c98b636e0 100644 --- a/source/scripts/InjectedScript/stargazerChainProvider.ts +++ b/source/scripts/InjectedScript/stargazerChainProvider.ts @@ -3,10 +3,10 @@ import debugFn from 'debug'; import { RequestArguments, EIPChainProvider, - StargazerChain, generateNamespaceId, StargazerProxyEvent, AvailableEvents, + ProtocolProvider, } from '../common'; import { StargazerChainProviderProxy } from './stargazerChainProviderProxy'; @@ -26,9 +26,9 @@ class StargazerChainProvider extends EIPChainProvider { #proxy: StargazerChainProviderProxy; #listeners: Map; #providerId: string; - #chain: StargazerChain; + #chain: ProtocolProvider; - constructor(chain: StargazerChain) { + constructor(chain: ProtocolProvider) { super(); this.#proxy = new StargazerChainProviderProxy( this, diff --git a/source/scripts/InjectedScript/stargazerWalletProvider.ts b/source/scripts/InjectedScript/stargazerWalletProvider.ts index 52ccbf38f..3177c3d10 100644 --- a/source/scripts/InjectedScript/stargazerWalletProvider.ts +++ b/source/scripts/InjectedScript/stargazerWalletProvider.ts @@ -1,4 +1,4 @@ -import { readOnlyProxy, StargazerChain } from '../common'; +import { readOnlyProxy, ProtocolProvider, StargazerChain } from '../common'; import { StargazerChainProvider } from './stargazerChainProvider'; import { @@ -16,7 +16,7 @@ import { * + Provides wallet version. */ class StargazerWalletProvider { - #cacheChainProviders: Map; + #cacheChainProviders: Map; constructor() { this.#cacheChainProviders = new Map(); @@ -35,8 +35,26 @@ class StargazerWalletProvider { }; } - getProvider(chain: StargazerChain) { - if (!Object.values(StargazerChain).includes(chain)) { + getProvider(chainValue: StargazerChain) { + if (typeof chainValue !== 'string') { + throw new StargazerWalletProviderError('Chain value must be a string'); + } + + if (!chainValue) { + throw new StargazerWalletProviderError('Chain value not provided'); + } + + const MAP_CHAIN_TO_PROTOCOL = { + [StargazerChain.CONSTELLATION]: ProtocolProvider.CONSTELLATION, + [StargazerChain.ETHEREUM]: ProtocolProvider.ETHEREUM, + [StargazerChain.AVALANCHE]: ProtocolProvider.ETHEREUM, + [StargazerChain.POLYGON]: ProtocolProvider.ETHEREUM, + [StargazerChain.BSC]: ProtocolProvider.ETHEREUM, + } + + const chain: ProtocolProvider = MAP_CHAIN_TO_PROTOCOL[chainValue]; + + if (!Object.values(ProtocolProvider).includes(chain)) { throw new StargazerWalletProviderError(`Unsupported chain '${chain}'`); } diff --git a/source/scripts/Provider/AvalancheProvider.ts b/source/scripts/Provider/AvalancheProvider.ts deleted file mode 100644 index 32e9c3098..000000000 --- a/source/scripts/Provider/AvalancheProvider.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { EVMProvider } from './EVMProvider'; -import { StargazerChain } from '../common'; - -export class AvalancheProvider extends EVMProvider { - - constructor() { - super(StargazerChain.AVALANCHE); - } - -} diff --git a/source/scripts/Provider/BinanceSmartChainProvider.ts b/source/scripts/Provider/BinanceSmartChainProvider.ts deleted file mode 100644 index 991c3807f..000000000 --- a/source/scripts/Provider/BinanceSmartChainProvider.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { EVMProvider } from './EVMProvider'; -import { StargazerChain } from '../common'; - -export class BinanceSmartChainProvider extends EVMProvider { - - constructor() { - super(StargazerChain.BSC); - } - -} diff --git a/source/scripts/Provider/EVMProvider.ts b/source/scripts/Provider/EVMProvider.ts index cc9b0dd48..4147d0ca7 100644 --- a/source/scripts/Provider/EVMProvider.ts +++ b/source/scripts/Provider/EVMProvider.ts @@ -27,11 +27,12 @@ import { StargazerProxyRequest, EIPRpcError, StargazerChain, + ProtocolProvider, } from '../common'; import { TypedSignatureRequest } from 'scenes/external/TypedSignatureRequest'; import { StargazerSignatureRequest } from './StargazerProvider'; import { getChainId, getChainInfo } from 'scripts/Background/controllers/EVMChainController/utils'; -import { ALL_EVM_CHAINS } from 'constants/index'; +import { ALL_EVM_CHAINS, SUPPORTED_HEX_CHAINS } from 'constants/index'; // Constants const LEDGER_URL = '/ledger.html'; @@ -41,83 +42,55 @@ const WINDOW_TYPES: Record = { normal: 'normal', }; -type NetworkInfo = { - id: string; - label: string; - token: string; +interface SwitchEthereumChainParameter { + chainId: string; } -export abstract class EVMProvider implements IRpcChainRequestHandler { - - #network: NetworkInfo; - - constructor(network: string) { - this.#network = this.initNetworkInfo(network); - } +export class EVMProvider implements IRpcChainRequestHandler { ////////////////////// // Private methods ////////////////////// - private initNetworkInfo(network: string) { - switch (network) { - case StargazerChain.ETHEREUM: - return { - id: StargazerChain.ETHEREUM, - label: KeyringNetwork.Ethereum, - token: 'ETH', - }; - case StargazerChain.POLYGON: - return { - id: StargazerChain.POLYGON, - label: 'Polygon', - token: 'MATIC', - }; - case StargazerChain.BSC: - return { - id: StargazerChain.BSC, - label: 'BSC', - token: 'BNB', - }; - case StargazerChain.AVALANCHE: - return { - id: StargazerChain.AVALANCHE, - label: 'Avalanche', - token: 'AVAX', - }; - - default: - return { - id: StargazerChain.ETHEREUM, - label: KeyringNetwork.Ethereum, - token: 'ETH', - }; - } + private getNetworkInfo() { + const { currentEVMNetwork }: IVaultState = store.getState().vault; + const networkInfo = Object.values(ALL_EVM_CHAINS).find(chain => chain.id === currentEVMNetwork); + + if (!networkInfo) throw new Error('Network not found'); + + return networkInfo; } private getNetworkLabel() { - return this.#network.label; + const network = this.getNetworkInfo(); + return network.network; } private getNetworkId() { - return this.#network.id; + const network = this.getNetworkInfo(); + return network.networkId; } private getNetworkToken() { - return this.#network.token; + const network = this.getNetworkInfo(); + return network.nativeToken; } private getWallet() { const controller = useController(); - const networkId = this.#network.id; + const networkId = this.getNetworkId(); if (networkId === StargazerChain.ETHEREUM) { return controller.wallet.account.networkController.ethereumNetwork.getWallet(); } else if (networkId === StargazerChain.POLYGON) { return controller.wallet.account.networkController.polygonNetwork.getWallet(); + } else if (networkId === StargazerChain.BSC) { + return controller.wallet.account.networkController.bscNetwork.getWallet(); + } else if (networkId === StargazerChain.AVALANCHE) { + return controller.wallet.account.networkController.avalancheNetwork.getWallet(); } - return controller.wallet.account.networkController.ethereumNetwork.getWallet(); + throw new Error('Wallet not found'); } private remove0x(hash: string) { @@ -128,12 +101,6 @@ export abstract class EVMProvider implements IRpcChainRequestHandler { return hash.startsWith('0x') ? hash : `0x${hash}`; } - private updateActiveNetwork() { - const controller = useController(); - const activeNetwork = this.getNetwork(); - controller.wallet.switchActiveNetwork(activeNetwork); - } - ////////////////////// // Public methods ////////////////////// @@ -353,7 +320,7 @@ export abstract class EVMProvider implements IRpcChainRequestHandler { walletId: activeWallet.id, walletLabel: activeWallet.label, publicKey: '', - chain: this.getNetworkId(), + provider: ProtocolProvider.ETHEREUM, chainLabel }; @@ -387,7 +354,6 @@ export abstract class EVMProvider implements IRpcChainRequestHandler { throw new EIPRpcError('User Rejected Request', 4001); } - this.updateActiveNetwork(); return signatureEvent.detail.signature.hex; } @@ -499,17 +465,34 @@ export abstract class EVMProvider implements IRpcChainRequestHandler { const signature = this.signTypedData(data.domain, data.types, data.message); - this.updateActiveNetwork(); return signature; } if (request.method === AvailableMethods.eth_sendTransaction) { - const [trxData] = request.params as [ethers.Transaction]; + const [trxData] = request.params; + console.log('trxData', trxData); let decodedContractCall: ContractInputData | null = null; let eventType: string = 'transactionSent'; let route: string = 'sendTransaction'; + // chainId should match the current active network if chainId property is provided. + if (!!trxData?.chainId) { + const chainId = this.getChainId(); + + if (typeof trxData.chainId === 'number') { + if (trxData.chainId !== chainId) { + throw new Error('chainId does not match the active network chainId'); + } + } + + if (typeof trxData.chainId === 'string') { + if (parseInt(trxData.chainId) !== chainId) { + throw new Error('chainId does not match the active network chainId'); + } + } + } + try { decodedContractCall = typeof trxData.data === 'string' @@ -550,7 +533,6 @@ export abstract class EVMProvider implements IRpcChainRequestHandler { throw new EIPRpcError('User Rejected Request', 4001); } - this.updateActiveNetwork(); return event.detail.result; } @@ -558,6 +540,41 @@ export abstract class EVMProvider implements IRpcChainRequestHandler { return ethers.utils.keccak256(request.params[0]); } + if (request.method === AvailableMethods.wallet_switchEthereumChain) { + const [chainData] = request?.params as [SwitchEthereumChainParameter] || []; + + if (!chainData || !chainData?.chainId) { + throw new Error('chainId not provided'); + } + + const { chainId } = chainData; + + if (typeof chainId !== 'string'){ + throw new Error('chainId must be a string'); + } + + if (!chainId.startsWith('0x')) { + throw new Error('chainId must specify the integer ID of the chain as a hexadecimal string'); + } + + if (!SUPPORTED_HEX_CHAINS.includes(chainId)) { + // Show network not supported popup + throw new Error('chainId not supported'); + } + + const controller = useController(); + const chainInfo = Object.values(ALL_EVM_CHAINS).find(chain => chain.hexChainId === chainId); + + try { + await controller.wallet.switchNetwork(chainInfo.network, chainInfo.id); + } catch (e) { + throw new Error('There was an error switching the Ethereum chain'); + } + + // https://eips.ethereum.org/EIPS/eip-3326#returns + return null; + } + throw new Error('Unsupported non-proxied method'); } } diff --git a/source/scripts/Provider/EthereumProvider.ts b/source/scripts/Provider/EthereumProvider.ts deleted file mode 100644 index ba91b22e3..000000000 --- a/source/scripts/Provider/EthereumProvider.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { EVMProvider } from './EVMProvider'; -import { StargazerChain } from '../common'; - -export class EthereumProvider extends EVMProvider { - - constructor() { - super(StargazerChain.ETHEREUM); - } - -} diff --git a/source/scripts/Provider/PolygonProvider.ts b/source/scripts/Provider/PolygonProvider.ts deleted file mode 100644 index 9036a4648..000000000 --- a/source/scripts/Provider/PolygonProvider.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { EVMProvider } from './EVMProvider'; -import { StargazerChain } from '../common'; - -export class PolygonProvider extends EVMProvider { - - constructor() { - super(StargazerChain.POLYGON); - } - -} diff --git a/source/scripts/Provider/StargazerProvider.ts b/source/scripts/Provider/StargazerProvider.ts index 935967511..556fbb2e3 100644 --- a/source/scripts/Provider/StargazerProvider.ts +++ b/source/scripts/Provider/StargazerProvider.ts @@ -20,7 +20,7 @@ import { StargazerProxyRequest, AvailableMethods, EIPRpcError, - StargazerChain, + ProtocolProvider, } from '../common'; export type StargazerSignatureRequest = { @@ -63,12 +63,6 @@ export class StargazerProvider implements IRpcChainRequestHandler { return stargazerAsset && stargazerAsset.address; } - private updateActiveNetwork() { - const controller = useController(); - const activeNetwork = this.getNetwork(); - controller.wallet.switchActiveNetwork(activeNetwork); - } - getPublicKey() { const { dapp, vault } = store.getState(); const { whitelist }: IDAppState = dapp; @@ -297,6 +291,8 @@ export class StargazerProvider implements IRpcChainRequestHandler { const signatureRequestEncoded = this.normalizeSignatureRequest(signatureRequest); + const chainLabel = this.getChainId() === 1 ? 'Constellation' : 'Constellation Testnet 2.0'; + const signatureData = { origin: dappProvider.origin, asset: 'DAG', @@ -305,8 +301,8 @@ export class StargazerProvider implements IRpcChainRequestHandler { walletLabel: activeWallet.label, deviceId, bipIndex, - chain: StargazerChain.CONSTELLATION, - chainLabel: 'Constellation' + provider: ProtocolProvider.CONSTELLATION, + chainLabel }; const signatureEvent = await dappProvider.createPopupAndWaitForEvent( @@ -328,7 +324,6 @@ export class StargazerProvider implements IRpcChainRequestHandler { throw new EIPRpcError('User Rejected Request', 4001); } - this.updateActiveNetwork(); return signatureEvent.detail.signature.hex; } @@ -414,7 +409,7 @@ export class StargazerProvider implements IRpcChainRequestHandler { to: txDestination, value: txAmount / 1e8, // DATUM to DAG fee: txFee / 1e8, // DATUM to DAG - chain: StargazerChain.CONSTELLATION + chain: ProtocolProvider.CONSTELLATION }; const sentTransactionEvent = await dappProvider.createPopupAndWaitForEvent( @@ -440,7 +435,6 @@ export class StargazerProvider implements IRpcChainRequestHandler { throw new EIPRpcError('User Rejected Request', 4001); } - this.updateActiveNetwork(); return sentTransactionEvent.detail.result; } diff --git a/source/scripts/common/availableChainMethods.ts b/source/scripts/common/availableChainMethods.ts index 39160aeda..fb84a2747 100644 --- a/source/scripts/common/availableChainMethods.ts +++ b/source/scripts/common/availableChainMethods.ts @@ -1,13 +1,10 @@ -import { StargazerChain } from './chains'; +import { ProtocolProvider } from './chains'; import { AvailableMethods } from './availableMethods'; import { AvailableEthereumChainMethods } from './methods/availableEthereumMethods'; -import { AvailablePolygonChainMethods } from './methods/availablePolygonMethods'; -import { AvailableBSCChainMethods } from './methods/availableBSCMethods'; -import { AvailableAvalancheChainMethods } from './methods/availableAvalancheMethods'; import { AvailableConstellationChainMethods } from './methods/availableConstellationMethods'; type AvailableChainMethod = { - chain: StargazerChain; + chain: ProtocolProvider; method: AvailableMethods; proxied: boolean; permissions: string[]; @@ -17,15 +14,6 @@ const AvailableChainMethods: AvailableChainMethod[] = [ /* Ethereum */ ...AvailableEthereumChainMethods, - /* Polygon */ - ...AvailablePolygonChainMethods, - - /* BSC */ - ...AvailableBSCChainMethods, - - /* Avalanche */ - ...AvailableAvalancheChainMethods, - /* Constellation */ ...AvailableConstellationChainMethods ]; diff --git a/source/scripts/common/availableMethods.ts b/source/scripts/common/availableMethods.ts index d438e16a5..7299a3245 100644 --- a/source/scripts/common/availableMethods.ts +++ b/source/scripts/common/availableMethods.ts @@ -35,6 +35,8 @@ enum AvailableMethods { eth_uninstallFilter = 'eth_uninstallFilter', eth_signTypedData = 'eth_signTypedData', eth_signTypedData_v4 = 'eth_signTypedData_v4', // Alias of eth_signTypedData + wallet_switchEthereumChain = 'wallet_switchEthereumChain', + /* Constellation */ dag_chainId = 'dag_chainId', diff --git a/source/scripts/common/chains.ts b/source/scripts/common/chains.ts index d47322761..7cec7599c 100644 --- a/source/scripts/common/chains.ts +++ b/source/scripts/common/chains.ts @@ -1,5 +1,10 @@ import { AssetType } from "state/vault/types"; +enum ProtocolProvider { + CONSTELLATION = 'constellation', + ETHEREUM = 'ethereum', +} + enum StargazerChain { CONSTELLATION = 'constellation', ETHEREUM = 'ethereum', @@ -16,4 +21,4 @@ const ASSET_ID: { [chain: string]: string } = { [StargazerChain.AVALANCHE]: AssetType.Avalanche, } -export { StargazerChain, ASSET_ID }; +export { StargazerChain, ProtocolProvider, ASSET_ID }; diff --git a/source/scripts/common/methods/availableAvalancheMethods.ts b/source/scripts/common/methods/availableAvalancheMethods.ts deleted file mode 100644 index 4d128d6f8..000000000 --- a/source/scripts/common/methods/availableAvalancheMethods.ts +++ /dev/null @@ -1,219 +0,0 @@ -import { StargazerChain } from '../chains'; -import { AvailableMethods } from '../availableMethods'; -import { AvailableChainMethod } from '../availableChainMethods'; - -const AvailableAvalancheChainMethods: AvailableChainMethod[] = [ - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_accounts, - proxied: false, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.personal_sign, - proxied: false, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_sendTransaction, - proxied: false, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.web3_sha3, - proxied: false, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_signTypedData, - proxied: false, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_signTypedData_v4, - proxied: false, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.net_version, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_blockNumber, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_call, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_chainId, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_estimateGas, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_gasPrice, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_getBalance, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_getBlockByHash, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_getBlockByNumber, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_getBlockTransactionCountByHash, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_getBlockTransactionCountByNumber, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_getCode, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_getFilterChanges, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_getFilterLogs, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_getLogs, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_getStorageAt, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_getTransactionByBlockHashAndIndex, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_getTransactionByBlockNumberAndIndex, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_getTransactionByHash, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_getTransactionCount, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_getTransactionReceipt, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_getUncleByBlockHashAndIndex, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_getUncleByBlockNumberAndIndex, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_getUncleCountByBlockHash, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_getUncleCountByBlockNumber, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_newBlockFilter, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_newFilter, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_protocolVersion, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.AVALANCHE, - method: AvailableMethods.eth_uninstallFilter, - proxied: true, - permissions: [], - }, -]; - -export type { AvailableChainMethod }; -export { AvailableAvalancheChainMethods }; diff --git a/source/scripts/common/methods/availableBSCMethods.ts b/source/scripts/common/methods/availableBSCMethods.ts deleted file mode 100644 index dfc9f703d..000000000 --- a/source/scripts/common/methods/availableBSCMethods.ts +++ /dev/null @@ -1,219 +0,0 @@ -import { StargazerChain } from '../chains'; -import { AvailableMethods } from '../availableMethods'; -import { AvailableChainMethod } from '../availableChainMethods'; - -const AvailableBSCChainMethods: AvailableChainMethod[] = [ - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_accounts, - proxied: false, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.personal_sign, - proxied: false, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_sendTransaction, - proxied: false, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.web3_sha3, - proxied: false, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_signTypedData, - proxied: false, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_signTypedData_v4, - proxied: false, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.net_version, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_blockNumber, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_call, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_chainId, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_estimateGas, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_gasPrice, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_getBalance, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_getBlockByHash, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_getBlockByNumber, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_getBlockTransactionCountByHash, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_getBlockTransactionCountByNumber, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_getCode, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_getFilterChanges, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_getFilterLogs, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_getLogs, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_getStorageAt, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_getTransactionByBlockHashAndIndex, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_getTransactionByBlockNumberAndIndex, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_getTransactionByHash, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_getTransactionCount, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_getTransactionReceipt, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_getUncleByBlockHashAndIndex, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_getUncleByBlockNumberAndIndex, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_getUncleCountByBlockHash, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_getUncleCountByBlockNumber, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_newBlockFilter, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_newFilter, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_protocolVersion, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.BSC, - method: AvailableMethods.eth_uninstallFilter, - proxied: true, - permissions: [], - }, -]; - -export type { AvailableChainMethod }; -export { AvailableBSCChainMethods }; diff --git a/source/scripts/common/methods/availableConstellationMethods.ts b/source/scripts/common/methods/availableConstellationMethods.ts index e6f432032..d01b5732d 100644 --- a/source/scripts/common/methods/availableConstellationMethods.ts +++ b/source/scripts/common/methods/availableConstellationMethods.ts @@ -1,52 +1,52 @@ -import { StargazerChain } from '../chains'; +import { ProtocolProvider } from '../chains'; import { AvailableMethods } from '../availableMethods'; import { AvailableChainMethod } from '../availableChainMethods'; const AvailableConstellationChainMethods: AvailableChainMethod[] = [ { - chain: StargazerChain.CONSTELLATION, + chain: ProtocolProvider.CONSTELLATION, method: AvailableMethods.dag_chainId, proxied: false, permissions: [], }, { - chain: StargazerChain.CONSTELLATION, + chain: ProtocolProvider.CONSTELLATION, method: AvailableMethods.dag_accounts, proxied: false, permissions: [], }, { - chain: StargazerChain.CONSTELLATION, + chain: ProtocolProvider.CONSTELLATION, method: AvailableMethods.dag_getBalance, proxied: false, permissions: [], }, { - chain: StargazerChain.CONSTELLATION, + chain: ProtocolProvider.CONSTELLATION, method: AvailableMethods.dag_signMessage, proxied: false, permissions: [], }, { - chain: StargazerChain.CONSTELLATION, + chain: ProtocolProvider.CONSTELLATION, method: AvailableMethods.dag_getPublicKey, proxied: false, permissions: [], }, { - chain: StargazerChain.CONSTELLATION, + chain: ProtocolProvider.CONSTELLATION, method: AvailableMethods.dag_sendTransaction, proxied: false, permissions: [], }, { - chain: StargazerChain.CONSTELLATION, + chain: ProtocolProvider.CONSTELLATION, method: AvailableMethods.dag_getPendingTransaction, proxied: false, permissions: [], }, { - chain: StargazerChain.CONSTELLATION, + chain: ProtocolProvider.CONSTELLATION, method: AvailableMethods.dag_getTransaction, proxied: false, permissions: [], diff --git a/source/scripts/common/methods/availableEthereumMethods.ts b/source/scripts/common/methods/availableEthereumMethods.ts index 726818d74..f8b3aed91 100644 --- a/source/scripts/common/methods/availableEthereumMethods.ts +++ b/source/scripts/common/methods/availableEthereumMethods.ts @@ -1,214 +1,220 @@ -import { StargazerChain } from '../chains'; +import { ProtocolProvider } from '../chains'; import { AvailableMethods } from '../availableMethods'; import { AvailableChainMethod } from '../availableChainMethods'; const AvailableEthereumChainMethods: AvailableChainMethod[] = [ { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_accounts, proxied: false, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.personal_sign, proxied: false, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_sendTransaction, proxied: false, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.web3_sha3, proxied: false, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_signTypedData, proxied: false, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_signTypedData_v4, proxied: false, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, + method: AvailableMethods.wallet_switchEthereumChain, + proxied: false, + permissions: [], + }, + { + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.net_version, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_blockNumber, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_call, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_chainId, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_estimateGas, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_gasPrice, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_getBalance, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_getBlockByHash, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_getBlockByNumber, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_getBlockTransactionCountByHash, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_getBlockTransactionCountByNumber, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_getCode, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_getFilterChanges, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_getFilterLogs, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_getLogs, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_getStorageAt, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_getTransactionByBlockHashAndIndex, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_getTransactionByBlockNumberAndIndex, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_getTransactionByHash, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_getTransactionCount, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_getTransactionReceipt, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_getUncleByBlockHashAndIndex, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_getUncleByBlockNumberAndIndex, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_getUncleCountByBlockHash, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_getUncleCountByBlockNumber, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_newBlockFilter, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_newFilter, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_protocolVersion, proxied: true, permissions: [], }, { - chain: StargazerChain.ETHEREUM, + chain: ProtocolProvider.ETHEREUM, method: AvailableMethods.eth_uninstallFilter, proxied: true, permissions: [], diff --git a/source/scripts/common/methods/availablePolygonMethods.ts b/source/scripts/common/methods/availablePolygonMethods.ts deleted file mode 100644 index 1b2eb4b51..000000000 --- a/source/scripts/common/methods/availablePolygonMethods.ts +++ /dev/null @@ -1,219 +0,0 @@ -import { StargazerChain } from '../chains'; -import { AvailableMethods } from '../availableMethods'; -import { AvailableChainMethod } from '../availableChainMethods'; - -const AvailablePolygonChainMethods: AvailableChainMethod[] = [ - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_accounts, - proxied: false, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.personal_sign, - proxied: false, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_sendTransaction, - proxied: false, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.web3_sha3, - proxied: false, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_signTypedData, - proxied: false, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_signTypedData_v4, - proxied: false, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.net_version, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_blockNumber, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_call, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_chainId, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_estimateGas, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_gasPrice, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_getBalance, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_getBlockByHash, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_getBlockByNumber, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_getBlockTransactionCountByHash, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_getBlockTransactionCountByNumber, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_getCode, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_getFilterChanges, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_getFilterLogs, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_getLogs, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_getStorageAt, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_getTransactionByBlockHashAndIndex, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_getTransactionByBlockNumberAndIndex, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_getTransactionByHash, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_getTransactionCount, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_getTransactionReceipt, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_getUncleByBlockHashAndIndex, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_getUncleByBlockNumberAndIndex, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_getUncleCountByBlockHash, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_getUncleCountByBlockNumber, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_newBlockFilter, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_newFilter, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_protocolVersion, - proxied: true, - permissions: [], - }, - { - chain: StargazerChain.POLYGON, - method: AvailableMethods.eth_uninstallFilter, - proxied: true, - permissions: [], - }, -]; - -export type { AvailableChainMethod }; -export { AvailablePolygonChainMethods }; diff --git a/source/scripts/common/proxyUtils.ts b/source/scripts/common/proxyUtils.ts index c241dd316..0244e2693 100644 --- a/source/scripts/common/proxyUtils.ts +++ b/source/scripts/common/proxyUtils.ts @@ -3,7 +3,7 @@ import { AccountItem } from '../types'; import { AvailableEvents } from './availableEvents'; import { AvailableMethods } from './availableMethods'; import { RequestArguments } from './eipChainProvider'; -import { StargazerChain } from './chains'; +import { ProtocolProvider } from './chains'; type StargazerProxyEvent = { event: AvailableEvents; @@ -25,7 +25,7 @@ type StargazerProxyResponse = type StargazerProxyRequest = | { type: 'handshake'; - chain: StargazerChain; + chain: ProtocolProvider; title: string; } | { diff --git a/source/state/vault/index.ts b/source/state/vault/index.ts index fc4dead82..318dff601 100644 --- a/source/state/vault/index.ts +++ b/source/state/vault/index.ts @@ -36,7 +36,7 @@ const initialState: IVaultState = { 'BSC': BSC_NETWORK.bsc.id, 'Polygon': POLYGON_NETWORK.matic.id, }, - currentNetwork: DAG_NETWORK.main2.id, + currentEVMNetwork: ETH_NETWORK.mainnet.id, customNetworks: { constellation: {}, ethereum: {}, @@ -175,8 +175,8 @@ const VaultState = createSlice({ [action.payload.network]: action.payload.chainId, }; }, - changeCurrentNetwork(state: IVaultState, action: PayloadAction) { - state.currentNetwork = action.payload; + changeCurrentEVMNetwork(state: IVaultState, action: PayloadAction) { + state.currentEVMNetwork = action.payload; }, changeActiveAsset(state: IVaultState, action: PayloadAction) { state.activeAsset = { transactions: [], ...action.payload }; @@ -248,7 +248,7 @@ export const { changeActiveWallet, changeActiveNetwork, changeActiveAsset, - changeCurrentNetwork, + changeCurrentEVMNetwork, // updateAccount, updateWalletAssets, updateWalletLabel, diff --git a/source/state/vault/types.ts b/source/state/vault/types.ts index b42863bba..fc799024d 100644 --- a/source/state/vault/types.ts +++ b/source/state/vault/types.ts @@ -136,5 +136,5 @@ export default interface IVaultState { migrateWallet?: any; customNetworks: ICustomNetworks; customAssets: IAssetInfoState[]; - currentNetwork: string; + currentEVMNetwork: string; } diff --git a/source/web/manifest.json b/source/web/manifest.json index 2113d06b5..00b43c533 100644 --- a/source/web/manifest.json +++ b/source/web/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Stargazer Wallet", - "version": "3.13.2", + "version": "3.13.3", "icons": { "16": "assets/icons/favicon-16.png", "32": "assets/icons/favicon-32.png", diff --git a/source/web/package.json b/source/web/package.json index 9ec84cb2c..346ac89b7 100644 --- a/source/web/package.json +++ b/source/web/package.json @@ -1,6 +1,6 @@ { "name": "extension", - "version": "3.13.2", + "version": "3.13.3", "description": "Cross-chain compatible wallet for Constellation and Ethereum", "private": true, "repository": "https://github.com/StardustCollective/stargazer-wallet-ext.git",