-
Notifications
You must be signed in to change notification settings - Fork 6
Feat/escrow v2 migration to vite and wagmiv2 #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 15 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
fad0ab9
refactor(web): change svg import paths
ShubhamParkhi 87d65fd
fix(web): update package.json
ShubhamParkhi f3202c2
fix(web): use useChainId from wagmi
ShubhamParkhi 311abd2
fix(web): changed from process.env to import.meta.env
ShubhamParkhi 84e235b
fix(web): revert changed from process.env to import.meta.env
ShubhamParkhi b36be72
Merge branch 'kleros:master' into master
ShubhamParkhi 6cacf67
fix(web): type fix and wagmi hook
ShubhamParkhi 3acdc26
feat(web): migrate to wagmi v2
ShubhamParkhi 6a21d50
fix(web): include wallet connect project id
ShubhamParkhi 56f3da3
fix: process env variables outside vite
kemuru 74d7049
fix(web): fix page crash at the Payment step
ShubhamParkhi 0c44bb2
Merge pull request #76 from ShubhamParkhi/master
kemuru b0aca10
fix: delete arbitrableaddress from deploy script, update wagmi versions
kemuru 689a4d0
feat: update approve and create transaction hooks to wagmi v2
kemuru 48688c4
fix: fetch is now given by vite
kemuru 87eab29
fix: add react to escrowtimelineitems hook
kemuru fa22e08
fix(web): update testnet link
ShubhamParkhi 20ba6f1
fix(web): update icons
ShubhamParkhi 3b28af6
fix(web): update law balance icon
ShubhamParkhi baf6878
fix: icons color were hardcoded to night mode, add vite tsconfig
kemuru bc1b359
fix(web): update hooks to wagmi v2
ShubhamParkhi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -9,6 +9,3 @@ YARN_ENABLE_GLOBAL_CACHE = "true" | |
|
|
||
| [functions] | ||
| directory = "web/netlify/functions/" | ||
|
|
||
| [dev] | ||
| framework = "parcel" | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,46 +1,57 @@ | ||
| import React from "react"; | ||
| import { useAccount, useNetwork, useSwitchNetwork } from "wagmi"; | ||
| import { useWeb3Modal } from "@web3modal/react"; | ||
| import React, { useCallback } from "react"; | ||
| import { useAccount, useChainId, useSwitchChain } from "wagmi"; | ||
| import { useWeb3Modal, useWeb3ModalState } from "@web3modal/wagmi/react"; | ||
| import { Button } from "@kleros/ui-components-library"; | ||
| import { SUPPORTED_CHAINS, DEFAULT_CHAIN } from "consts/chains"; | ||
| import AccountDisplay from "./AccountDisplay"; | ||
|
|
||
| export const SwitchChainButton: React.FC = () => { | ||
| const { switchNetwork, isLoading } = useSwitchNetwork(); | ||
| const handleSwitch = () => { | ||
| if (!switchNetwork) { | ||
| export const SwitchChainButton: React.FC<{ className?: string }> = ({ className }) => { | ||
| const { switchChain, isPending } = useSwitchChain(); | ||
| const handleSwitch = useCallback(() => { | ||
| if (!switchChain) { | ||
| console.error("Cannot switch network. Please do it manually."); | ||
| return; | ||
| } | ||
| try { | ||
| switchNetwork(DEFAULT_CHAIN); | ||
| switchChain({ chainId: DEFAULT_CHAIN }); | ||
| } catch (err) { | ||
| console.error(err); | ||
| } | ||
| }; | ||
| }, [switchChain]); | ||
| return ( | ||
| <Button | ||
| isLoading={isLoading} | ||
| disabled={isLoading} | ||
| {...{ className }} | ||
| isLoading={isPending} | ||
| disabled={isPending} | ||
| text={`Switch to ${SUPPORTED_CHAINS[DEFAULT_CHAIN].name}`} | ||
| onClick={handleSwitch} | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| const ConnectButton: React.FC = () => { | ||
| const { open, isOpen } = useWeb3Modal(); | ||
| return <Button disabled={isOpen} small text={"Connect"} onClick={async () => open({ route: "ConnectWallet" })} />; | ||
|
|
||
| const ConnectButton: React.FC<{ className?: string }> = ({ className }) => { | ||
| const { open } = useWeb3Modal(); | ||
| const { open: isOpen } = useWeb3ModalState(); | ||
| return ( | ||
| <Button | ||
| {...{ className }} | ||
| disabled={isOpen} | ||
| small | ||
| text={"Connect"} | ||
| onClick={async () => open({ view: "Connect" })} | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| const ConnectWallet: React.FC = () => { | ||
| const { chain } = useNetwork(); | ||
| const ConnectWallet: React.FC<{ className?: string }> = ({ className }) => { | ||
| const chainId = useChainId(); | ||
| const { isConnected } = useAccount(); | ||
| if (isConnected) { | ||
| if (chain && chain.id !== DEFAULT_CHAIN) { | ||
| return <SwitchChainButton />; | ||
| if (chainId !== DEFAULT_CHAIN) { | ||
| return <SwitchChainButton {...{ className }} />; | ||
| } else return <AccountDisplay />; | ||
| } else return <ConnectButton />; | ||
| } else return <ConnectButton {...{ className }} />; | ||
| }; | ||
|
|
||
| export default ConnectWallet; |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.