Skip to content

Commit

Permalink
fix: typecheck issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MartianGreed committed Aug 21, 2024
1 parent 25fb2cd commit be48bad
Show file tree
Hide file tree
Showing 38 changed files with 325 additions and 252 deletions.
2 changes: 1 addition & 1 deletion apps/nextjs/src/app/_components/StarkName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const StarkName = ({ address }: { address?: string }) => {
}, [address]);

const { data: starkName, refetch } = useStarkName({
address: address,
address: address as `0x${string}`,
});

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const TransactionSubmittedModalButton = ({
const { type, l2hash, l1hash } = transfer;
const isTransferCompleted = l1hash && l2hash;

if (l1hash === undefined || l2hash === undefined) return null;
let explorers;

if (type === ActionType.TRANSFER_TO_L2 || isTransferCompleted) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const TransactionAction = ({ tx }: { tx: CombinedTransaction }) => {
type: TransactionType.BRIDGE_REALMS_L2_TO_L1_CONFIRM,
chainId: SUPPORTED_L2_CHAIN_ID,
status: "complete",
timestamp: new Date().getTime(),
timestamp: new Date().getTime().toString(),
});
toast({
title: TransactionType.BRIDGE_REALMS_L2_TO_L1_CONFIRM,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ export function TransactionStatusL2({ hash }: { hash: string }) {
? "Loading..."
: isError
? error?.message
// @ts-expect-error TODO: check types with apibara
: data?.status === "REJECTED"
// @ts-expect-error TODO: check types with apibara
? `${data.status}`
// @ts-expect-error TODO: check types with apibara
: `${data?.execution_status}`}
</Badge>
);
Expand Down
4 changes: 2 additions & 2 deletions apps/nextjs/src/app/_components/wallet/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export const RenderExplorers = ({ isL1 = true }) => {
const { address } = useAccount();
const { address: l2address } = useL2Account();

const explorersL1 = [{ text: address, url: ETHERSCAN_ACCOUNT_URL(address) }];
const explorersL1 = [{ text: address, url: ETHERSCAN_ACCOUNT_URL(address as string) }];
const explorersL2 = [
{ text: l2address, url: STARKSCAN_ACCOUNT_URL(l2address) },
{ text: l2address, url: STARKSCAN_ACCOUNT_URL(l2address as string) },
];
const explorers = isL1 ? explorersL1 : explorersL2;

Expand Down
3 changes: 2 additions & 1 deletion apps/nextjs/src/app/account/assets/BridgeNftWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ import {

import AssetL1CollectionPreview from "./AssetL1CollectionPreview";
import AssetL2CollectionPreview from "./AssetL2CollectionPreview";
import { TransactionFinalityStatus } from "starknet";

export const BridgeNftWrapper = () => {
const [activeChain, setActiveChain] = useState("l1");
const { address } = useAccount();
const { data: pendingWithdrawals } = usePendingRealmsWithdrawals({
address,
status: "ACCEPTED_ON_L1",
status: TransactionFinalityStatus.ACCEPTED_ON_L1,
});
const { toggleAccount } = useUIStore((state) => state);

Expand Down
100 changes: 56 additions & 44 deletions apps/nextjs/src/app/account/delegates/DelegateCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// TODO: fix types on delegate.delegateProfileL54+
/* eslint-disable @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-assignment */

import Image from "next/image";
import { ReadMore } from "@/app/_components/ReadMore";
import { StarkName } from "@/app/_components/StarkName";
Expand All @@ -20,11 +20,19 @@ import {
import { SocialIcons } from "../../_components/SocialIcons";
import { DelegateActions } from "./DelegateActions";

interface DelegateCardProps {
delegate: RouterOutputs["delegates"]["all"]["items"][0] & {
delegateProfile?: NonNullable<{
interests: string[];
statement: string;
github: string;
twitter: string;
}>;
}
}
export function DelegateCard({
delegate,
}: {
delegate: RouterOutputs["delegates"]["all"]["items"][0];
}) {
}: DelegateCardProps) {
//const { data, isLoading, isError } = useStarkProfile({ address: delegate.id });

//const starkName = useStarkDisplayName(delegate.id);
Expand All @@ -51,51 +59,55 @@ export function DelegateCard({
</div>
</div>

{delegate.delegateProfile && (
<div className="mb-2 flex gap-1">
{ }
{delegate.delegateProfile.interests
?.slice(0, 3)
{
delegate.delegateProfile && (
<div className="mb-2 flex gap-1">
{
delegate.delegateProfile.interests
.slice(0, 3)

.map((interest, index: number) => (
<Badge
key={index}
variant={"outline"}
className="px-1 py-0.5 text-xs"
>
{interest}
</Badge>
))}
{delegate.delegateProfile.interests &&
delegate.delegateProfile.interests.length > 3 && (
<Popover>
<PopoverTrigger asChild>
.map((interest: string, index: number) => (
<Badge
key={index}
variant={"outline"}
className="cursor-pointer px-1 py-0.5 text-xs"
className="px-1 py-0.5 text-xs"
>
+{delegate.delegateProfile.interests.length - 3}
{interest}
</Badge>
</PopoverTrigger>
<PopoverContent className="w-96">
<div className="flex flex-wrap gap-1">
{delegate.delegateProfile.interests
.slice(3)
.map((interest, index) => (
<Badge
key={index}
variant={"outline"}
className="px-1 py-0.5 text-xs"
>
{interest}
</Badge>
))}
</div>
</PopoverContent>
</Popover>
)}
</div>
)}
))}
{
delegate.delegateProfile.interests.length > 3 && (
<Popover>
<PopoverTrigger asChild>
<Badge
variant={"outline"}
className="cursor-pointer px-1 py-0.5 text-xs"
>
+{
delegate.delegateProfile.interests.length - 3}
</Badge>
</PopoverTrigger>
<PopoverContent className="w-96">
<div className="flex flex-wrap gap-1">
{
delegate.delegateProfile.interests
.slice(3)
.map((interest: string, index: number) => (
<Badge
key={index}
variant={"outline"}
className="px-1 py-0.5 text-xs"
>
{interest}
</Badge>
))}
</div>
</PopoverContent>
</Popover>
)}
</div>
)
}
</CardTitle>
</CardHeader>
{delegate.delegateProfile && (
Expand Down
5 changes: 3 additions & 2 deletions apps/nextjs/src/app/account/lords/Migration.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { UsersRealmsQuery } from "@/types/subgraph";
import type { Realm, UsersRealmsQuery } from "@/types/subgraph";
import type { ColumnDef } from "@tanstack/react-table";
import { useState } from "react";
import Link from "next/link";
import { GalleonStaking } from "@/abi/L1/v1GalleonStaking";
Expand Down Expand Up @@ -47,7 +48,7 @@ function UnstakeStep({
? realmsData.bridgedRealms
: realmsData.bridgedV2Realms
}
columns={columns}
columns={columns as ColumnDef<Pick<Realm, "id" | "name">>[]}
onRowSelectionChange={setSelectedRows}
rowSelection={selectedRows}
/>
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/src/app/account/lords/VeLords.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const VeLords = () => {
const { address } = useAccount();
const { isLoading, data } = useBalance({
address,
token: LORDS[SUPPORTED_L2_CHAIN_ID]?.address,
token: LORDS[SUPPORTED_L2_CHAIN_ID]?.address as `0x${string}`,
watch: true,
});
const [amount, setAmount] = useState<string>();
Expand Down
Loading

0 comments on commit be48bad

Please sign in to comment.