diff --git a/docs/build/isc/v1.1/docs/_partials/_hardhat_config.md b/docs/build/isc/v1.1/docs/_partials/_hardhat_config.md index 96b134330bb..d40752cc44b 100644 --- a/docs/build/isc/v1.1/docs/_partials/_hardhat_config.md +++ b/docs/build/isc/v1.1/docs/_partials/_hardhat_config.md @@ -10,8 +10,8 @@ import TabItem from '@theme/TabItem'; {` networks: { 'iotaevm-testnet': { - url: '${Networks['iota_testnet'].evm.rpcUrls[0]}', - chainId: ${parseInt(Networks['iota_testnet'].evm.chainId)}, + url: '${Networks['iota_testnet'].evm.core.rpcUrls[0]}', + chainId: ${parseInt(Networks['iota_testnet'].evm.core.chainId)}, accounts: [YOUR PRIVATE KEY], }, } @@ -25,8 +25,8 @@ networks: { {` networks: { 'shimmerevm-testnet': { - url: '${Networks['shimmer_testnet'].evm.rpcUrls[0]}', - chainId: ${parseInt(Networks['shimmer_testnet'].evm.chainId)}, + url: '${Networks['shimmer_testnet'].evm.core.rpcUrls[0]}', + chainId: ${parseInt(Networks['shimmer_testnet'].evm.core.chainId)}, accounts: [YOUR PRIVATE KEY], }, } @@ -40,8 +40,8 @@ networks: { {` networks: { 'iotaevm': { - url: '${Networks['iota'].evm.rpcUrls[0]}', - chainId: ${parseInt(Networks['iota'].evm.chainId)}, + url: '${Networks['iota'].evm.core.rpcUrls[0]}', + chainId: ${parseInt(Networks['iota'].evm.core.chainId)}, accounts: [YOUR PRIVATE KEY], }, } @@ -55,8 +55,8 @@ networks: { {` networks: { 'shimmerevm': { - url: '${Networks['shimmer'].evm.rpcUrls[0]}', - chainId: ${parseInt(Networks['shimmer'].evm.chainId)}, + url: '${Networks['shimmer'].evm.core.rpcUrls[0]}', + chainId: ${parseInt(Networks['shimmer'].evm.core.chainId)}, accounts: [YOUR PRIVATE KEY], }, } diff --git a/docs/build/isc/v1.1/docs/getting-started/quick-start.mdx b/docs/build/isc/v1.1/docs/getting-started/quick-start.mdx index 65b242366db..01601ba1d50 100644 --- a/docs/build/isc/v1.1/docs/getting-started/quick-start.mdx +++ b/docs/build/isc/v1.1/docs/getting-started/quick-start.mdx @@ -62,16 +62,16 @@ Visit the corresponding Block Explorer to monitor the chain, track transactions, <Tabs groupId='network' queryString> <TabItem value='iota' label='IOTA EVM'> -<Link to={Networks['iota'].evm.blockExplorerUrls[0]}>Explorer</Link> +<Link to={Networks['iota'].evm.core.blockExplorerUrls[0]}>Explorer</Link> </TabItem> <TabItem value='iota_testnet' label='IOTA EVM Testnet'> -<Link to={Networks['iota_testnet'].evm.blockExplorerUrls[0]}>Explorer</Link> +<Link to={Networks['iota_testnet'].evm.core.blockExplorerUrls[0]}>Explorer</Link> </TabItem> <TabItem value='shimmer' label='ShimmerEVM'> -<Link to={Networks['shimmer'].evm.blockExplorerUrls[0]}>Explorer</Link> +<Link to={Networks['shimmer'].evm.core.blockExplorerUrls[0]}>Explorer</Link> </TabItem> <TabItem value='shimmer_testnet' label='ShimmerEVM Testnet'> -<Link to={Networks['shimmer_testnet'].evm.blockExplorerUrls[0]}>Explorer</Link> +<Link to={Networks['shimmer_testnet'].evm.core.blockExplorerUrls[0]}>Explorer</Link> </TabItem> </Tabs> diff --git a/docs/build/isc/v1.3-alpha/docs/_partials/_hardhat_config.md b/docs/build/isc/v1.3-alpha/docs/_partials/_hardhat_config.md index 96b134330bb..d40752cc44b 100644 --- a/docs/build/isc/v1.3-alpha/docs/_partials/_hardhat_config.md +++ b/docs/build/isc/v1.3-alpha/docs/_partials/_hardhat_config.md @@ -10,8 +10,8 @@ import TabItem from '@theme/TabItem'; {` networks: { 'iotaevm-testnet': { - url: '${Networks['iota_testnet'].evm.rpcUrls[0]}', - chainId: ${parseInt(Networks['iota_testnet'].evm.chainId)}, + url: '${Networks['iota_testnet'].evm.core.rpcUrls[0]}', + chainId: ${parseInt(Networks['iota_testnet'].evm.core.chainId)}, accounts: [YOUR PRIVATE KEY], }, } @@ -25,8 +25,8 @@ networks: { {` networks: { 'shimmerevm-testnet': { - url: '${Networks['shimmer_testnet'].evm.rpcUrls[0]}', - chainId: ${parseInt(Networks['shimmer_testnet'].evm.chainId)}, + url: '${Networks['shimmer_testnet'].evm.core.rpcUrls[0]}', + chainId: ${parseInt(Networks['shimmer_testnet'].evm.core.chainId)}, accounts: [YOUR PRIVATE KEY], }, } @@ -40,8 +40,8 @@ networks: { {` networks: { 'iotaevm': { - url: '${Networks['iota'].evm.rpcUrls[0]}', - chainId: ${parseInt(Networks['iota'].evm.chainId)}, + url: '${Networks['iota'].evm.core.rpcUrls[0]}', + chainId: ${parseInt(Networks['iota'].evm.core.chainId)}, accounts: [YOUR PRIVATE KEY], }, } @@ -55,8 +55,8 @@ networks: { {` networks: { 'shimmerevm': { - url: '${Networks['shimmer'].evm.rpcUrls[0]}', - chainId: ${parseInt(Networks['shimmer'].evm.chainId)}, + url: '${Networks['shimmer'].evm.core.rpcUrls[0]}', + chainId: ${parseInt(Networks['shimmer'].evm.core.chainId)}, accounts: [YOUR PRIVATE KEY], }, } diff --git a/docs/build/isc/v1.3-alpha/docs/getting-started/quick-start.mdx b/docs/build/isc/v1.3-alpha/docs/getting-started/quick-start.mdx index 65b242366db..01601ba1d50 100644 --- a/docs/build/isc/v1.3-alpha/docs/getting-started/quick-start.mdx +++ b/docs/build/isc/v1.3-alpha/docs/getting-started/quick-start.mdx @@ -62,16 +62,16 @@ Visit the corresponding Block Explorer to monitor the chain, track transactions, <Tabs groupId='network' queryString> <TabItem value='iota' label='IOTA EVM'> -<Link to={Networks['iota'].evm.blockExplorerUrls[0]}>Explorer</Link> +<Link to={Networks['iota'].evm.core.blockExplorerUrls[0]}>Explorer</Link> </TabItem> <TabItem value='iota_testnet' label='IOTA EVM Testnet'> -<Link to={Networks['iota_testnet'].evm.blockExplorerUrls[0]}>Explorer</Link> +<Link to={Networks['iota_testnet'].evm.core.blockExplorerUrls[0]}>Explorer</Link> </TabItem> <TabItem value='shimmer' label='ShimmerEVM'> -<Link to={Networks['shimmer'].evm.blockExplorerUrls[0]}>Explorer</Link> +<Link to={Networks['shimmer'].evm.core.blockExplorerUrls[0]}>Explorer</Link> </TabItem> <TabItem value='shimmer_testnet' label='ShimmerEVM Testnet'> -<Link to={Networks['shimmer_testnet'].evm.blockExplorerUrls[0]}>Explorer</Link> +<Link to={Networks['shimmer_testnet'].evm.core.blockExplorerUrls[0]}>Explorer</Link> </TabItem> </Tabs> diff --git a/src/theme/AddToMetaMaskButton/index.tsx b/src/theme/AddToMetaMaskButton/index.tsx index dc10cf4cc43..553b2aafb27 100644 --- a/src/theme/AddToMetaMaskButton/index.tsx +++ b/src/theme/AddToMetaMaskButton/index.tsx @@ -20,7 +20,7 @@ export function AddToMetaMaskButton(props: NetworkProps) { try { await window.ethereum.request({ method: 'wallet_addEthereumChain', - params: [props.evm], + params: [props.evm.core], }); } catch (error) { console.error(error); diff --git a/src/theme/NetworkInfo/index.tsx b/src/theme/NetworkInfo/index.tsx index 3cf243df9f0..145bff9b6fc 100644 --- a/src/theme/NetworkInfo/index.tsx +++ b/src/theme/NetworkInfo/index.tsx @@ -64,18 +64,18 @@ function Evm(props: NetworkProps) { <tr> <th>Chain ID</th> <td> - <ChainId url={props.evm.rpcUrls[0]} /> + <ChainId url={props.evm.core.rpcUrls[0]} /> </td> </tr> <tr> <th>RPC URL</th> <td> - {props.evm.rpcUrls.map((url, index) => ( + {props.evm.core.rpcUrls.map((url, index) => ( <CodeBlock key={index}>{url}</CodeBlock> ))} </td> </tr> - {props.evmCustom.blastApiUrls && ( + {props.evm.tools && props.evm.tools.blastApiUrls && ( <tr> <th> <Admonition type='tip' title='Blast API URLs'> @@ -84,7 +84,7 @@ function Evm(props: NetworkProps) { </Admonition> </th> <td> - {props.evmCustom.blastApiUrls.map((object, index) => + {props.evm.tools.blastApiUrls.map((object, index) => typeof object === 'string' ? ( <CodeBlock key={index}> {object as string} </CodeBlock> ) : ( @@ -101,32 +101,34 @@ function Evm(props: NetworkProps) { <th>Explorer</th> <td> <a - href={props.evm.blockExplorerUrls[0]} + href={props.evm.core.blockExplorerUrls[0]} target='_blank' rel='noopener noreferrer' > - {props.evm.blockExplorerUrls[0]} + {props.evm.core.blockExplorerUrls[0]} </a> </td> </tr> <tr> <th> - {props.evmCustom.toolkit.hasFaucet ? 'Toolkit & Faucet' : 'Toolkit'} + {props.evm.custom.toolkit.hasFaucet + ? 'Toolkit & Faucet' + : 'Toolkit'} </th> <td> <a - href={props.evmCustom.toolkit.url} + href={props.evm.custom.toolkit.url} target='_blank' rel='noopener noreferrer' > - {props.evmCustom.toolkit.url} + {props.evm.custom.toolkit.url} </a> </td> </tr> <tr> <th>WASP API</th> <td> - <CodeBlock> {props.evmCustom.api} </CodeBlock> + <CodeBlock> {props.evm.custom.api} </CodeBlock> </td> </tr> </tbody> @@ -142,17 +144,17 @@ function EvmCustom(props: NetworkProps) { <th>Chain Address</th> <td> <a - href={props.explorer + '/addr/' + props.evmCustom.chainAddress} + href={props.explorer + '/addr/' + props.evm.custom.chainAddress} target='_blank' rel='noopener noreferrer' > - {props.evmCustom.chainAddress} + {props.evm.custom.chainAddress} </a> </td> </tr> <tr> <th>Alias ID</th> - <td>{props.evmCustom.aliasId}</td> + <td>{props.evm.custom.aliasId}</td> </tr> </tbody> </table> diff --git a/src/theme/constant.tsx b/src/theme/constant.tsx index 78099fb9e73..bbf07ff3c08 100644 --- a/src/theme/constant.tsx +++ b/src/theme/constant.tsx @@ -1,4 +1,4 @@ -export const Networks = { +export const Networks: { [key: string]: NetworkProps } = { iota: { baseToken: 'IOTA Token', protocol: 'Stardust', @@ -7,37 +7,41 @@ export const Networks = { permaNodeApi: 'https://chronicle.stardust-mainnet.iotaledger.net', explorer: 'https://explorer.iota.org/mainnet', evm: { - chainId: '0x2276', - chainName: 'IOTA EVM', - nativeCurrency: { - name: 'IOTA', - symbol: 'IOTA', - decimals: 18, + core: { + chainId: '0x2276', + chainName: 'IOTA EVM', + nativeCurrency: { + name: 'IOTA', + symbol: 'IOTA', + decimals: 18, + }, + rpcUrls: [ + 'https://json-rpc.evm.iotaledger.net', + 'wss://ws.json-rpc.evm.iotaledger.net', + ], + blockExplorerUrls: ['https://explorer.evm.iota.org'], }, - rpcUrls: [ - 'https://json-rpc.evm.iotaledger.net', - 'wss://ws.json-rpc.evm.iotaledger.net', - ], - blockExplorerUrls: ['https://explorer.evm.iota.org'], - }, - evmCustom: { - chainAddress: - 'iota1pzt3mstq6khgc3tl0mwuzk3eqddkryqnpdxmk4nr25re2466uxwm28qqxu5', - aliasId: - '0x971dc160d5ae8c457f7eddc15a39035b6190130b4dbb5663550795575ae19db5', - blastApiUrls: [ - 'https://iota-mainnet-evm.public.blastapi.io', - 'wss://iota-mainnet-evm.public.blastapi.io', - { - 'Archive RPC': - 'https://iota-mainnet-evm.blastapi.io/e7596858-fc63-4a54-8727-b885a2af4ec8', + tools: { + blastApiUrls: [ + 'https://iota-mainnet-evm.public.blastapi.io', + 'wss://iota-mainnet-evm.public.blastapi.io', + { + 'Archive RPC': + 'https://iota-mainnet-evm.blastapi.io/e7596858-fc63-4a54-8727-b885a2af4ec8', + }, + ], + }, + custom: { + chainAddress: + 'iota1pzt3mstq6khgc3tl0mwuzk3eqddkryqnpdxmk4nr25re2466uxwm28qqxu5', + aliasId: + '0x971dc160d5ae8c457f7eddc15a39035b6190130b4dbb5663550795575ae19db5', + toolkit: { + url: 'https://evm-toolkit.evm.iotaledger.net', + hasFaucet: false, }, - ], - toolkit: { - url: 'https://evm-toolkit.evm.iotaledger.net', - hasFaucet: false, + api: 'https://api.evm.iotaledger.net', }, - api: 'https://api.evm.iotaledger.net', }, }, iota_2_testnet: { @@ -58,37 +62,41 @@ export const Networks = { faucet: 'https://faucet.testnet.iotaledger.net', explorer: 'https://explorer.iota.org/iota-testnet', evm: { - chainId: '0x433', - chainName: 'IOTA EVM Testnet', - nativeCurrency: { - name: 'IOTA', - symbol: 'IOTA', - decimals: 18, + core: { + chainId: '0x433', + chainName: 'IOTA EVM Testnet', + nativeCurrency: { + name: 'IOTA', + symbol: 'IOTA', + decimals: 18, + }, + rpcUrls: [ + 'https://json-rpc.evm.testnet.iotaledger.net', + 'wss://ws.json-rpc.evm.testnet.iotaledger.net', + ], + blockExplorerUrls: ['https://explorer.evm.testnet.iotaledger.net'], }, - rpcUrls: [ - 'https://json-rpc.evm.testnet.iotaledger.net', - 'wss://ws.json-rpc.evm.testnet.iotaledger.net', - ], - blockExplorerUrls: ['https://explorer.evm.testnet.iotaledger.net'], - }, - evmCustom: { - chainAddress: - 'tst1pzxsrr7apqkdzz633dyntmvxwtyvk029p39te5j0m33q6946h7akzv663zu', - aliasId: - '0x8d018fdd082cd10b518b4935ed8672c8cb3d450c4abcd24fdc620d16babfbb61', - blastApiUrls: [ - 'https://iota-testnet-evm.public.blastapi.io', - 'wss://iota-testnet-evm.public.blastapi.io', - { - 'Archive RPC': - 'https://iota-testnet-evm.blastapi.io/e7596858-fc63-4a54-8727-b885a2af4ec8', + tools: { + blastApiUrls: [ + 'https://iota-testnet-evm.public.blastapi.io', + 'wss://iota-testnet-evm.public.blastapi.io', + { + 'Archive RPC': + 'https://iota-testnet-evm.blastapi.io/e7596858-fc63-4a54-8727-b885a2af4ec8', + }, + ], + }, + custom: { + chainAddress: + 'tst1pzxsrr7apqkdzz633dyntmvxwtyvk029p39te5j0m33q6946h7akzv663zu', + aliasId: + '0x8d018fdd082cd10b518b4935ed8672c8cb3d450c4abcd24fdc620d16babfbb61', + toolkit: { + url: 'https://evm-toolkit.evm.testnet.iotaledger.net', + hasFaucet: true, }, - ], - toolkit: { - url: 'https://evm-toolkit.evm.testnet.iotaledger.net', - hasFaucet: false, + api: 'https://api.evm.testnet.iotaledger.net', }, - api: 'https://api.evm.testnet.iotaledger.net', }, }, shimmer: { @@ -99,29 +107,31 @@ export const Networks = { permaNodeApi: 'https://chronicle.shimmer.network', explorer: 'https://explorer.shimmer.network/shimmer', evm: { - chainId: '0x94', - chainName: 'ShimmerEVM', - nativeCurrency: { - name: 'Shimmer', - symbol: 'SMR', - decimals: 18, + core: { + chainId: '0x94', + chainName: 'ShimmerEVM', + nativeCurrency: { + name: 'Shimmer', + symbol: 'SMR', + decimals: 18, + }, + rpcUrls: [ + 'https://json-rpc.evm.shimmer.network', + 'wss://ws.json-rpc.evm.shimmer.network', + ], + blockExplorerUrls: ['https://explorer.evm.shimmer.network/'], }, - rpcUrls: [ - 'https://json-rpc.evm.shimmer.network', - 'wss://ws.json-rpc.evm.shimmer.network', - ], - blockExplorerUrls: ['https://explorer.evm.shimmer.network/'], - }, - evmCustom: { - chainAddress: - 'smr1prxvwqvwf7nru5q5xvh5thwg54zsm2y4wfnk6yk56hj3exxkg92mx20wl3s', - aliasId: - '0xccc7018e4fa63e5014332f45ddc8a5450da89572676d12d4d5e51c98d64155b3', - toolkit: { - url: 'https://evm-toolkit.evm.shimmer.network', - hasFaucet: false, + custom: { + chainAddress: + 'smr1prxvwqvwf7nru5q5xvh5thwg54zsm2y4wfnk6yk56hj3exxkg92mx20wl3s', + aliasId: + '0xccc7018e4fa63e5014332f45ddc8a5450da89572676d12d4d5e51c98d64155b3', + toolkit: { + url: 'https://evm-toolkit.evm.shimmer.network', + hasFaucet: false, + }, + api: 'https://api.evm.shimmer.network', }, - api: 'https://api.evm.shimmer.network', }, }, shimmer_testnet: { @@ -133,26 +143,28 @@ export const Networks = { faucet: 'https://faucet.testnet.shimmer.network', explorer: 'https://explorer.shimmer.network/shimmer-testnet', evm: { - chainId: '0x431', - chainName: 'ShimmerEVM Testnet', - nativeCurrency: { - name: 'Shimmer', - symbol: 'SMR', - decimals: 18, + core: { + chainId: '0x431', + chainName: 'ShimmerEVM Testnet', + nativeCurrency: { + name: 'Shimmer', + symbol: 'SMR', + decimals: 18, + }, + rpcUrls: ['https://json-rpc.evm.testnet.shimmer.network'], + blockExplorerUrls: ['https://explorer.evm.testnet.shimmer.network/'], }, - rpcUrls: ['https://json-rpc.evm.testnet.shimmer.network'], - blockExplorerUrls: ['https://explorer.evm.testnet.shimmer.network/'], - }, - evmCustom: { - chainAddress: - 'rms1ppp00k5mmd2m8my8ukkp58nd3rskw6rx8l09aj35984k74uuc5u2cywn3ex', - aliasId: - '0x42f7da9bdb55b3ec87e5ac1a1e6d88e16768663fde5eca3429eb6f579cc538ac', - toolkit: { - url: 'https://evm-toolkit.evm.testnet.shimmer.network', - hasFaucet: true, + custom: { + chainAddress: + 'rms1ppp00k5mmd2m8my8ukkp58nd3rskw6rx8l09aj35984k74uuc5u2cywn3ex', + aliasId: + '0x42f7da9bdb55b3ec87e5ac1a1e6d88e16768663fde5eca3429eb6f579cc538ac', + toolkit: { + url: 'https://evm-toolkit.evm.testnet.shimmer.network', + hasFaucet: true, + }, + api: 'https://api.evm.testnet.shimmer.network', }, - api: 'https://api.evm.testnet.shimmer.network', }, }, }; @@ -162,6 +174,8 @@ export interface Toolkit { hasFaucet: boolean; } +// This is just a copy of https://github.com/MetaMask/metamask-sdk/blob/890ec432439705af4c8d02281b7447a1a4f94de3/packages/sdk-react-ui/src/hooks/MetaMaskWagmiHooks.ts#L25-L36 +// and should not be touched export interface AddEthereumChainParameter { chainId: string; // A 0x-prefixed hexadecimal string chainName: string; @@ -175,6 +189,19 @@ export interface AddEthereumChainParameter { iconUrls?: string[]; // Currently ignored. } +export interface EVMProps { + core: AddEthereumChainParameter; + tools?: { + blastApiUrls?: Array<string | object>; + }; + custom: { + chainAddress: string; + aliasId: string; + api: string; + toolkit: Toolkit; + }; +} + export interface NetworkProps { baseToken: string; protocol: string; @@ -183,12 +210,5 @@ export interface NetworkProps { permaNodeApi: string; faucet?: string; explorer: string; - evm: AddEthereumChainParameter; - evmCustom: { - chainAddress: string; - aliasId: string; - blastApiUrls?: Array<string | object>; - toolkit?: Toolkit; - api?: string; - }; + evm?: EVMProps; }