Skip to content

Commit

Permalink
Add network config for docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-Electron committed Apr 23, 2024
1 parent c5b1a48 commit 2b6c0d9
Show file tree
Hide file tree
Showing 11 changed files with 163 additions and 266 deletions.
21 changes: 11 additions & 10 deletions docs/build/getting-started/networks-endpoints.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ tags:
- Endpoints
---

import { AddToMetaMaskButton, EVMNetworks } from '@theme/AddToMetaMaskButton';
import { AddToMetaMaskButton } from '@theme/AddToMetaMaskButton';
import { Networks } from '@theme/constant';
import NetworkInfo from '@theme/NetworkInfo';
import { ChainId } from '@theme/ChainId';

Expand All @@ -37,26 +38,26 @@ This network runs under a [Coordinator PoA scheme](/learn/protocols/coordinator/

:::

<NetworkInfo.IOTA />
<NetworkInfo.L1 {...Networks['iota']}/>

## Shimmer

[Shimmer](https://explorer.iota.org/shimmer) is the staging network for new protocol versions before they hit IOTA
Mainnet.

<NetworkInfo.Shimmer />
<NetworkInfo.L1 {...Networks['shimmer']} />

### ShimmerEVM

[ShimmerEVM](https://explorer.evm.shimmer.network/) is the L2 EVM running on top of the Shimmer network.

<AddToMetaMaskButton cfg={EVMNetworks['shimmerevm']} />
<AddToMetaMaskButton cfg={Networks['shimmer'].evm} />

<NetworkInfo.ShimmerEVM />
<NetworkInfo.Evm {...Networks['shimmer']} />

#### Additional Info

<NetworkInfo.ShimmerEVMAdditional />
<NetworkInfo.EvmCustom {...Networks['shimmer']} />

## Public Testnet

Expand All @@ -66,11 +67,11 @@ Mainnet.
This network is subject to occasional resets (no data retention) which are usually announced with a one-week grace period.
:::

<NetworkInfo.Testnet />
<NetworkInfo.L1 {...Networks['testnet']} />

### ShimmerEVM Testnet

<AddToMetaMaskButton cfg={EVMNetworks['shimmerevm-testnet']} />
<AddToMetaMaskButton cfg={Networks['testnet'].evm} />

[The ShimmerEVM Testnet](https://explorer.evm.testnet.shimmer.network/) runs as a layer 2 on top
of the Public Testnet. This network uses ISC to facilitate an Ethereum Virtual Machine and has an
Expand All @@ -82,8 +83,8 @@ This network is subject to occasional resets (no data retention) which are usual

:::

<NetworkInfo.TestnetEVM />
<NetworkInfo.Evm {...Networks['testnet']} />

#### Additional Info

<NetworkInfo.TestnetEVMAdditional />
<NetworkInfo.EvmCustom {...Networks['testnet']} />
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tags:
- reference
- Endpoints
---
import { AddToMetaMaskButton, EVMNetworks } from '@theme/AddToMetaMaskButton';
import { AddToMetaMaskButton, Networks } from '@theme/AddToMetaMaskButton';
import NetworkInfo from '@theme/NetworkInfo';

# Networks & Chains
Expand All @@ -17,16 +17,16 @@ import NetworkInfo from '@theme/NetworkInfo';

[ShimmerEVM](https://explorer.evm.shimmer.network/) is the L2 EVM running on top of the Shimmer network.

<AddToMetaMaskButton cfg={EVMNetworks['shimmerevm']} />
<AddToMetaMaskButton cfg={Networks['shimmer'].evm} />

<NetworkInfo.ShimmerEVM />
<NetworkInfo.Evm {...Networks['shimmer']} />

## ShimmerEVM Testnet

<AddToMetaMaskButton cfg={EVMNetworks['shimmerevm-testnet']} />
<AddToMetaMaskButton cfg={Networks['testnet'].evm} />

[The ShimmerEVM Testnet](https://explorer.evm.testnet.shimmer.network/) runs as a layer 2 on top
of the [Public Testnet](/build/networks-endpoints/#public-testnet). This network uses ISC to facilitate
of the [Public Testnet](/build/networks-endpoints#public-testnet). This network uses ISC to facilitate
an Ethereum Virtual Machine and has an enshrined bridge to layer 1.

:::info
Expand All @@ -35,7 +35,7 @@ This network is subject to occasional resets (no data retention) which are usual

:::

<NetworkInfo.TestnetEVM />
<NetworkInfo.Evm {...Networks['shimmer']} />

:::note

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ tags:
- RPC
---

import { AddToMetaMaskButton, EVMNetworks } from '@theme/AddToMetaMaskButton';
import { AddToMetaMaskButton, Networks } from '@theme/AddToMetaMaskButton';

# ShimmerEVM Testnet Quickstart Guide

Expand All @@ -27,7 +27,7 @@ This guide will help you quickly get started with the [ShimmerEVM Testnet](/buil

Click this button:

<AddToMetaMaskButton cfg={EVMNetworks['shimmerevm-testnet']} />
<AddToMetaMaskButton cfg={Networks['testnet']} />

:::tip

Expand Down
6 changes: 3 additions & 3 deletions docs/build/isc/v1.0.0-rc.6/docs/getting-started/tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ tags:
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import {AddToMetaMaskButton, EVMNetworks} from '@theme/AddToMetaMaskButton';
import {AddToMetaMaskButton, Networks} from '@theme/AddToMetaMaskButton';
import DeployAdmonition from '../_admonitions/_deploy_a_smart_contract.md';
import { ChainId } from '@theme/ChainId';
import NetworkInfo from '@theme/NetworkInfo';
Expand Down Expand Up @@ -56,11 +56,11 @@ the [ShimmerEVM Testnet](/build/networks-endpoints/#shimmerevm-testnet):

<Tabs>
<TabItem value='testnet' label='Public Testnet'>
<AddToMetaMaskButton cfg={EVMNetworks['shimmerevm-testnet']}/>
<AddToMetaMaskButton cfg={Networks['testnet'].evm}/>
<NetworkInfo.TestnetEVM />
</TabItem>
<TabItem value='shimmerEVM' label='ShimmerEVM'>
<AddToMetaMaskButton cfg={EVMNetworks['shimmerevm']}/>
<AddToMetaMaskButton cfg={Networks['shimmer'].evm}/>
<NetworkInfo.ShimmerEVM />
</TabItem>
</Tabs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description: 'Learn how to deploy smart contracts to Shimmer EVM and Shimmer EVM
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import {AddToMetaMaskButton, EVMNetworks} from '@theme/AddToMetaMaskButton';
import {AddToMetaMaskButton, Networks} from '@theme/AddToMetaMaskButton';

# Deploy a Smart Contract

Expand Down Expand Up @@ -44,10 +44,10 @@ You can check the connection details in the [Networks & Endpoints section](/buil

<Tabs>
<TabItem value='testnet' label='ShimmerEVM Testnet'>
<AddToMetaMaskButton cfg={EVMNetworks['shimmerevm-testnet']}/>
<AddToMetaMaskButton cfg={Networks['testnet'].evm}/>
</TabItem>
<TabItem value='shimmerEVM' label='Shimmer EVM'>
<AddToMetaMaskButton cfg={EVMNetworks['shimmerevm']}/>
<AddToMetaMaskButton cfg={Networks['shimmer'].evm}/>
</TabItem>
</Tabs>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ tags:
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import {AddToMetaMaskButton, EVMNetworks} from '@theme/AddToMetaMaskButton';
import {AddToMetaMaskButton, Networks} from '@theme/AddToMetaMaskButton';

# Send Funds From L1 to L2

Expand Down Expand Up @@ -49,10 +49,10 @@ You can use your [Firefly Wallet](https://firefly.iota.org/) to easily send L1 S

<Tabs>
<TabItem value='testnet' label='ShimmerEVM Testnet'>
<AddToMetaMaskButton cfg={EVMNetworks['shimmerevm-testnet']}/>
<AddToMetaMaskButton cfg={Networks['testnet'].evm}/>
</TabItem>
<TabItem value='shimmerEVM' label='ShimmerEVM'>
<AddToMetaMaskButton cfg={EVMNetworks['shimmerevm']}/>
<AddToMetaMaskButton cfg={Networks['shimmer'].evm}/>
</TabItem>
</Tabs>

Expand Down
34 changes: 3 additions & 31 deletions theme/src/theme/AddToMetaMaskButton/index.tsx
Original file line number Diff line number Diff line change
@@ -1,42 +1,14 @@
import React from 'react';
import type { MetaMaskInpageProvider } from '@metamask/providers';
import { NetworkProps } from '../constant';

declare global {
interface Window {
ethereum?: MetaMaskInpageProvider;
}
}

export const EVMNetworks = {
'shimmerevm-testnet': {
chainId: '0x431',
chainName: 'ShimmerEVM Testnet',
nativeCurrency: {
name: 'Shimmer',
symbol: 'SMR',
decimals: 18, // Replace with the number of decimals of the native currency
},
rpcUrls: ['https://json-rpc.evm.testnet.shimmer.network'],
blockExplorerUrls: ['https://explorer.evm.testnet.shimmer.network/'],
},
shimmerevm: {
chainId: '0x94',
chainName: 'ShimmerEVM',
nativeCurrency: {
name: 'Shimmer',
symbol: 'SMR',
decimals: 18, // Replace with the number of decimals of the native currency
},
rpcUrls: ['https://json-rpc.evm.shimmer.network'],
blockExplorerUrls: ['https://explorer.evm.shimmer.network/'],
},
};

interface MetaMaskButtonProps {
cfg: unknown;
}

export function AddToMetaMaskButton(props: MetaMaskButtonProps) {
export function AddToMetaMaskButton(props: NetworkProps) {
async function addNetwork() {
if (!window.ethereum) {
alert(
Expand All @@ -48,7 +20,7 @@ export function AddToMetaMaskButton(props: MetaMaskButtonProps) {
try {
await window.ethereum.request({
method: 'wallet_addEthereumChain',
params: [props.cfg],
params: [props.evm],
});
} catch (error) {
console.error(error);
Expand Down
Loading

0 comments on commit 2b6c0d9

Please sign in to comment.