Compare commits

..
Author SHA1 Message Date
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2b39669e46 Version Packages (#7277)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-06-05 05:30:01 -07:00
ArseniiandGitHub e3e3142f7e fix: handle short storage values in beacon proxy pattern (#7282) 2025-06-05 05:21:22 -07:00
ArseniiandGitHub 7c0b80d132 fix: handle short proxyStorage in getBeaconFromStorageSlot (#7281) 2025-06-05 04:45:21 -07:00
Joaquim VergesandGitHub 5c1db8bf27 [Dashboard] Add Sophon testnet to custom claim amounts (#7280) 2025-06-05 04:26:01 -07:00
Phillip HoandGitHub a87446a9e6 fix: invalid handling of ISO time in RPC graphs (#7279) 2025-06-05 17:01:04 +08:00
saminacodes 9493fda7bf [Docs] webhook and ub docs (#7278)
CORE-0000

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the user experience for webhooks in the thirdweb platform by updating sidebar navigation, adding troubleshooting information, and improving documentation on configuring webhooks.

### Detailed summary
- Updated sidebar in `insight` to rename "Getting Started" to "Get Started".
- Added "Troubleshoot" section with `WrenchIcon` in `pay` sidebar.
- Introduced troubleshooting content in `troubleshoot/page.mdx`.
- Enhanced `webhooks/page.mdx` with new structure and images for configuration steps.
- Revised descriptions and added a "Get started" section in `webhooks/page.mdx`.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Added a "Troubleshoot" section in the sidebar for Universal Bridge, providing guidance for resolving payment card issues.
  - Introduced a troubleshooting article explaining card support errors and suggesting alternative payment methods.

- **Documentation**
  - Enhanced the Insight Webhooks documentation with step-by-step setup instructions, visual aids, and improved metadata description.
  - Added a new "Get started" section to guide users through webhook creation and testing.

- **Style**
  - Renamed the "Getting Started" sidebar link under Webhooks to "Get Started" for consistency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-04 23:39:32 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
59dbae0c21 chore(deps): bump biomejs/setup-biome from 2.5.0 to 2.5.1 (#7250)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-04 16:00:50 -07:00
Jonas DanielsandGitHub 42236d43a8 [service-utils] Remove starter_legacy plan type (#7276) 2025-06-04 16:00:32 -07:00
jnsdls a920d1ee07 [Dashboard] Restrict billing actions to team owners only (#7274)
# Improve Billing UI for Non-Owner Team Members

This PR enhances the billing UI to properly handle permissions for team members who aren't owners. It:

- Restricts billing actions to team owners only
- Adds tooltips explaining why certain actions are disabled
- Properly disables buttons for non-owner team members
- Improves the Button component to handle disabled state for non-button elements

## Key Changes:

- Added `isOwnerAccount` flag to billing components to conditionally render or disable actions
- Enhanced Button component to properly handle disabled state for non-button elements (like anchor tags)
- Added tooltips to explain why actions are disabled for non-owners
- Restricted the following actions to team owners only:
  - Selecting/changing plans
  - Managing billing
  - Topping up credits
  - Paying invoices

These changes ensure a better UX for team members who don't have billing permissions while maintaining full functionality for team owners.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
	- Added owner-only restrictions for billing and payment actions. Only team owners can change plans, manage billing, top up credits, or pay invoices. Non-owner users now see disabled buttons with tooltips explaining these restrictions.
- **Accessibility**
	- Improved accessibility for disabled buttons by adding appropriate ARIA attributes and visual indicators.
- **User Interface**
	- Updated tooltips and button states to clearly communicate permission-based access to billing features.
	- Enhanced button behavior to consistently reflect disabled states across different elements and contexts.
- **Bug Fixes**
	- Standardized disabled state handling for buttons and interactive elements, ensuring consistent visual and functional behavior.
- **Chores**
	- Replaced internal navigation links with standard anchor elements for external billing-related links, improving security with added link attributes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on enhancing user experience by adding an `isOwnerAccount` boolean prop to various components. This prop controls the visibility and functionality of certain actions, ensuring that only team owners can perform specific tasks.

### Detailed summary
- Changed `<Link>` to `<a>` in `billing.tsx` for proper link behavior.
- Added `isOwnerAccount` prop to multiple components and updated their functionality based on ownership status.
- Introduced `ToolTipLabel` to provide contextual information for actions restricted to team owners.
- Updated button states to reflect whether actions are enabled or disabled based on `isOwnerAccount`.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
2025-06-04 14:02:54 -07:00
MananTank 2329a22bf1 Dashboard: Poll for active claim condition before continuing with minting in coin launch (#7273)
<!--

## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"

If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):

## Notes for the reviewer

Anything important to call out? Be sure to also clarify these in your comments.

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces a polling mechanism to ensure that claim conditions are set before proceeding with token minting in the `CreateTokenAssetPage` component.

### Detailed summary
- Added import for `pollWithTimeout` utility.
- Implemented polling logic to check for active claim conditions before minting.
- Set a timeout of 30 seconds for the polling process.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **New Features**
  - Improved the token creation process by ensuring minting only begins after claim conditions are confirmed, providing a more reliable experience for users.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-04 20:14:51 +00:00
Jonas DanielsandGitHub b25d2afa8b [Dashboard] Fix peak rate date formatting with error handling (#7271) 2025-06-04 02:19:36 -07:00
46 changed files with 435 additions and 204 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ jobs:
uses: ./.github/composite-actions/install
- name: Setup Biome
uses: biomejs/setup-biome@f382a98e582959e6aaac8e5f8b17b31749018780 # v2.5.0
uses: biomejs/setup-biome@a9763ed3d2388f5746f9dc3e1a55df7f4609bc89 # v2.5.1
with:
version: latest
+3 -2
View File
@@ -84,12 +84,13 @@ export function BillingPortalButton(props: {
props.buttonProps?.onClick?.(e);
}}
>
<Link
<a
href={buildBillingPortalUrl({ teamSlug: props.teamSlug })}
target="_blank"
rel="noreferrer"
>
{props.children}
</Link>
</a>
</Button>
);
}
@@ -192,7 +192,6 @@ const billingPlanToSkuMap: Record<Team["billingPlan"], ProductSKU | undefined> =
accelerate: undefined,
free: undefined,
growth_legacy: undefined,
starter_legacy: undefined,
};
type FeatureItemProps = {
+21 -3
View File
@@ -45,17 +45,35 @@ export interface ButtonProps
}
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
({ className, variant, size, asChild = false, disabled, ...props }, ref) => {
const Comp = asChild ? Slot : "button";
// "button" elements automatically handle the `disabled` attribute.
// For non-button elements rendered via `asChild` (e.g. <a>), we still want
// to visually convey the disabled state and prevent user interaction.
// We do that by conditionally adding the same utility classes that the
// `disabled:` pseudo-variant would normally apply and by setting
// `aria-disabled` for accessibility.
const disabledClass = disabled ? "pointer-events-none opacity-50" : "";
const btnOnlyProps =
Comp === "button"
? { type: props.type || ("button" as const) }
? {
type:
(props as React.ButtonHTMLAttributes<HTMLButtonElement>).type ||
("button" as const),
}
: undefined;
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
className={cn(
buttonVariants({ variant, size, className }),
disabledClass,
)}
ref={ref}
aria-disabled={disabled ? true : undefined}
disabled={disabled}
{...props}
{...btnOnlyProps}
/>
@@ -3,6 +3,8 @@ const customClaimAmounts: Record<number, number> = {
631571: 0.1,
// Aleph Zero
2039: 0.1,
// Sophon testnet
531050104: 5,
};
const defaultClaimAmount = 0.01;
@@ -14,7 +14,7 @@ const teamPlanToBadgeVariant: Record<
free: "secondary",
// yellow
starter: "warning",
starter_legacy: "warning",
growth_legacy: "warning",
// green
accelerate: "success",
@@ -28,9 +28,7 @@ export function getTeamPlanBadgeLabel(plan: Team["billingPlan"]) {
if (plan === "growth_legacy") {
return "Growth - Legacy";
}
if (plan === "starter_legacy") {
return "Starter - Legacy";
}
return plan;
}
@@ -9,12 +9,14 @@ export function PlanInfoCardClient(props: {
team: Team;
openPlanSheetButtonByDefault: boolean;
highlightPlan: Team["billingPlan"] | undefined;
isOwnerAccount: boolean;
}) {
return (
<PlanInfoCardUI
openPlanSheetButtonByDefault={props.openPlanSheetButtonByDefault}
team={props.team}
subscriptions={props.subscriptions}
isOwnerAccount={props.isOwnerAccount}
getTeam={async () => {
const res = await apiServerProxy<{
result: Team;
@@ -24,12 +24,6 @@ export const Free: Story = {
},
};
export const StarterLegacy: Story = {
args: {
plan: "starter_legacy",
},
};
export const Starter: Story = {
args: {
plan: "starter",
@@ -120,6 +114,7 @@ function Story(props: {
getTeam={teamTeamStub}
highlightPlan={undefined}
openPlanSheetButtonByDefault={false}
isOwnerAccount={true}
/>
</BadgeContainer>
@@ -133,6 +128,7 @@ function Story(props: {
getTeam={teamTeamStub}
highlightPlan={undefined}
openPlanSheetButtonByDefault={false}
isOwnerAccount={true}
/>
</BadgeContainer>
@@ -143,6 +139,7 @@ function Story(props: {
getTeam={teamTeamStub}
highlightPlan={undefined}
openPlanSheetButtonByDefault={false}
isOwnerAccount={true}
/>
</BadgeContainer>
@@ -153,6 +150,7 @@ function Story(props: {
getTeam={teamTeamStub}
highlightPlan={undefined}
openPlanSheetButtonByDefault={false}
isOwnerAccount={true}
/>
</BadgeContainer>
@@ -163,6 +161,7 @@ function Story(props: {
getTeam={teamTeamStub}
highlightPlan={undefined}
openPlanSheetButtonByDefault={false}
isOwnerAccount={true}
/>
</BadgeContainer>
</div>
@@ -13,6 +13,7 @@ import {
SheetHeader,
SheetTitle,
} from "@/components/ui/sheet";
import { ToolTipLabel } from "@/components/ui/tooltip";
import { CancelPlanButton } from "components/settings/Account/Billing/CancelPlanModal/CancelPlanModal";
import { BillingPricing } from "components/settings/Account/Billing/Pricing";
import { differenceInDays, isAfter } from "date-fns";
@@ -30,6 +31,7 @@ export function PlanInfoCardUI(props: {
getTeam: () => Promise<Team>;
openPlanSheetButtonByDefault: boolean;
highlightPlan: Team["billingPlan"] | undefined;
isOwnerAccount: boolean;
}) {
const { subscriptions, team, openPlanSheetButtonByDefault } = props;
const validPlan = getValidTeamPlan(team);
@@ -66,12 +68,7 @@ export function PlanInfoCardUI(props: {
<div className="flex flex-col items-start gap-0.5">
<div className="flex items-center gap-2">
<h3 className="font-semibold text-2xl capitalize tracking-tight">
{validPlan === "growth_legacy"
? "Growth"
: validPlan === "starter_legacy"
? "Starter"
: validPlan}{" "}
Plan
{validPlan === "growth_legacy" ? "Growth" : validPlan} Plan
</h3>
{validPlan.includes("legacy") && (
<Badge variant="warning">Legacy</Badge>
@@ -112,32 +109,57 @@ export function PlanInfoCardUI(props: {
{props.team.billingPlan !== "free" && (
<div className="flex items-center gap-3">
<Button
variant="outline"
size="sm"
className="gap-2 bg-background"
onClick={() => {
setIsPlanSheetOpen(true);
}}
<ToolTipLabel
label={
props.isOwnerAccount
? null
: "Only team owners can change plans."
}
>
<SquarePenIcon className="size-4 text-muted-foreground" />
Change Plan
</Button>
<div>
<Button
variant="outline"
size="sm"
className="gap-2 bg-background"
onClick={() => {
setIsPlanSheetOpen(true);
}}
disabled={!props.isOwnerAccount}
>
<SquarePenIcon className="size-4 text-muted-foreground" />
Change Plan
</Button>
</div>
</ToolTipLabel>
{props.team.planCancellationDate ? (
<RenewSubscriptionButton
teamId={props.team.id}
getTeam={props.getTeam}
/>
) : (
<CancelPlanButton
teamId={props.team.id}
teamSlug={props.team.slug}
billingStatus={props.team.billingStatus}
currentPlan={props.team.billingPlan}
getTeam={props.getTeam}
/>
)}
<ToolTipLabel
label={
props.isOwnerAccount
? null
: props.team.planCancellationDate
? "Only team owners can renew plans."
: "Only team owners can cancel plans."
}
>
<div>
{props.team.planCancellationDate ? (
<RenewSubscriptionButton
teamId={props.team.id}
getTeam={props.getTeam}
disabled={!props.isOwnerAccount}
/>
) : (
<CancelPlanButton
teamId={props.team.id}
teamSlug={props.team.slug}
billingStatus={props.team.billingStatus}
currentPlan={props.team.billingPlan}
getTeam={props.getTeam}
disabled={!props.isOwnerAccount}
/>
)}
</div>
</ToolTipLabel>
</div>
)}
</div>
@@ -153,16 +175,28 @@ export function PlanInfoCardUI(props: {
To unlock additional usage, upgrade your plan to Starter or
Growth.
</p>
<div className="mt-4">
<Button
variant="default"
size="sm"
onClick={() => {
setIsPlanSheetOpen(true);
}}
<ToolTipLabel
label={
props.isOwnerAccount
? null
: "Only team owners can change plans."
}
>
Select a plan
</Button>
<div>
<Button
disabled={!props.isOwnerAccount}
variant="default"
size="sm"
onClick={() => {
setIsPlanSheetOpen(true);
}}
>
Select a plan
</Button>
</div>
</ToolTipLabel>
</div>
</div>
) : (
@@ -203,17 +237,28 @@ export function PlanInfoCardUI(props: {
</Button>
{/* manage team billing */}
<BillingPortalButton
teamSlug={team.slug}
buttonProps={{
variant: "outline",
size: "sm",
className: "bg-background gap-2",
}}
<ToolTipLabel
label={
props.isOwnerAccount
? null
: "Only team owners can manage billing."
}
>
<CreditCardIcon className="size-4 text-muted-foreground" />
Manage Billing
</BillingPortalButton>
<div>
<BillingPortalButton
teamSlug={team.slug}
buttonProps={{
variant: "outline",
size: "sm",
className: "bg-background gap-2",
disabled: !props.isOwnerAccount,
}}
>
<CreditCardIcon className="size-4 text-muted-foreground" />
Manage Billing
</BillingPortalButton>
</div>
</ToolTipLabel>
</div>
</div>
)}
@@ -12,8 +12,8 @@ import { Label } from "@/components/ui/label";
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
import { Separator } from "@/components/ui/separator";
import { Skeleton } from "@/components/ui/skeleton";
import { ToolTipLabel } from "@/components/ui/tooltip";
import { ArrowRightIcon, DollarSignIcon } from "lucide-react";
import Link from "next/link";
import { Suspense, use, useState } from "react";
import { ErrorBoundary } from "react-error-boundary";
import { ThirdwebMiniLogo } from "../../../../../../../components/ThirdwebMiniLogo";
@@ -28,11 +28,13 @@ const predefinedAmounts = [
interface CreditBalanceSectionProps {
balancePromise: Promise<number>;
teamSlug: string;
isOwnerAccount: boolean;
}
export function CreditBalanceSection({
balancePromise,
teamSlug,
isOwnerAccount,
}: CreditBalanceSectionProps) {
const [selectedAmount, setSelectedAmount] = useState<string>(
predefinedAmounts[0].value,
@@ -114,17 +116,30 @@ export function CreditBalanceSection({
</Suspense>
</ErrorBoundary>
<Button asChild className="w-full" size="lg">
<Link
href={`/checkout/${teamSlug}/topup?amount=${selectedAmount}`}
prefetch={false}
target="_blank"
>
<ThirdwebMiniLogo className="mr-2 h-4 w-4" />
Top Up With Crypto
<ArrowRightIcon className="ml-2 h-4 w-4" />
</Link>
</Button>
<ToolTipLabel
label={
isOwnerAccount ? null : "Only team owners can top up credits."
}
>
<div>
<Button
asChild
className="w-full"
size="lg"
disabled={!isOwnerAccount}
>
<a
href={`/checkout/${teamSlug}/topup?amount=${selectedAmount}`}
target="_blank"
rel="noopener noreferrer"
>
<ThirdwebMiniLogo className="mr-2 h-4 w-4" />
Top Up With Crypto
<ArrowRightIcon className="ml-2 h-4 w-4" />
</a>
</Button>
</div>
</ToolTipLabel>
</div>
</div>
</CardContent>
@@ -1,5 +1,6 @@
import { getStripeBalance } from "@/actions/stripe-actions";
import { type Team, getTeamBySlug } from "@/api/team";
import { getMemberById } from "@/api/team-members";
import { getTeamSubscriptions } from "@/api/team-subscription";
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
import { redirect } from "next/navigation";
@@ -25,16 +26,20 @@ export default async function Page(props: {
]);
const pagePath = `/team/${params.team_slug}/settings/billing`;
const [account, team, authToken] = await Promise.all([
getValidAccount(pagePath),
const account = await getValidAccount(pagePath);
const [team, authToken, teamMember] = await Promise.all([
getTeamBySlug(params.team_slug),
getAuthToken(),
getMemberById(params.team_slug, account.id),
]);
if (!team) {
if (!team || !teamMember) {
redirect("/team");
}
const isOwnerAccount = teamMember.role === "OWNER";
const subscriptions = await getTeamSubscriptions(team.slug);
if (!subscriptions) {
@@ -66,6 +71,7 @@ export default async function Page(props: {
subscriptions={subscriptions}
openPlanSheetButtonByDefault={searchParams.showPlans === "true"}
highlightPlan={highlightPlan}
isOwnerAccount={isOwnerAccount}
/>
</div>
@@ -74,6 +80,7 @@ export default async function Page(props: {
<CreditBalanceSection
teamSlug={team.slug}
balancePromise={getStripeBalance(team.stripeCustomerId)}
isOwnerAccount={isOwnerAccount}
/>
)}
@@ -11,6 +11,7 @@ import {
TableHeader,
TableRow,
} from "@/components/ui/table";
import { ToolTipLabel } from "@/components/ui/tooltip";
import {
ChevronLeftIcon,
ChevronRightIcon,
@@ -18,7 +19,6 @@ import {
DownloadIcon,
ReceiptIcon,
} from "lucide-react";
import Link from "next/link";
import { useQueryState } from "nuqs";
import { useTransition } from "react";
import type Stripe from "stripe";
@@ -30,6 +30,7 @@ export function BillingHistory(props: {
invoices: Stripe.Invoice[];
status: "all" | "past_due" | "open";
hasMore: boolean;
isOwnerAccount: boolean;
}) {
const [isLoading, startTransition] = useTransition();
const [cursor, setCursor] = useQueryState(
@@ -128,27 +129,58 @@ export function BillingHistory(props: {
{invoice.status === "open" && (
<>
{/* always show the crypto payment button */}
<Button variant="default" size="sm" asChild>
<Link
target="_blank"
href={`/checkout/${props.teamSlug}/invoice?invoice_id=${invoice.id}`}
>
<ThirdwebMiniLogo className="mr-2 h-4 w-4" />
Pay with crypto
</Link>
</Button>
<ToolTipLabel
label={
props.isOwnerAccount
? null
: "Only team owners can pay invoices."
}
>
<div>
<Button
variant="default"
size="sm"
asChild
disabled={!props.isOwnerAccount}
>
<a
target="_blank"
href={`/checkout/${props.teamSlug}/invoice?invoice_id=${invoice.id}`}
rel="noopener noreferrer"
>
<ThirdwebMiniLogo className="mr-2 h-4 w-4" />
Pay with crypto
</a>
</Button>
</div>
</ToolTipLabel>
{/* if we have a hosted invoice url, show that */}
{invoice.hosted_invoice_url && (
<Button variant="outline" size="sm" asChild>
<a
href={invoice.hosted_invoice_url}
target="_blank"
rel="noopener noreferrer"
>
<CreditCardIcon className="mr-2 h-4 w-4" />
Pay with Card
</a>
</Button>
<ToolTipLabel
label={
props.isOwnerAccount
? null
: "Only team owners can pay invoices."
}
>
<div>
<Button
variant="outline"
size="sm"
asChild
disabled={!props.isOwnerAccount}
>
<a
href={invoice.hosted_invoice_url}
target="_blank"
rel="noopener noreferrer"
>
<CreditCardIcon className="mr-2 h-4 w-4" />
Pay with Card
</a>
</Button>
</div>
</ToolTipLabel>
)}
</>
)}
@@ -1,5 +1,6 @@
import { getTeamInvoices } from "@/actions/stripe-actions";
import { getTeamBySlug } from "@/api/team";
import { getMemberById } from "@/api/team-members";
import { redirect } from "next/navigation";
import type { SearchParams } from "nuqs/server";
import { getValidAccount } from "../../../../../../account/settings/getAccount";
@@ -20,16 +21,19 @@ export default async function Page(props: {
const pagePath = `/team/${params.team_slug}/settings/invoices`;
const [, team] = await Promise.all([
// only called to verify login status etc
getValidAccount(pagePath),
const account = await getValidAccount(pagePath);
const [team, teamMember] = await Promise.all([
getTeamBySlug(params.team_slug),
getMemberById(params.team_slug, account.id),
]);
if (!team) {
redirect("/team");
}
const isOwnerAccount = teamMember?.role === "OWNER";
const invoices = await getTeamInvoices(team, {
cursor: searchParams.cursor ?? undefined,
status: searchParams.status ?? undefined,
@@ -54,6 +58,7 @@ export default async function Page(props: {
hasMore={invoices.has_more}
// fall back to "all" if the status is not set
status={searchParams.status ?? "all"}
isOwnerAccount={isOwnerAccount}
/>
</div>
);
@@ -55,7 +55,7 @@ export function CountGraph(props: {
data={props.data
.sort((a, b) => new Date(a.date).getTime() - new Date(b.date).getTime())
.map((v) => ({
time: `${v.date}Z`,
time: v.date,
includedCount: Number(v.includedCount) + Number(v.overageCount),
rateLimitedCount: Number(v.rateLimitedCount),
}))}
@@ -45,7 +45,7 @@ export function RateGraph(props: {
data={props.data
.sort((a, b) => new Date(a.date).getTime() - new Date(b.date).getTime())
.map((v) => ({
time: `${v.date}Z`,
time: v.date,
averageRate: Number(Number(v.averageRate).toFixed(2)),
peakRPS: Number(v.peakRPS),
maxLine: props.currentRateLimit,
@@ -2,7 +2,7 @@ import { getTeamBySlug } from "@/api/team";
import { getLast24HoursRPCUsage } from "@/api/usage/rpc";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { format } from "date-fns";
import { format, parseISO } from "date-fns";
import {
AlertTriangleIcon,
CheckCircleIcon,
@@ -63,6 +63,23 @@ export default async function RPCUsage(props: {
Number(totalCounts.rateLimitedCount) +
Number(totalCounts.overageCount);
const peakRateDate = (() => {
if (peakRate.date) {
try {
// treat peakRate.date as UTC
const date = peakRate.date.endsWith("Z")
? parseISO(peakRate.date)
: // force the timestamp to be in UTC
parseISO(`${peakRate.date}Z`);
return format(date, "MMM d, HH:mm");
} catch (e) {
console.error("Error parsing peak rate date", peakRate.date, e);
return null;
}
}
return null;
})();
return (
<div className="container mx-auto space-y-8 py-6">
<div className="flex flex-col gap-2">
@@ -113,9 +130,7 @@ export default async function RPCUsage(props: {
</div>
<p className="mt-1 text-muted-foreground text-xs">
<ClockIcon className="mr-1 inline h-3 w-3" />
{peakRate.date
? format(new Date(`${peakRate.date}Z`), "MMM d, HH:mm")
: "No Requests in last 24 hours"}
{peakRateDate ? peakRateDate : "No Requests in last 24 hours"}
</p>
</CardContent>
</Card>
@@ -134,12 +149,14 @@ export default async function RPCUsage(props: {
<CheckCircleIcon className="mr-1 h-3 w-3 text-green-500" />
<span>
{/* we count both included and overage as included */}
{(
((Number(totalCounts.includedCount) +
Number(totalCounts.overageCount)) /
Number(totalRequests)) *
100
).toFixed(1)}
{totalRequests === 0
? "0.0"
: (
((Number(totalCounts.includedCount) +
Number(totalCounts.overageCount)) /
Number(totalRequests)) *
100
).toFixed(1)}
% successful requests
</span>
</div>
@@ -159,7 +176,7 @@ export default async function RPCUsage(props: {
<span>
{/* if there are no requests, we show 100% success rate */}
{totalRequests === 0
? "100"
? "0.0"
: (
(Number(totalCounts.rateLimitedCount) /
Number(totalRequests)) *
@@ -21,10 +21,12 @@ import { deployERC20Contract } from "thirdweb/deploys";
import type { ClaimConditionsInput } from "thirdweb/dist/types/utils/extensions/drops/types";
import {
claimTo,
getActiveClaimCondition,
setClaimConditions as setClaimConditionsExtension,
transferBatch,
} from "thirdweb/extensions/erc20";
import { useActiveAccount } from "thirdweb/react";
import { pollWithTimeout } from "../../../../../../../../utils/pollWithTimeout";
import { useAddContractToProject } from "../../hooks/project-contracts";
import { CreateTokenAssetPageUI } from "./create-token-page.client";
import type { CreateAssetFormValues } from "./form";
@@ -241,6 +243,17 @@ export function CreateTokenAssetPage(props: {
chain,
});
// poll until claim conditions are set before moving on to minting
await pollWithTimeout({
shouldStop: async () => {
const claimConditions = await getActiveClaimCondition({
contract,
});
return !!claimConditions;
},
timeoutMs: 30000,
});
const totalSupply = Number(formValues.supply);
const salePercent = formValues.saleEnabled
? Number(formValues.saleAllocationPercentage)
@@ -1,10 +1,10 @@
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { TabPathLinks } from "@/components/ui/tabs";
import { DatabaseIcon, ExternalLinkIcon } from "lucide-react";
import Link from "next/link";
import { EngineIcon } from "../../../../../../../(dashboard)/(chain)/components/server/icons/EngineIcon";
import { TabPathLinks } from "../../../../../../../../../@/components/ui/tabs";
import { ImportEngineLink } from "./_components";
export default async function Layout(props: {
@@ -1,8 +1,5 @@
import { getTeamBySlug } from "@/api/team";
import { Button } from "@/components/ui/button";
import { TrackedLinkTW } from "@/components/ui/tracked-link";
import { PosthogIdentifierServer } from "components/wallets/PosthogIdentifierServer";
import { ArrowRightIcon } from "lucide-react";
import { redirect } from "next/navigation";
import { Suspense } from "react";
import { getAuthToken } from "../../api/lib/getAuthToken";
@@ -50,10 +47,6 @@ export default async function RootTeamLayout(props: {
return <PastDueBanner teamSlug={team_slug} />;
}
if (team.billingPlan === "starter_legacy") {
return <StarterLegacyDiscontinuedBanner teamSlug={team_slug} />;
}
return null;
})()}
@@ -71,33 +64,3 @@ export default async function RootTeamLayout(props: {
</div>
);
}
function StarterLegacyDiscontinuedBanner(props: {
teamSlug: string;
}) {
return (
<div className="border-red-600 border-b bg-red-50 px-4 py-6 text-red-800 dark:border-red-700 dark:bg-red-950 dark:text-red-100">
<div className="text-center">
<p>Starter legacy plans are being discontinued on May 31, 2025</p>
<p>
To prevent service interruptions and losing access to your current
features select a new plan
</p>
<Button
asChild
size="sm"
className="mt-3 gap-2 border border-red-600 bg-red-100 text-red-800 hover:bg-red-200 dark:border-red-700 dark:bg-red-900 dark:text-red-100 dark:hover:bg-red-800"
>
<TrackedLinkTW
href={`/team/${props.teamSlug}/~/settings/billing?showPlans=true`}
category="billingBanner"
label="starterLegacy_selectPlan"
>
Select a new plan
<ArrowRightIcon className="size-4" />
</TrackedLinkTW>
</Button>
</div>
</div>
);
}
@@ -49,10 +49,6 @@ function Variants(props: {
(t) => t.team.billingPlan === "starter",
);
const starterLegacyTeam = teamsAndProjectsStub.find(
(t) => t.team.billingPlan === "starter_legacy",
);
const growthTeam = teamsAndProjectsStub.find(
(t) => t.team.billingPlan === "growth",
);
@@ -80,8 +76,7 @@ function Variants(props: {
!growthLegacyTeam ||
!accelerateTeam ||
!scaleTeam ||
!proTeam ||
!starterLegacyTeam
!proTeam
) {
return <div> invalid storybook stubs </div>;
}
@@ -97,10 +92,6 @@ function Variants(props: {
<Variant team={starterTeam.team} type={props.type} />
</BadgeContainer>
<BadgeContainer label="Legacy Starter Plan">
<Variant team={starterLegacyTeam.team} type={props.type} />
</BadgeContainer>
<BadgeContainer label="Growth Plan">
<Variant team={growthTeam.team} type={props.type} />
</BadgeContainer>
@@ -1,9 +1,9 @@
"use client";
import { LoadingDots } from "@/components/ui/LoadingDots";
import { type ChartConfig, ChartContainer } from "@/components/ui/chart";
import { cn } from "@/lib/utils";
import { useMemo } from "react";
import { Area, AreaChart, Bar, BarChart } from "recharts";
import { cn } from "../../@/lib/utils";
type FakeCartData = {
value: number;
@@ -51,10 +51,7 @@ export const PlanToCreditsRecord: Record<Team["billingPlan"], CreditsRecord> = {
plan: "starter",
...tier1Credits,
},
starter_legacy: {
plan: "starter_legacy",
...tier1Credits,
},
growth: {
plan: "growth",
...tier1Credits,
@@ -26,6 +26,7 @@ export function CancelPlanButton(props: {
currentPlan: Team["billingPlan"];
billingStatus: Team["billingStatus"];
getTeam: () => Promise<Team>;
disabled?: boolean;
}) {
// shortcut the sheet in case the user is in the default state
if (props.billingStatus !== "invalidPayment" && props.currentPlan !== "pro") {
@@ -33,6 +34,7 @@ export function CancelPlanButton(props: {
<ImmediateCancelPlanButton
teamId={props.teamId}
getTeam={props.getTeam}
disabled={props.disabled}
/>
);
}
@@ -40,7 +42,12 @@ export function CancelPlanButton(props: {
return (
<Sheet>
<SheetTrigger asChild>
<Button variant="outline" size="sm" className="gap-2 bg-background">
<Button
variant="outline"
size="sm"
className="gap-2 bg-background"
disabled={props.disabled}
>
<CircleXIcon className="size-4 text-muted-foreground" />
Cancel Plan
</Button>
@@ -107,6 +114,7 @@ function ProPlanCancelPlanSheetContent() {
function ImmediateCancelPlanButton(props: {
teamId: string;
getTeam: () => Promise<Team>;
disabled?: boolean;
}) {
const router = useDashboardRouter();
const [isRoutePending, startTransition] = useTransition();
@@ -144,7 +152,7 @@ function ImmediateCancelPlanButton(props: {
variant="outline"
size="sm"
className="gap-2 bg-background"
disabled={showPlanSpinner}
disabled={showPlanSpinner || props.disabled}
asChild
>
<Link href={buildCancelPlanUrl({ teamId: props.teamId })} target="_blank">
@@ -33,7 +33,6 @@ function Variants() {
const plans: Team["billingPlan"][] = [
"free",
"starter_legacy",
"starter",
"growth_legacy",
"growth",
@@ -13,7 +13,6 @@ import { PRO_CONTACT_US_URL } from "../../../../constants/pro";
// this is used to determine whether to show "Upgrade" or "Downgrade" label based on tier level
const planToTierRecord: Record<Team["billingPlan"], number> = {
free: 0,
starter_legacy: 1,
starter: 2,
growth_legacy: 3,
growth: 4,
@@ -71,11 +70,7 @@ export const BillingPricing: React.FC<BillingPricingProps> = ({
validTeamPlan === "starter" ||
validTeamPlan === "growth_legacy"));
const highlightStarterPlan =
highlightPlan === "starter" ||
(!highlightPlan &&
!isCurrentPlanScheduledToCancel &&
validTeamPlan === "starter_legacy");
const highlightStarterPlan = highlightPlan === "starter";
const highlightScalePlan =
highlightPlan === "scale" ||
(!highlightPlan &&
@@ -4,7 +4,6 @@ import type { Team } from "@/api/team";
export const planToTierRecordForGating: Record<Team["billingPlan"], number> = {
free: 0,
starter: 1,
starter_legacy: 2,
growth: 3,
accelerate: 4,
growth_legacy: 5,
@@ -15,6 +15,7 @@ import { tryCatch } from "../../../../../utils/try-catch";
export function RenewSubscriptionButton(props: {
teamId: string;
getTeam: () => Promise<Team>;
disabled?: boolean;
}) {
const router = useDashboardRouter();
const [isRoutePending, setTransition] = useTransition();
@@ -71,7 +72,7 @@ export function RenewSubscriptionButton(props: {
variant="default"
size="sm"
className="gap-2"
disabled={showSpinner}
disabled={showSpinner || props.disabled}
>
{showSpinner ? (
<Spinner className="size-4" />
-6
View File
@@ -40,8 +40,6 @@ export function teamStub(id: string, billingPlan: Team["billingPlan"]): Team {
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
billingEmail: "[email protected]",
growthTrialEligible: false,
billingPlanVersion: 1,
canCreatePublicChains: null,
image: null,
isOnboarded: true,
@@ -132,10 +130,6 @@ export const teamsAndProjectsStub: Array<{ team: Team; projects: Project[] }> =
team: teamStub("2", "starter"),
projects: [projectStub("t2p1", "team-2"), projectStub("t2p2", "team-2")],
},
{
team: teamStub("3", "starter_legacy"),
projects: [projectStub("t3p1", "team-3"), projectStub("t2p2", "team-2")],
},
{
team: teamStub("3", "growth"),
projects: [projectStub("t3p1", "team-3"), projectStub("t2p2", "team-2")],
+1 -1
View File
@@ -3,7 +3,7 @@ import type { Team } from "@/api/team";
type SelectivePlans = Exclude<
Team["billingPlan"],
// we will never show cards for these plans - so exclude it
"accelerate" | "growth_legacy" | "free" | "starter_legacy"
"accelerate" | "growth_legacy" | "free"
>;
export const TEAM_PLANS: Record<
+1 -1
View File
@@ -65,7 +65,7 @@ export const sidebar: SideBar = {
icon: <WebhookIcon />,
links: [
{
name: "Getting Started",
name: "Get Started",
href: `${insightSlug}/webhooks`,
},
{
Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 KiB

+54 -7
View File
@@ -1,8 +1,11 @@
import { createMetadata } from "@doc";
import { createMetadata, Steps, Step, DocImage } from "@doc";
import CreateWebhook from './assets/create-webhooks.png'
import CreateFilters from './assets/create-filters.png'
import TestWebhook from './assets/test-webhook.png'
export const metadata = createMetadata({
title: "Insight Webhooks | thirdweb Infrastructure",
description: "Getting started with Insight webhooks",
description: "Receive real-time notifications for blockchain events",
image: {
title: "Insight",
icon: "insight",
@@ -13,8 +16,6 @@ export const metadata = createMetadata({
Webhooks allow you to receive notifications when specific blockchain events or transactions occur. This enables you to automate workflows and keep your applications in sync with on-chain activity.
## About Webhooks
### Data Delivery
Webhook events are collected and delivered in batches for optimal performance and reliability. This makes webhooks ideal for:
- Tracking when specific blockchain events occur
@@ -23,11 +24,57 @@ Webhook events are collected and delivered in batches for optimal performance an
- Triggering downstream processes
### Delivery Guarantees
Events are guaranteed to be delivered *at least once*.
Your application should implement idempotency and deduplication logic using the unique event ID in the payload.
Events may occasionally be delivered out of order.
Events are guaranteed to be delivered *at least once*. Your application should implement idempotency and deduplication logic using the unique event ID in the payload. Please note, events may occasionally be delivered out of order.
### Performance Requirements
- Your receiving endpoint must respond within 3 seconds
- If your endpoint consistently fails to respond in time, the webhook will be automatically suspended
- We recommend implementing a queue system if you need to perform time-consuming operations
## Get started
Webhooks can be configured in the thirdweb dashboard (recommended) by creating a project or [programmatically using the Insight API](/insight/webhooks/managing-webhooks).
<Steps>
<Step title="Navigate to Webhooks">
Creating a webhook requires a project. If you don't have a project yet, create one in the thirdweb dashboard and navigate to the Webhooks section.
</Step>
<Step title="Create a Webhook">
Select New Webhook and provide the following:
- **Name**: A descriptive name for your webhook
- **Endpoint URL**: The URL where you want to receive webhook notifications
- **Events**: Select an event or transaction filter type:
- **Event**: Triggered by specific blockchain events (e.g., token transfers, contract interactions)
- **Transaction**: Triggered by transactions matching specific criteria (e.g., from/to address, value)
<DocImage src={CreateWebhook} alt="Create Webhook" />
</Step>
<Step title="Configure Filters">
You can set up filters to narrow down the events or transactions that trigger the webhook.
For EVENTS:
- **Chain IDs**: Select the blockchain networks you want to monitor (e.g., Ethereum, Polygon)
- **Contract Addresses**: Specify contract addresses to filter events related to specific contracts
- **Event Signatures**: For event filters, you can specify event signatures to target specific events
- **ABI**: For event filters, you can provide the ABI of the contract- providing the contract's address will usually automatically fetch the ABI.
For TRANSACTION:
- **Chain IDs**: Select the blockchain networks you want to monitor
- **From/To Addresses**: Specify addresses to filter transactions by sender or recipient
- **Function Signatures**: For transaction filters, you can specify function signatures to target specific contract interactions
- **ABI**: For transaction filters, you can provide the ABI of the contract- providing the contract's address will usually automatically fetch the ABI.
<DocImage src={CreateFilters} alt="Create Filters"/>
</Step>
<Step title="Test & Create Webhook">
After creating the webhook, you can test it by sending a sample event. This allows you to verify that your endpoint is correctly configured to receive and process webhook notifications.
After successful testing, click "Create Webhook" to finalize the setup.
<DocImage src={TestWebhook} alt="Test Webhook" />
</Step>
</Steps>
+6
View File
@@ -11,6 +11,7 @@ import {
TriangleRightIcon,
WalletIcon,
WebhookIcon,
WrenchIcon,
} from "lucide-react";
const paySlug = "/pay";
@@ -116,6 +117,11 @@ export const sidebar: SideBar = {
href: `${paySlug}/webhooks`,
icon: <WebhookIcon />,
},
{
name: "Troubleshoot",
href: `${paySlug}/troubleshoot`,
icon: <WrenchIcon />,
},
{
name: "FAQs",
href: `${paySlug}/faqs`,
@@ -0,0 +1,11 @@
import {Details} from "@doc";
# Universal Bridge Troubleshoot Articles
<Details summary="Your card does not support this type of purchase.">
When using onramp providers, you may encounter an error stating "There was an issue processing your payment and you have not been charged. Your card does not support this type of purchase."
This typically means that your card issuer does not allow cryptocurrency purchases.
To work around this issue, you can try using a different card or payment method, such as debit card, if available.
</Details>
+9
View File
@@ -1,5 +1,14 @@
# @thirdweb-dev/service-utils
## 0.9.12
### Patch Changes
- [#7276](https://github.com/thirdweb-dev/js/pull/7276) [`42236d4`](https://github.com/thirdweb-dev/js/commit/42236d43a860e1d8b6b1f518bf6aa12bcf56b0ac) Thanks [@jnsdls](https://github.com/jnsdls)! - remove:
- `starter_legacy` plan type
- `billingPlanVersion` field
- `growthTrialEligible` field
## 0.9.11
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/service-utils",
"version": "0.9.11",
"version": "0.9.12",
"type": "module",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
-3
View File
@@ -105,7 +105,6 @@ type TeamCapabilities = {
type TeamPlan =
| "free"
| "starter"
| "starter_legacy"
| "growth_legacy"
| "growth"
| "accelerate"
@@ -119,7 +118,6 @@ export type TeamResponse = {
image: string | null;
billingPlan: TeamPlan;
supportPlan: TeamPlan;
billingPlanVersion: number;
createdAt: string;
updatedAt: string | null;
billingEmail: string | null;
@@ -133,7 +131,6 @@ export type TeamResponse = {
| "invalidPayment"
| "pastDue"
| null;
growthTrialEligible: false;
canCreatePublicChains: boolean | null;
enabledScopes: ServiceName[];
isOnboarded: boolean;
-2
View File
@@ -52,10 +52,8 @@ export const validTeamResponse: TeamResponse = {
updatedAt: new Date("2024-06-01").toISOString(),
billingPlan: "free",
supportPlan: "free",
billingPlanVersion: 1,
billingEmail: "[email protected]",
billingStatus: "noPayment",
growthTrialEligible: false,
canCreatePublicChains: false,
enabledScopes: ["storage", "rpc", "bundler"],
isOnboarded: true,
+6
View File
@@ -1,5 +1,11 @@
# thirdweb
## 5.102.5
### Patch Changes
- [#7282](https://github.com/thirdweb-dev/js/pull/7282) [`e3e3142`](https://github.com/thirdweb-dev/js/commit/e3e3142f7eb95291e3d617a70778534cb46a968b) Thanks [@catalyst17](https://github.com/catalyst17)! - fix implementation resolution for Beacon
## 5.102.4
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "thirdweb",
"version": "5.102.4",
"version": "5.102.5",
"repository": {
"type": "git",
"url": "git+https://github.com/thirdweb-dev/js.git#main"
@@ -0,0 +1,52 @@
import type { EIP1193RequestFn, EIP1474Methods } from "viem";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { ANVIL_CHAIN } from "../../../test/src/chains.js";
import { TEST_CLIENT } from "../../../test/src/test-clients.js";
import { getBytecode } from "../../contract/actions/get-bytecode.js";
import { eth_getStorageAt } from "../../rpc/actions/eth_getStorageAt.js";
import { getRpcClient } from "../../rpc/rpc.js";
import { resolveImplementation } from "./resolveImplementation.js";
// Mock dependencies
vi.mock("../../contract/actions/get-bytecode.js");
vi.mock("../../rpc/rpc.js");
vi.mock("../../rpc/actions/eth_getStorageAt.js");
describe.runIf(process.env.TW_SECRET_KEY)(
"Handle beacon proxy pattern",
async () => {
beforeEach(() => {
vi.resetAllMocks();
});
it("should handle beacon proxy pattern with short storage values", async () => {
// This test verifies that the implementation can handle short storage values
// which was the original issue we were trying to fix
const mockContract = {
address: "0x0000000000000000000000000000000000000001",
client: TEST_CLIENT,
chain: ANVIL_CHAIN,
} as const;
// Mock getBytecode to return a minimal proxy bytecode that will trigger the beacon check
const mockGetBytecode = vi
.fn()
.mockResolvedValueOnce("") // First call for proxy (empty bytecode triggers beacon check)
.mockResolvedValueOnce("0x1234"); // Second call for implementation
vi.mocked(getBytecode).mockImplementation(mockGetBytecode);
// Mock eth_getStorageAt to return a short value
const mockRpcRequest = { request: vi.fn() };
vi.mocked(getRpcClient).mockReturnValue(
mockRpcRequest as unknown as EIP1193RequestFn<EIP1474Methods>,
);
vi.mocked(eth_getStorageAt).mockResolvedValue("0x1234"); // Short storage value
const result = await resolveImplementation(mockContract);
// Should not throw and should return some result (even if it's the original address)
expect(result).toBeDefined();
expect(result.address).toBeDefined();
});
},
);
@@ -110,7 +110,10 @@ async function getBeaconFromStorageSlot(
position:
"0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50",
});
return `0x${proxyStorage.slice(-40)}`;
if (proxyStorage.length >= 40) {
return `0x${proxyStorage.slice(-40)}`;
}
return undefined;
} catch {
return undefined;
}
+2
View File
@@ -1,5 +1,7 @@
# @thirdweb-dev/wagmi-adapter
## 0.2.91
## 0.2.90
## 0.2.89
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/wagmi-adapter",
"version": "0.2.90",
"version": "0.2.91",
"repository": {
"type": "git",
"url": "git+https://github.com/thirdweb-dev/js.git#main"