Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
backmeupplz committed Jan 17, 2024
1 parent 84c8d18 commit 6041541
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions src/components/OlderTickets.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Spam__factory } from '@borodutch/spam-contract'
import { useAccount } from 'wagmi'
import { useAtomValue, useSetAtom } from 'jotai'
import { useAtom, useSetAtom } from 'jotai'
import { useEffect } from 'preact/hooks'
import { useEthersSigner } from 'hooks/useEthers'
import OlderTicket from 'models/OlderTicket'
Expand All @@ -11,7 +11,11 @@ import getDateString from 'helpers/getDateString'
import lastClaimedTimestampAtom from 'atoms/lastClaimedTimestamp'

function OlderTicketsSuspended({ tickets }: { tickets: OlderTicket[] }) {
const lastClaimedTimestamp = useAtomValue(lastClaimedTimestampAtom)
const [lastClaimedTimestamp, setLastClaimedTimestamp] = useAtom(
lastClaimedTimestampAtom
)
const { address } = useAccount()
const signer = useEthersSigner()
return (
<>
<p>
Expand All @@ -37,7 +41,25 @@ function OlderTicketsSuspended({ tickets }: { tickets: OlderTicket[] }) {
<td>{getDateString(ticket.toDate)}</td>
<td>{ticket.total}</td>
<td>
<TicketClaimButton ticket={ticket} />
<TicketClaimButton
ticket={ticket}
refreshClaimTimestamp={() => {
if (!address) {
throw new Error('No address found')
}
if (!signer) {
throw new Error('No signer found')
}
const contract = Spam__factory.connect(
env.VITE_CONTRACT,
signer
)
const bigintAddress = BigInt(address)
setLastClaimedTimestamp(
contract.lastClaimTimestamps(bigintAddress, 0n)
)
}}
/>
</td>
</tr>
))}
Expand Down

0 comments on commit 6041541

Please sign in to comment.