Skip to content

Commit

Permalink
Update example site
Browse files Browse the repository at this point in the history
  • Loading branch information
zencephalon committed Feb 20, 2024
1 parent 1e1c5ae commit 6d567ef
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 35 deletions.
10 changes: 5 additions & 5 deletions example/app/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { createConfig, http, WagmiProvider } from 'wagmi'
import { baseGoerli, goerli, optimismGoerli } from 'wagmi/chains'
import { base, mainnet, optimism } from 'wagmi/chains'

const queryClient = new QueryClient()

const config = createConfig({
chains: [goerli, baseGoerli, optimismGoerli],
chains: [base, mainnet, optimism],
transports: {
[goerli.id]: http(),
[baseGoerli.id]: http(),
[optimismGoerli.id]: http(),
[base.id]: http(),
[mainnet.id]: http(),
[optimism.id]: http(),
},
})

Expand Down
6 changes: 1 addition & 5 deletions example/components/DepositContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { networkToChainId } from '@/constants/networkToChainId'
import { useState } from 'react'
import { AssetTypeToggle } from './AssetTypeToggle'
import { DepositERC20 } from './DepositERC20'
import { DepositETH } from './DepositETH'
import { NetworkSelector } from './NetworkSelector'

const networkToChainId: Record<'optimism' | 'base', number> = {
base: 84531,
optimism: 420,
}

export function DepositContainer() {
const [selectedAssetType, setSelectedAssetType] = useState<'eth' | 'erc20'>('eth')
const [selectedNetwork, setSelectedNetwork] = useState<'optimism' | 'base'>('base')
Expand Down
6 changes: 1 addition & 5 deletions example/components/FinalizeContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { networkToChainId } from '@/constants/networkToChainId'
import { useState } from 'react'
import { FinalizeWithdrawalTransaction } from './FinalizeWithdrawalTransaction'
import { NetworkSelector } from './NetworkSelector'

const networkToChainId: Record<'optimism' | 'base', number> = {
base: 84531,
optimism: 420,
}

export function FinalizeContainer() {
const [selectedNetwork, setSelectedNetwork] = useState<'optimism' | 'base'>('base')
return (
Expand Down
6 changes: 1 addition & 5 deletions example/components/ProveContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { networkToChainId } from '@/constants/networkToChainId'
import { useState } from 'react'
import { NetworkSelector } from './NetworkSelector'
import { ProveWithdrawalTransaction } from './ProveWithdrawalTransaction'

const networkToChainId: Record<'optimism' | 'base', number> = {
base: 84531,
optimism: 420,
}

export function ProveContainer() {
const [selectedNetwork, setSelectedNetwork] = useState<'optimism' | 'base'>('base')
return (
Expand Down
6 changes: 1 addition & 5 deletions example/components/WithdrawContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { networkToChainId } from '@/constants/networkToChainId'
import { useState } from 'react'
import { AssetTypeToggle } from './AssetTypeToggle'
import { NetworkSelector } from './NetworkSelector'
import { WithdrawERC20 } from './WithdrawERC20'
import { WithdrawETH } from './WithdrawETH'

const networkToChainId: Record<'optimism' | 'base', number> = {
base: 84531,
optimism: 420,
}

export function WithdrawContainer() {
const [selectedAssetType, setSelectedAssetType] = useState<'eth' | 'erc20'>('eth')
const [selectedNetwork, setSelectedNetwork] = useState<'optimism' | 'base'>('base')
Expand Down
6 changes: 1 addition & 5 deletions example/components/WithdrawERC20.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { chainIdToExplorer } from '@/constants/chainIdToExplorer'
import { useSimulateWithdrawERC20, useWriteWithdrawERC20 } from 'op-wagmi'
import { useState } from 'react'
import { Address, erc20Abi, isAddress, parseUnits } from 'viem'
Expand All @@ -8,11 +9,6 @@ import { InputGroup } from './InputGroup'

const cbETHL2 = '0x7c6b91D9Be155A6Db01f749217d76fF02A7227F2'

const chainIdToExplorer: Record<number, string> = {
84531: 'https://goerli.basescan.org',
420: 'https://goerli-optimism.etherscan.io',
}

type WithdrawERC20Props = {
selectedChainId: number
}
Expand Down
6 changes: 1 addition & 5 deletions example/components/WithdrawETH.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import { chainIdToExplorer } from '@/constants/chainIdToExplorer'
import { useSimulateWithdrawETH, useWriteWithdrawETH } from 'op-wagmi'
import { useState } from 'react'
import { Address, parseEther } from 'viem'
import { Action, ActionToggle } from './ActionToggle'
import { Button } from './Button'
import { InputGroup } from './InputGroup'

const chainIdToExplorer: Record<number, string> = {
84531: 'https://goerli.basescan.org',
420: 'https://goerli-optimism.etherscan.io',
}

type WithdrawETHProps = {
selectedChainId: number
}
Expand Down
6 changes: 6 additions & 0 deletions example/constants/chainIdToExplorer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { base, optimism } from 'viem/chains'

export const chainIdToExplorer: Record<number, string> = {
[base.id]: base.blockExplorers.default.url,
[optimism.id]: optimism.blockExplorers.default.url,
}
6 changes: 6 additions & 0 deletions example/constants/networkToChainId.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { base, optimism } from 'viem/chains'

export const networkToChainId: Record<'optimism' | 'base', number> = {
base: base.id,
optimism: optimism.id,
}

0 comments on commit 6d567ef

Please sign in to comment.