Skip to content

Commit

Permalink
chore(repo): set stricter type checking
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcnk committed Nov 7, 2024
1 parent 02abcb9 commit 169de40
Show file tree
Hide file tree
Showing 33 changed files with 76 additions and 215 deletions.
2 changes: 1 addition & 1 deletion apps/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "module",
"scripts": {
"dev": "bunx --bun vite",
"build": "tsc --noEmit && bun run build:rpc && bunx --bun vite build",
"build": "bunx --bun tsc --noEmit && bun run build:rpc && bunx --bun vite build",
"build:rpc": "bunx --bun tsup",
"build:firefox": "web-ext build --source-dir=dist",
"build:safari": "xcrun safari-web-extension-converter dist --app-name Pallad --bundle-identifier co.pallad.app --swift --no-prompt --force --macos-only --no-open",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
},
"scripts": {
"build": "bunx --bun tsup src/index.ts --dts --format esm --silent",
"build": "bunx --bun tsc --noEmit && bunx --bun tsup src/index.ts --dts --format esm --silent",
"cleanup": "bunx --bun rimraf node_modules dist .turbo"
}
}
2 changes: 1 addition & 1 deletion packages/features/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}
},
"scripts": {
"build": "bunx --bun tsup",
"build": "bunx --bun tsc --noEmit && bunx --bun tsup",
"dev": "bunx --bun tsup --watch",
"test:unit": "echo 'not yet'",
"story:dev": "VITE_APP_LADLE=true bunx --bun ladle serve",
Expand Down
45 changes: 0 additions & 45 deletions packages/features/src/address-book/components/contact-tile.tsx

This file was deleted.

76 changes: 0 additions & 76 deletions packages/features/src/address-book/components/new-address-form.tsx

This file was deleted.

4 changes: 3 additions & 1 deletion packages/features/src/common/hooks/use-transactions.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Mina } from "@palladxyz/mina-core"
import { getPublicKey, useVault } from "@palladxyz/vault"
import useSWR from "swr"

Expand All @@ -8,6 +9,7 @@ export const useTransactions = () => {
const networkId = useVault((state) => state.currentNetworkId)
return useSWR(
publicKey ? [publicKey, "transactions", networkId] : null,
() => getTransactions(networkId, publicKey, "MINA"), // TODO: remove hardcoded 'MINA'
() =>
getTransactions(networkId, publicKey, "MINA") as Mina.TransactionBody[], // TODO: remove hardcoded 'MINA'
)
}
1 change: 0 additions & 1 deletion packages/features/src/common/lib/validation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { utf8ToBytes } from "@noble/hashes/utils"
import { z } from "zod"

export const passwordSchema = z
Expand Down
1 change: 0 additions & 1 deletion packages/features/src/components/autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
import clsx from "clsx"
import { matchSorter } from "match-sorter"
import { take } from "rambda"
import React from "react"
import type { ClipboardEventHandler } from "react"
import type { UseFormRegisterReturn } from "react-hook-form"

Expand Down
2 changes: 1 addition & 1 deletion packages/features/src/components/hash-dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const HashDropdown = ({ hash, className }: HashDropdownProps) => {
toast.success("Hash Copied")
}
const openInExplorer = () => {
const url = currentNetworkInfo.explorer.transactionUrl.replace(
const url = currentNetworkInfo?.explorer.transactionUrl.replace(
"{hash}",
hash,
)
Expand Down
22 changes: 0 additions & 22 deletions packages/features/src/components/restart-wallet-alert.tsx

This file was deleted.

1 change: 0 additions & 1 deletion packages/features/src/components/wizard-layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import clsx from "clsx"
import { ArrowLeftIcon } from "lucide-react"
import { useNavigate } from "react-router-dom"
import { MenuBar } from "./menu-bar"

Expand Down
7 changes: 0 additions & 7 deletions packages/features/src/lock/views/unlock-wallet.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { UseFormReturn } from "react-hook-form"

import { FormError } from "@/components/form-error"
import { RestartWalletAlert } from "@/components/restart-wallet-alert"
import { WizardLayout } from "@/components/wizard-layout"
import clsx from "clsx"
import { EyeIcon, EyeOffIcon } from "lucide-react"
Expand All @@ -20,8 +19,6 @@ type UnlockWalletViewProps = {
}

export const UnlockWalletView = ({
restartAlertVisible,
setRestartAlertVisible,
form,
onSubmit,
showPassword,
Expand All @@ -42,10 +39,6 @@ export const UnlockWalletView = ({
</button>
}
>
<RestartWalletAlert
open={restartAlertVisible}
setOpen={setRestartAlertVisible}
/>
<div className="w-full flex flex-col flex-1 items-center gap-12">
<form
onSubmit={form.handleSubmit(onSubmit)}
Expand Down
1 change: 0 additions & 1 deletion packages/features/src/onboarding/routes/restore-wallet.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react"
import { useNavigate } from "react-router-dom"
import { shallow } from "zustand/shallow"

Expand Down
2 changes: 1 addition & 1 deletion packages/features/src/receive/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { action } from "@ladle/react"
import type { StoryDefault } from "@ladle/react"
import React from "react"

import { ReceiveView } from "./views/receive"

export const Receive = () => {
return (
<ReceiveView
walletName="Test"
publicKey="B62qizYjLtUebFFQuAnPjpLrUdWx4rLnptvzbVdNpY6EXff2U68Ljf5"
onCopyWalletAddress={action("Address Copied")}
onGoBack={action("Go Back")}
Expand Down
2 changes: 1 addition & 1 deletion packages/features/src/send/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const Send: Story<{ advanced: boolean }> = ({ advanced }) => (
fiatPrice={1.5}
advanced={advanced}
setAdvanced={action("Set Advanced")}
currentNetwork="Devnet"
networkId="mina:devnet"
/>
)

Expand Down
15 changes: 13 additions & 2 deletions packages/features/src/settings/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,17 @@ export const Settings = () => (
<SettingsView
onCloseClicked={action("Go Back")}
onDonateClicked={action("Donate Clicked")}
onLogOut={action("Log Out")}
/>
)

export const About = () => <AboutView onCloseClicked={action("Go Back")} />
export const AuthorizedZkApps = () => (
<AuthorizedZkAppsView onCloseClicked={action("Go Back")} />
<AuthorizedZkAppsView
onCloseClicked={action("Go Back")}
apps={[]}
handleDeleteApp={action("Delete App")}
/>
)

export const Support = () => <SupportView onCloseClicked={action("Go Back")} />
Expand All @@ -39,7 +44,13 @@ export const Language = () => (
<LanguageView onCloseClicked={action("Go Back")} />
)

export const Privacy = () => <PrivacyView onCloseClicked={action("Go Back")} />
export const Privacy = () => (
<PrivacyView
onCloseClicked={action("Go Back")}
setShareData={action("Share Data")}
shareData={true}
/>
)

export default {
title: "Settings",
Expand Down
4 changes: 3 additions & 1 deletion packages/features/src/staking/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export const Overview: Story<{ stakeDelegated: boolean }> = ({
}) => (
<StakingOverviewView
stakeDelegated={stakeDelegated}
onChangePool={action("Change Pool")}
account={null as never}
rewards={[]}
stats={{ avgReward: 0, totalReward: 0, lastReward: 0 }}
/>
)

Expand Down
26 changes: 22 additions & 4 deletions packages/features/src/staking/routes/staking-overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,34 @@ export const StakingOverviewRoute = () => {
.filter((tx) => tx.from !== accountInfo.MINA.publicKey)
const rewards = Array(6)
.fill({ amount: 0 })
.map((_, i) => ({ amount: rewardsTransactions?.[i]?.amount ?? 0 }))
.map((_, i) => ({
amount:
Number.parseFloat(
rewardsTransactions?.[i]?.amount?.toString() ?? "0",
) ?? 0,
}))
return (
<StakingOverviewView
account={account}
rewards={rewards}
stakeDelegated={account.stakeDelegated}
stats={{
lastReward: rewardsTransactions[0]?.amount ?? 0,
avgReward: mean(rewardsTransactions.map((tx) => tx?.amount)) || 0,
totalReward: sum(rewardsTransactions.map((tx) => tx?.amount)),
lastReward:
Number.parseFloat(
rewardsTransactions?.[0]?.amount?.toString() ?? "0",
) ?? 0,
avgReward:
mean(
rewardsTransactions?.map((tx) =>
Number.parseFloat(tx?.amount?.toString() ?? "0"),
) ?? [],
) ?? 0,
totalReward:
sum(
rewardsTransactions?.map((tx) =>
Number.parseFloat(tx?.amount?.toString() ?? "0"),
) ?? [],
) ?? 0,
}}
/>
)
Expand Down

This file was deleted.

Loading

0 comments on commit 169de40

Please sign in to comment.