Skip to content

Commit

Permalink
Fixed build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
namedotget committed Jan 17, 2025
1 parent 1e0a675 commit 1193286
Show file tree
Hide file tree
Showing 4 changed files with 221 additions and 1,109 deletions.
42 changes: 30 additions & 12 deletions ui/components/subscription/TeamManageMembers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function TeamMembers({
const sdk = useSDK()

const hatNames = useHatNames(hatsContract, wearer.hatIds)
const address = useAddress()

return (
<>
Expand Down Expand Up @@ -114,12 +115,20 @@ function TeamMembers({
hatName.hatId ===
hatIdDecimalToHex(managerHatId.toString())
) {
await queueSafeTx({
to: HATS_ADDRESS,
data: txData,
value: '0',
gasLimit: 1000000,
})
await queueSafeTx(
address,
[
{
to: HATS_ADDRESS,
data: txData,
value: '0',
gasLimit: 1000000,
},
],
{
safeTxGas: '1000000',
}
)
setHasDeletedMember(true)
} else {
const signer = sdk?.getSigner()
Expand Down Expand Up @@ -248,6 +257,8 @@ function TeamManageMembersModal({
if (!validateEthereumAddress(newMemberAddress))
return toast.error('Invalid address')

if (!address) return toast.error('Please connect your wallet')

const iface = new ethers.utils.Interface(HatsABI)
const txData = iface.encodeFunctionData('mintHat', [
selectedHatId,
Expand All @@ -258,12 +269,19 @@ function TeamManageMembersModal({
if (
selectedHatId === hatIdDecimalToHex(managerHatId.toString())
) {
await queueSafeTx({
to: HATS_ADDRESS,
data: txData,
value: '0',
safeTxGas: '1000000',
})
await queueSafeTx(
address,
[
{
to: HATS_ADDRESS,
data: txData,
value: '0',
},
],
{
safeTxGas: '1000000',
}
)
setHasAddedMember(true)
} else {
const signer = sdk?.getSigner()
Expand Down
7 changes: 3 additions & 4 deletions ui/cypress/integration/layout/card.cy.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { PrivyProvider } from '@privy-io/react-auth'
import { Sepolia } from '@thirdweb-dev/chains'
import React from 'react'
import { sepolia } from 'thirdweb/chains'
import { ThirdwebProvider } from 'thirdweb/react'
import { PrivyThirdwebSDKProvider } from '@/lib/privy/PrivyThirdwebSDKProvider'
import { PrivyThirdwebV5Provider } from '@/lib/privy/PrivyThirdwebV5Provider'
import Card from '../../../components/layout/Card'

Expand Down Expand Up @@ -46,7 +45,7 @@ describe('<Card />', () => {
cy.mount(
<PrivyProvider appId={process.env.NEXT_PUBLIC_PRIVY_APP_ID as string}>
<ThirdwebProvider>
<PrivyThirdwebV5Provider selectedChain={Sepolia}>
<PrivyThirdwebV5Provider selectedChain={sepolia}>
<Card type="citizen" metadata={metadata} />
</PrivyThirdwebV5Provider>
</ThirdwebProvider>
Expand Down Expand Up @@ -74,7 +73,7 @@ describe('<Card />', () => {
cy.mount(
<PrivyProvider appId={process.env.NEXT_PUBLIC_PRIVY_APP_ID as string}>
<ThirdwebProvider>
<PrivyThirdwebV5Provider selectedChain={Sepolia}>
<PrivyThirdwebV5Provider selectedChain={sepolia}>
<Card
header="Mobile Test"
hovertext="Test hovertext"
Expand Down
4 changes: 3 additions & 1 deletion ui/lib/tokens/hooks/useWatchTokenBalance.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//Watch a token balance of the selected wallet
import { useWallets } from '@privy-io/react-auth'
import { ethers } from 'ethers'
import { useContext, useEffect, useState } from 'react'
import PrivyWalletContext from '@/lib/privy/privy-wallet-context'

Expand All @@ -25,7 +26,8 @@ export default function useWatchTokenBalance(

async function getBalanceAndListen() {
if (tokenContract && wallet) {
provider = await wallet.getEthersProvider()
const privyProvider = await wallet.getEthereumProvider()
provider = new ethers.providers.Web3Provider(privyProvider)
await handleBalanceChange()

provider.on('block', handleBalanceChange)
Expand Down
Loading

0 comments on commit 1193286

Please sign in to comment.