forked from taikoxyz/taiko-mono
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(website): init testnet Eldfell L3 docs (taikoxyz#14179)
- Loading branch information
Showing
97 changed files
with
2,181 additions
and
3,409 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { ethereumRequest } from "../../utils/ethereumRequest"; | ||
|
||
interface AddTokenButtonProps { | ||
address: string; | ||
symbol: string; | ||
decimals: number; | ||
image: string; | ||
} | ||
|
||
const addTokenToWallet = async (token: AddTokenButtonProps) => { | ||
const options = { ...token, type: "ERC20" }; | ||
await ethereumRequest("wallet_watchAsset", options); | ||
}; | ||
|
||
export function AddTokenButton({ | ||
address, | ||
symbol, | ||
decimals, | ||
image, | ||
}: AddTokenButtonProps) { | ||
return ( | ||
<div | ||
onClick={() => addTokenToWallet({ address, symbol, decimals, image })} | ||
className="hover:cursor-pointer text-neutral-100 bg-[#E81899] hover:bg-[#d1168a] border-solid border-neutral-200 focus:ring-4 focus:outline-none focus:ring-neutral-100 font-medium rounded-lg text-sm px-3 py-2 text-center inline-flex items-center" | ||
> | ||
Add {symbol} to wallet | ||
</div> | ||
); | ||
} |
69 changes: 69 additions & 0 deletions
69
packages/website/components/Button/ConnectToMetamaskButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { | ||
SEPOLIA_CONFIG, | ||
GRIMSVOTN_CONFIG, | ||
ELDFELL_CONFIG, | ||
GRIMSVOTN_ADD_ETHEREUM_CHAIN, | ||
ELDFELL_ADD_ETHEREUM_CHAIN, | ||
} from "../../domain/chain"; | ||
import { ethereumRequest } from "../../utils/ethereumRequest"; | ||
|
||
type ConnectButtonProps = { | ||
network: | ||
| typeof SEPOLIA_CONFIG.names.shortName | ||
| typeof ELDFELL_CONFIG.names.shortName | ||
| typeof GRIMSVOTN_CONFIG.names.shortName; | ||
}; | ||
|
||
const chainMap = { | ||
Eldfell: ELDFELL_CONFIG.chainId.hex, // 167005 | ||
Grimsvotn: GRIMSVOTN_CONFIG.chainId.hex, // 167005 | ||
Sepolia: SEPOLIA_CONFIG.chainId.hex, // 11155111 | ||
}; | ||
|
||
async function ConnectToMetamask(network: ConnectButtonProps["network"]) { | ||
const { ethereum } = window as any; | ||
if (!ethereum) { | ||
alert("Metamask not detected! Install Metamask then try again."); | ||
return; | ||
} | ||
|
||
if (ethereum.chainId == chainMap[network]) { | ||
alert(`You are already connected to ${network}.`); | ||
return; | ||
} | ||
|
||
let params: any; | ||
if (network === SEPOLIA_CONFIG.names.shortName) { | ||
params = [{ chainId: chainMap[network] }]; | ||
} else { | ||
params = [ | ||
network === ELDFELL_CONFIG.names.shortName | ||
? ELDFELL_ADD_ETHEREUM_CHAIN | ||
: GRIMSVOTN_ADD_ETHEREUM_CHAIN, | ||
]; | ||
} | ||
try { | ||
await ethereumRequest( | ||
network === SEPOLIA_CONFIG.names.shortName | ||
? "wallet_switchEthereumChain" | ||
: "wallet_addEthereumChain", | ||
params | ||
); | ||
} catch (error) { | ||
alert( | ||
"Failed to add the network with wallet_addEthereumChain request. Add the network with https://chainlist.org/ or do it manually. Error log: " + | ||
error.message | ||
); | ||
} | ||
} | ||
|
||
export function ConnectToMetamaskButton(props: ConnectButtonProps) { | ||
return ( | ||
<div | ||
onClick={() => ConnectToMetamask(props.network)} | ||
className="hover:cursor-pointer text-neutral-100 bg-[#E81899] hover:bg-[#d1168a] border-solid border-neutral-200 focus:ring-4 focus:outline-none focus:ring-neutral-100 font-medium rounded-lg text-sm px-3 py-2 text-center inline-flex items-center" | ||
> | ||
Connect to {props.network} | ||
</div> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { | ||
TaikoL1Alpha3, | ||
TaikoL1Alpha4, | ||
TaikoL2Alpha3, | ||
TaikoL2Alpha4, | ||
BasedContracts, | ||
RollupContracts, | ||
OtherContracts, | ||
} from "../domain/chain/baseTypes"; | ||
import { contractAddressToLink } from "../utils/contractAddressToLink"; | ||
|
||
interface ContractAddressTableProps { | ||
networkConfig: TaikoL1Alpha3 | TaikoL1Alpha4 | TaikoL2Alpha3 | TaikoL2Alpha4; | ||
contracts: BasedContracts | RollupContracts | OtherContracts; | ||
} | ||
|
||
export function ContractAddressTable(props: ContractAddressTableProps) { | ||
const { networkConfig, contracts } = props; | ||
return ( | ||
<table> | ||
<thead> | ||
<tr> | ||
<th style={{ textAlign: "left" }}>Name</th> | ||
<th style={{ textAlign: "left" }}>Proxy</th> | ||
<th style={{ textAlign: "left" }}>Implementation</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{Object.keys(contracts).map((key) => { | ||
if (key === "erc20Contracts") return; | ||
const contract = contracts[key]; | ||
const baseUrl = networkConfig.blockExplorer.url; | ||
const proxyAddress = contract.address.proxy; | ||
const implementationAddress = contract.address.impl; | ||
return ( | ||
<tr key={contract.name}> | ||
<td>{contract.name}</td> | ||
<td> | ||
{proxyAddress ? ( | ||
<a href={contractAddressToLink(baseUrl, proxyAddress)}> | ||
{`${networkConfig.blockExplorer.name} ↗`} | ||
</a> | ||
) : ( | ||
"None" | ||
)} | ||
</td> | ||
<td> | ||
<a href={contractAddressToLink(baseUrl, implementationAddress)}> | ||
{`${networkConfig.blockExplorer.name} ↗`} | ||
</a> | ||
</td> | ||
</tr> | ||
); | ||
})} | ||
</tbody> | ||
</table> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/website/components/CommunitySection.tsx → ...site/components/Home/CommunitySection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/website/components/Hero.tsx → packages/website/components/Home/Hero.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export { BlogSection } from "./BlogSection"; | ||
export { CommunitySection } from "./CommunitySection"; | ||
export { FeaturesSection } from "./FeaturesSection"; | ||
export { Footer } from "./Footer"; | ||
export { Hero } from "./Hero"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,4 +75,4 @@ const ThemeToggle = () => { | |
); | ||
}; | ||
|
||
export default ThemeToggle; | ||
export { ThemeToggle }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,4 @@ function ThemedImage() { | |
) : null; | ||
} | ||
|
||
export default ThemedImage; | ||
export { ThemedImage }; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.