-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added types, calls and initial frontend components
- Loading branch information
1 parent
1a96d69
commit c7ec0cf
Showing
4 changed files
with
55 additions
and
0 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
45 changes: 45 additions & 0 deletions
45
packages/admin-ui/src/pages/dashboard/components/ConnectWallet.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,45 @@ | ||
import React from "react"; | ||
import { ethers } from "ethers"; | ||
import CardList from "components/CardList"; | ||
import { useApi } from "api"; | ||
import ErrorView from "components/ErrorView"; | ||
import Ok from "components/Ok"; | ||
import Alert from "react-bootstrap/esm/Alert"; | ||
|
||
declare global { | ||
interface Window { | ||
ethereum: any; | ||
} | ||
} | ||
|
||
export default function ConnectWallet() { | ||
const ethClients = useApi.ethClientsGet(); | ||
|
||
async function connectWallet() { | ||
await window.ethereum.enable(); | ||
const provider = new ethers.providers.Web3Provider(window.ethereum); | ||
} | ||
|
||
if (ethClients.error) | ||
return <ErrorView error={ethClients.error} hideIcon red />; | ||
if (ethClients.isValidating) return <Ok loading msg="Loading eth clients" />; | ||
if (!ethClients.data) return <ErrorView error={"No data"} hideIcon red />; | ||
|
||
return ( | ||
<div className="dashboard-cards"> | ||
<div className="connect-wallet"> | ||
{ethClients.data.length === 0 ? ( | ||
<Alert className="connect-wallet-card" variant="success"> | ||
No eth client detected, get one from the dappstore | ||
</Alert> | ||
) : ( | ||
<CardList className="connect-wallet"> | ||
{ethClients.data.map(ethClient => ( | ||
<span></span> | ||
))} | ||
</CardList> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
} |
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,3 @@ | ||
import { EthClient } from "../types"; | ||
|
||
export async function ethClientsGet(): Promise<EthClient[]> {} |
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