Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: purchase history #1523

Merged
merged 26 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c443bfa
feat(AccountModal): add purchase history menu item
FBalint Oct 11, 2024
d07d0b6
rebase with latest changes
FBalint Oct 28, 2024
2cae3bd
connect to backend
FBalint Oct 31, 2024
f6455bf
use copyable address component
FBalint Oct 31, 2024
71e32cb
TEMP: forgot rebase process
FBalint Jan 21, 2025
6a50315
fix build errors
FBalint Jan 21, 2025
94f12d0
remove introduced default exports
FBalint Jan 21, 2025
204966e
fix: run biome check
BrickheadJohnny Jan 21, 2025
c5bbcad
feat(PurchaseHistoryDrawer): download receipts
FBalint Jan 21, 2025
d8c45d1
Merge remote-tracking branch 'origin/feat-purchase-history' into feat…
FBalint Jan 21, 2025
e348c0d
feat: initialize order verification on NFT mint
FBalint Jan 22, 2025
23290ed
refactor: include billing service types
FBalint Jan 22, 2025
663609f
fix(RequirementAccessIndicatorUI): exclude `red` color scheme
BrickheadJohnny Jan 22, 2025
d0344dd
refactor: move prettyDate to a util
BrickheadJohnny Jan 22, 2025
9d51ca0
fix(useOrders): don't revalidate on mount
BrickheadJohnny Jan 22, 2025
aef7300
refactor: simplify PurchaseHistoryDrawer
BrickheadJohnny Jan 22, 2025
22e785c
temp: use the dev api
BrickheadJohnny Jan 22, 2025
ffdfbd0
chore: run biome check
BrickheadJohnny Jan 22, 2025
a5ef236
fix: remove deprecated requirement components
BrickheadJohnny Jan 22, 2025
a6aba76
fix(useOrders): dynamic revalidateOnMount value
BrickheadJohnny Jan 22, 2025
b1a9022
fix: don't use custom rpc for sepolia
BrickheadJohnny Jan 22, 2025
8f88502
fix: update the types package
BrickheadJohnny Jan 22, 2025
d41e1e8
feat: limit order download to supported countries
FBalint Jan 23, 2025
5f36609
reset env to prod backend api
FBalint Jan 23, 2025
4f19ef9
fix: order fetching on drawer open
FBalint Jan 24, 2025
4ee3669
Merge remote-tracking branch 'origin/main' into feat-purchase-history
FBalint Feb 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"three": "^0.166.1",
"usehooks-ts": "^3.1.0",
"uuidv7": "^0.6.3",
"vaul": "^1.1.2",
"viem": "^2.22.4",
"wagmi": "^2.14.6",
"zod": "^3.22.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,12 @@ const useMintGuildPin = () => {
shareText: `Just minted my Guild Pin for joining ${name}!\nguild.xyz/${urlName}`,
})

createPurchase(hash)
verifyPurchase(hash)
}

const fetcherWithSign = useFetcherWithSign()

const createPurchase = (txHash: string) => {
const verifyPurchase = (txHash: string) => {
fetcherWithSign([
`/v2/users/${address}/orders/verify`,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Icon } from "@phosphor-icons/react/dist/lib/types"
import { PropsWithChildren, useState } from "react"

type Props = {
colorScheme: NonNullable<Exclude<BadgeProps["colorScheme"], "gold">>
colorScheme: NonNullable<Exclude<BadgeProps["colorScheme"], "gold" | "red">>
icon: Icon
isAlwaysOpen?: boolean
}
Expand All @@ -19,7 +19,7 @@ const CIRCLE_BG_CLASS = {
gray: "bg-secondary",
blue: "bg-info dark:bg-info-subtle-foreground",
green: "bg-success dark:bg-success-subtle-foreground",
orange: "bg-warning dark:bg-warning-subtle-foreground",
orange: "bg-warning dark:bg-warning-subtle-foreground",
} satisfies Record<Props["colorScheme"], string>

const RequirementAccessIndicatorUI = ({
Expand Down
13 changes: 13 additions & 0 deletions src/components/[guild]/collect/hooks/useCollectNft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,18 @@ const useCollectNft = () => {
})
const claimAmount = claimAmountFromForm ?? 1

const verifyPurchase = (txHash: string) => {
fetcherWithSign([
`/v2/users/${userAddress}/orders/verify`,
{
body: {
txHash: txHash,
chainId,
},
},
])
}

const mint = async () => {
setTxError(null)
setTxSuccess(false)
Expand Down Expand Up @@ -187,6 +199,7 @@ const useCollectNft = () => {

setTxSuccess(true)

verifyPurchase(hash)
return receipt
}

Expand Down
2 changes: 2 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { WagmiProvider } from "wagmi"
import { wagmiConfig } from "wagmiConfig"
import "../app/globals.css"
import { AccountModal } from "@/components/Account/components/AccountModal"
import { PurchaseHistoryDrawer } from "@/components/Account/components/PurchaseHistoryDrawer/PurchaseHistoryDrawer"
import { AnnouncementDialog } from "@/components/AnnouncementDialog"
import AppErrorBoundary from "@/components/AppErrorBoundary"
import { IntercomProvider } from "@/components/Providers/IntercomProvider"
Expand Down Expand Up @@ -84,6 +85,7 @@ const App = ({

<ClientOnly>
<AccountModal />
<PurchaseHistoryDrawer />
</ClientOnly>
</IntercomProvider>

Expand Down
13 changes: 6 additions & 7 deletions src/requirements/Farcaster/components/FarcasterCast.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { prettyDate } from "@/lib/prettyDate"
import { cn } from "@/lib/utils"
import { Icon } from "@phosphor-icons/react/dist/lib/types"
import {
Expand All @@ -24,12 +25,6 @@ export const FarcasterCast = ({
size?: string
}) => {
const url = `https://warpcast.com/${cast?.author.username}/${cast?.hash}`
const prettyDate =
cast?.timestamp &&
new Intl.DateTimeFormat("en-US", {
dateStyle: "short",
timeStyle: "short",
}).format(new Date(cast.timestamp))

if (size === "sm") {
return <FarcasterCastSmall cast={cast} error={error} loading={loading} />
Expand Down Expand Up @@ -76,7 +71,11 @@ export const FarcasterCast = ({
<span className="text-ellipsis font-bold text-sm">
{cast.author.display_name ?? cast.author.username}
</span>
<span className="text-muted-foreground text-xs">{prettyDate}</span>
{cast?.timestamp && (
<span className="text-muted-foreground text-xs">
{prettyDate(cast.timestamp)}
</span>
)}
</div>
</div>

Expand Down
1 change: 1 addition & 0 deletions src/requirements/Twitter/TwitterRequirement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import TwitterListLink from "./components/TwitterListLink"
import TwitterTweetLink from "./components/TwitterTweetLink"
import TwitterUserLink from "./components/TwitterUserLink"

type TW = Extract<RequirementType, `TWITTER_${string}`> | "LINK_VISIT"
type TwitterRequirementType =
| Extract<RequirementType, `TWITTER_${string}`>
/**
Expand Down
30 changes: 30 additions & 0 deletions src/static/billingSupportedCountries.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
export const SupportedCountryCodes = [
"AT",
"BE",
"BG",
"CY",
"CZ",
"DE",
"DK",
"EE",
"EL",
"ES",
"FI",
"FR",
"HR",
"HU",
"IE",
"IT",
"LT",
"LU",
"LV",
"MT",
"NL",
"PL",
"PT",
"RO",
"SE",
"SI",
"SK",
] as const
export type SupportedCountryCode = (typeof SupportedCountryCodes)[number]
Loading
Loading