Skip to content

Commit

Permalink
refactor: upgrade typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
neel-ds committed Mar 27, 2024
1 parent 25195fe commit de3eab5
Show file tree
Hide file tree
Showing 17 changed files with 353 additions and 38 deletions.
2 changes: 1 addition & 1 deletion apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
"@types/node": "18.11.18",
"rimraf": "^5.0.1",
"ts-node": "^10.0.0",
"typescript": "^4.7.4"
"typescript": "^5.4.3"
}
}
2 changes: 1 addition & 1 deletion apps/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"@vitejs/plugin-react": "^3.1.0",
"typescript": "^4.9.3",
"typescript": "^5.4.3",
"vite": "^4.1.0",
"vite-plugin-node-polyfills": "^0.20.0"
}
Expand Down
13 changes: 11 additions & 2 deletions apps/client/src/pages/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ import {

const injectedConnector = new InjectedConnector({})

type Invite = {
groupId: string
}
type Group = {
credentials: {
id: string
}
}

export default function HomePage(): JSX.Element {
const [_inviteCode, setInviteCode] = useState<string>("")
const [_credentialGroupId, setCredentialGroupId] = useState<string>("")
Expand Down Expand Up @@ -59,7 +68,7 @@ export default function HomePage(): JSX.Element {
if (account && library) {
setLoading(true)

const invite = await getInvite(inviteCode)
const invite: Invite | null = await getInvite(inviteCode)

if (invite === null) {
setLoading(false)
Expand Down Expand Up @@ -112,7 +121,7 @@ export default function HomePage(): JSX.Element {
if (account && library) {
setLoading(true)

const group = await getGroup(groupId)
const group: Group | null = await getGroup(groupId)

if (group === null) {
setLoading(false)
Expand Down
1 change: 1 addition & 0 deletions apps/contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import "@nomicfoundation/hardhat-chai-matchers"
import "@nomicfoundation/hardhat-toolbox"
import "@nomicfoundation/hardhat-verify"
import { config as dotenvConfig } from "dotenv"
import "hardhat-dependency-compiler"
import { HardhatUserConfig } from "hardhat/config"
Expand Down
6 changes: 4 additions & 2 deletions apps/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
},
"devDependencies": {
"@nomicfoundation/hardhat-chai-matchers": "^2.0.6",
"@nomicfoundation/hardhat-ethers": "^3.0.0",
"@nomicfoundation/hardhat-network-helpers": "^1.0.10",
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.5",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@nomiclabs/hardhat-etherscan": "^3.1.8",
"@semaphore-protocol/group": "3.9.0",
Expand All @@ -33,7 +35,7 @@
"chai": "^5.1.0",
"dotenv": "^16.0.3",
"ethers": "^6.11.1",
"hardhat": "^2.11.0",
"hardhat": "^2.22.2",
"hardhat-dependency-compiler": "^1.1.3",
"hardhat-gas-reporter": "^1.0.8",
"prettier": "^2.8.4",
Expand All @@ -43,7 +45,7 @@
"solidity-coverage": "^0.8.1",
"ts-node": ">=8.0.0",
"typechain": "^8.1.0",
"typescript": ">=4.5.0"
"typescript": "^5.4.3"
},
"dependencies": {
"@openzeppelin/contracts": "4.7.3",
Expand Down
4 changes: 2 additions & 2 deletions apps/contracts/tasks/deploy-bandada-semaphore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Contract } from "ethers"
import type { BaseContract } from "ethers"
import { task, types } from "hardhat/config"

task("deploy:bandada-semaphore", "Deploy a BandadaSemaphore contract")
Expand All @@ -23,7 +23,7 @@ task("deploy:bandada-semaphore", "Deploy a BandadaSemaphore contract")
semaphoreVerifier: semaphoreVerifierAddress
},
{ ethers, run }
): Promise<Contract> => {
): Promise<BaseContract> => {
if (!semaphoreVerifierAddress) {
const PairingFactory = await ethers.getContractFactory(
"Pairing"
Expand Down
4 changes: 2 additions & 2 deletions apps/contracts/tasks/deploy-bandada.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Contract } from "ethers"
import type { BaseContract } from "ethers"
import { task, types } from "hardhat/config"

task("deploy:bandada", "Deploy a Bandada contract")
.addOptionalParam<boolean>("logs", "Print the logs", true, types.boolean)

.setAction(async ({ logs }, { ethers }): Promise<Contract> => {
.setAction(async ({ logs }, { ethers }): Promise<BaseContract> => {
const ContractFactory = await ethers.getContractFactory("Bandada")

const contract = await ContractFactory.deploy()
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"@vitejs/plugin-react": "^3.1.0",
"typescript": "^4.9.3",
"typescript": "^5.4.3",
"vite": "^4.1.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default function FinalPreviewStep({
</Heading>

<Box zIndex="1">
<GroupCard {...group} />
<GroupCard {...(group as any)} />
</Box>
</VStack>

Expand Down
2 changes: 1 addition & 1 deletion libs/api-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
"rimraf": "^4.1.2",
"rollup": "^3.17.2",
"rollup-plugin-cleanup": "^3.2.1",
"typescript": "^4.9.5"
"typescript": "^5.4.3"
}
}
2 changes: 1 addition & 1 deletion libs/credentials/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
"rimraf": "^4.1.2",
"rollup": "^3.17.2",
"rollup-plugin-cleanup": "^3.2.1",
"typescript": "^4.9.5"
"typescript": "^5.4.3"
}
}
2 changes: 1 addition & 1 deletion libs/hardhat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"rimraf": "^4.1.2",
"rollup": "^3.17.2",
"rollup-plugin-cleanup": "^3.2.1",
"typescript": "^4.9.5"
"typescript": "^5.4.3"
},
"peerDependencies": {
"@bandada/contracts": "2.1.1",
Expand Down
10 changes: 5 additions & 5 deletions libs/hardhat/src/tasks/deploy-bandada-semaphore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ task("deploy:bandada-semaphore", "Deploy BandadaSemaphore contract")

if (logs) {
console.info(
`Pairing library has been deployed to: ${pairing.address}`
`Pairing library has been deployed to: ${pairing.getAddress()}`
)
}

pairingAddress = pairing.address
pairingAddress = await pairing.getAddress()
}

const SemaphoreVerifierFactory =
Expand All @@ -62,11 +62,11 @@ task("deploy:bandada-semaphore", "Deploy BandadaSemaphore contract")

if (logs) {
console.info(
`SemaphoreVerifier contract has been deployed to: ${semaphoreVerifier.address}`
`SemaphoreVerifier contract has been deployed to: ${semaphoreVerifier.getAddress()}`
)
}

semaphoreVerifierAddress = semaphoreVerifier.address
semaphoreVerifierAddress = await semaphoreVerifier.getAddress()
}

if (!bandadaAddress) {
Expand All @@ -88,7 +88,7 @@ task("deploy:bandada-semaphore", "Deploy BandadaSemaphore contract")

if (logs) {
console.info(
`BandadaSemaphore contract has been deployed to: ${bandadaSemaphore.address}`
`BandadaSemaphore contract has been deployed to: ${bandadaSemaphore.getAddress}`
)
}

Expand Down
2 changes: 1 addition & 1 deletion libs/hardhat/src/tasks/deploy-bandada.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ task("deploy:bandada", "Deploy a Bandada contract")

if (logs) {
console.info(
`Bandada contract has been deployed to: ${bandada.address}`
`Bandada contract has been deployed to: ${bandada.getAddress()}`
)
}

Expand Down
2 changes: 1 addition & 1 deletion libs/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"rimraf": "^4.1.2",
"rollup": "^3.17.2",
"rollup-plugin-cleanup": "^3.2.1",
"typescript": "^4.9.5"
"typescript": "^5.4.3"
},
"dependencies": {
"axios": "^1.3.3",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"prettier": "^2.8.4",
"ts-jest": "29.0.5",
"tslib": "^2.5.0",
"typescript": "^4.7.0"
"typescript": "^5.4.3"
},
"config": {
"commitizen": {
Expand Down
Loading

0 comments on commit de3eab5

Please sign in to comment.