Skip to content

Commit

Permalink
Introduce VaultInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
lucemans committed Jun 1, 2024
1 parent 6fb33f7 commit 44c022e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
34 changes: 34 additions & 0 deletions src/components/modals/VaultInfo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { formatAddress } from "ens-tools";
import { useVaultBalance } from "hooks/useVaultBalance";
import { useVaultOwner } from "hooks/useVaultOwner";
import { FC } from "react";
import { useEnsName } from "wagmi";

import { Modal } from "./modal";

export const VaultInfo: FC<{ vaultId: bigint; onClose: () => void }> = ({
vaultId,
onClose
}) => {
const { data: owner } = useVaultOwner(vaultId);
const { data: balance } = useVaultBalance(vaultId);
const { data: ownerName } = useEnsName({ address: owner });

return (
<Modal
title={`Vault ${vaultId}`}
dismissOnBgClick
onCloseRequest={onClose}
>
<div>
<div>Owner</div>
<div>{ownerName || formatAddress(owner || "")}</div>
</div>
<div>
<div>Balance</div>
<div>{balance?.toString()}</div>
<button className="btn">Topup</button>
</div>
</Modal>
);
};
4 changes: 2 additions & 2 deletions src/hooks/useVaultNames.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useChainId } from "wagmi";

export const useVaultBalance = (vaultId: bigint) => {
export const useVaultNames = (vaultId: bigint) => {
const chainId = useChainId();

// TODO: hook up to substream
return [];
return { data: ["lucemans", "nevvdevv"] };
};

0 comments on commit 44c022e

Please sign in to comment.